Documentation ¶
Index ¶
- Variables
- func GetCol[Num Number](input [][]Num, col int) (resVal []Num)
- func GetRow[Num Number](input [][]Num, row int) (output []Num)
- func IsSquare[Num Number](input [][]Num) (is bool, matSize [2]int)
- func MatrixAdd[Num Number](a, b [][]Num) (resVal [][]Num, err error)
- func MatrixDetComp[Num constraints.Complex](matrix [][]Num) (det Num, err error)
- func MatrixDetReal[Num Real](matrix [][]Num) (det Num, err error)
- func MatrixMult[Num Number](a, b [][]Num) (resVal [][]Num, err error)
- func MatrixScalMult[Num Number](matr [][]Num, scal Num) (resVal [][]Num)
- func MatrixSize[Num Number](input [][]Num) (matrixSize [2]int)
- func MatrixSub[Num Number](a, b [][]Num) (resVal [][]Num, err error)
- func VectScalMult[Num Number](a, b []Num) (resVal Num, err error)
- type Number
- type Real
Constants ¶
This section is empty.
Variables ¶
var ErrDivByZero = errors.New("divide by zero")
var ErrMatNotCompatible = errors.New("matrices are not compatible")
var ErrMatNotSquare = errors.New("vector size missmatch")
var ErrMatSingular = errors.New("singular matrix")
var ErrMatSizeMissmatch = errors.New("matrix size missmatch")
var ErrVecSizeMissmatch = errors.New("vector size missmatch")
Functions ¶
func MatrixAdd ¶
MatrixAdd adds two 2D matrices of the same size Input: a, b are two matrices of the form [rows][column]Matrix Output: resVal is the sum matrix
func MatrixDetComp ¶
func MatrixDetComp[Num constraints.Complex](matrix [][]Num) (det Num, err error)
MatrixDet returns the Determinant of a square matrix using LU factorization Input: matrix is a matrix of the form [rows][column]Matrix Output: det is the determinant of the matrix
func MatrixDetReal ¶
MatrixDet returns the Determinant of a square matrix using LU factorization Input: matrix is a matrix of the form [rows][column]Matrix Output: det is the determinant of the matrix
func MatrixMult ¶
MatrixMult implements the multiplication of two matrix using the naive approach Input: a, and b are two compatible matrices of the form [rows][column]Matrix Output: resVal is the scalar multiblication scal * [][]matr
func MatrixScalMult ¶
func MatrixScalMult[Num Number](matr [][]Num, scal Num) (resVal [][]Num)
MatrixScalMult implements the scalar multiplication of a matrix Input: matr is a matrix of the form [rows][column]Matrix scal is a scalar value Output: resVal is the scalar multiblication scal * [][]matr
func MatrixSize ¶
MatrixSize estimates the size of a 2D matrix Input: input is the numerical input matrix of the form [rows][column]Matrix Output: matrixSize is a vector with the size of the matrix [rows, columns]
func MatrixSub ¶
MatrixSub adds two 2D matrices of the same size Input: a, b are two matrices of the form [rows][column]Matrix Output: resVal is the substraction matrix
func VectScalMult ¶
VectScalMult implements the scalar multiplication of vectors Input: a, and b are two equaly sized (equal number of components) vectors of the form []Vector Output: resVal is the scalar multiblication []a * b[]
Types ¶
type Number ¶
type Number interface { constraints.Float | constraints.Integer | constraints.Complex }
Set of all numbers R(real) U C(complex) U i(imaginary)