Documentation ¶
Overview ¶
Package matrix provides a list of useful functions when working with gonum matrices.
Among many other functions it allows you calculate sums, mean and stddev values along chosen matrix dimensions.
Index ¶
- func AddVal(m *mat.Dense, val float64) (*mat.Dense, error)
- func BlockDiag(mx []mat.Matrix) *mat.Dense
- func BlockSymDiag(mx []mat.Symmetric) *mat.SymDense
- func ColsMax(cols int, m *mat.Dense) ([]float64, error)
- func ColsMean(cols int, m *mat.Dense) ([]float64, error)
- func ColsMin(cols int, m *mat.Dense) ([]float64, error)
- func ColsStdev(cols int, m *mat.Dense) ([]float64, error)
- func ColsSum(cols int, m *mat.Dense) ([]float64, error)
- func Cov(m *mat.Dense, dim string) (*mat.SymDense, error)
- func Format(m mat.Matrix) fmt.Formatter
- func NewDenseRand(rows, cols int, min, max float64) (*mat.Dense, error)
- func NewDenseVal(rows, cols int, val float64) (*mat.Dense, error)
- func NewDenseValIdentity(n int, val float64) (*mat.Dense, error)
- func RowsMax(rows int, m *mat.Dense) ([]float64, error)
- func RowsMean(rows int, m *mat.Dense) ([]float64, error)
- func RowsMin(rows int, m *mat.Dense) ([]float64, error)
- func RowsSum(rows int, m *mat.Dense) ([]float64, error)
- func SetVals(m *mat.Dense, vals []float64, byRow bool) (err error)
- func ToSymDense(m *mat.Dense) (*mat.SymDense, error)
- func Unroll(m *mat.Dense, byRow bool) *mat.VecDense
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddVal ¶
AddVal adds a constant value to every element of matrix It modifies the matrix m passed in as a paramter. AddConstant fails with error if empty matrix is supplied
func BlockDiag ¶
BlockDiag accepts a slice of matrices, turns them into a block diagonal matrix and returns it. It skips zero sized matrices when assembling the block diagonal matrix.
func BlockSymDiag ¶
BlockSymDiag turns a slice of symmetric matrices into a symmetric block diagonal matrix and returns it. It skips zero sized matrices when assembling the symmetric block diagonal matrix.
func ColsMax ¶
ColsMax returns a slice of max values of first cols number of matrix columns It returns error if passed in matrix is nil, has zero size or requested number of columns exceeds the number of columns in the matrix passed in as parameter.
func ColsMean ¶
ColsMean returns a slice of mean values of first cols matrix columns It returns error if passed in matrix is nil or has zero size or requested number of columns exceeds the number of columns in matrix m.
func ColsMin ¶
ColsMin returns a slice of min values of first cols number of matrix columns It returns error if passed in matrix is nil, has zero size or requested number of columns exceeds the number of columns in the matrix passed in as parameter.
func ColsStdev ¶
ColsStdev returns a slice of standard deviations of first cols matrix columns It returns error if passed in matrix is nil or has zero size or requested number of columns exceeds the number of columns in matrix m.
func ColsSum ¶
ColsSum returns a slice of sum values of first cols number of matrix columns It returns error if passed in matrix is nil, has zero size or requested number of columns exceeds the number of columns in the matrix passed in as parameter.
func Cov ¶
Cov calculates a covariance matrix with data stored in m along dim dimension. It returns error if the covariance could not be calculated.
func NewDenseRand ¶
NewDenseRand creates a new matrix with provided number of rows and columns which is initialized to random numbers uniformly distributed in interval [min, max]. NewDenseRand fails if non-positive matrix dimensions are requested.
func NewDenseVal ¶
NewDenseVal returns a matrix with rows x cols whose each element is set to val. NewDenseVal fails if invalid matrix dimensions are requested.
func NewDenseValIdentity ¶
NewDenseValIdentity returns a matrix with size n x n whose diagonal elements are set to val. NewDenseValIdentity fails if invalid matrix dimensions are requested.
func RowsMax ¶
RowsMax returns a slice of max values of first rows matrix rows. It returns error if passed in matrix is nil or has zero size or requested number of rows exceeds the number of rows in matrix m.
func RowsMean ¶
RowsMean returns a slice of mean values of first rows matrix rows It returns error if passed in matrix is nil or has zero size or requested number of columns exceeds the number of columns in matrix m.
func RowsMin ¶
RowsMin returns a slice of min values of first rows matrix rows. It returns error if passed in matrix is nil or has zero size or requested number of rows exceeds the number of rows in matrix m.
func RowsSum ¶
RowsSum returns a slice of sum values of first rows number of matrix columns It returns error if passed in matrix is nil, has zero size or requested number of columns exceeds the number of columns in the matrix passed in as parameter.
func SetVals ¶
SetVals sets all elements of a matrix to values stored in vals passed in as a parameter. It fails with error if number of elements of the matrix is bigger than number of elements of the slice.
func ToSymDense ¶
ToSymDense converts m to SymDense (symmetric Dense matrix) if possible. It returns error if the provided Dense matrix is not symmetric.
Types ¶
This section is empty.