matutil

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(m, n mat.Matrix) (*mat.Dense, error)

Add each corresponding element of the matrices together.

func Apply

func Apply(fn func(i, j int, v float64) float64, m mat.Matrix) (d *mat.Dense, err error)

Apply a function to all elements of a matrix.

func Dot

func Dot(m, n mat.Matrix) (d *mat.Dense, err error)

Dot product of 2 matrices.

func FillArray

func FillArray(size int, fill float64) []float64

FillArray creates an array of size with all elements equal to the fill value.

func FromVector

func FromVector(v []float64) (*mat.Dense, error)

FromVector creates a single-column matrix from a vector.

func MulElem

func MulElem(m, n mat.Matrix) (*mat.Dense, error)

MulElem each corresponding element of the matrices together.

func New

func New(r, c int, data []float64) (*mat.Dense, error)

New safely creates a new dense matrix.

func OptRandomArraySource

func OptRandomArraySource(src rand.Source) func(*RandomArrayCfg)

OptRandomArraySource sets the source

func RandomArray

func RandomArray(size int, v float64, opts ...func(*RandomArrayCfg)) []float64

RandomArray returns a random array of size.

func Scale

func Scale(s float64, m mat.Matrix) (*mat.Dense, error)

Scale each element of a matrix.

func Sub

func Sub(m, n mat.Matrix) (*mat.Dense, error)

Sub the corresponding elements of the second matrix from the first.

func ToVector

func ToVector(m mat.Matrix) (v []float64, err error)

ToVector creates a vector from a single-column matrix.

Types

type RandomArrayCfg

type RandomArrayCfg struct {
	Src rand.Source
}

RandomArrayCfg settings for random array generation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL