matrix

package module
v0.0.0-...-b7a2c09 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2014 License: BSD-2-Clause Imports: 2 Imported by: 0

README

Testing Image Issues

Matrix

matrix is a BSD licensed library that provides common matrix operations written in Go, inspired by Numpy. It has full coverage for tests.

Documentation

Godoc

License

BSD License

Supported Functions

  • where
  • take
  • dot product
  • determinant
  • minor matrix
  • cofactor matrix
  • apply
  • cumulative sum
  • lower triangle
  • upper triangle
  • diagonal

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(firstMatrix [][]float64, secondMatrix [][]float64) (result [][]float64)

Returns the sum of the given two matrix

func Apply

func Apply(matrix [][]float64, function func(x float64) float64) (result [][]float64)

Apply a function to all the elements of a matrix, the function will receive a float64 as param and returns a float64

func CofactorMatrix

func CofactorMatrix(matrix [][]float64) (result [][]float64)

Returns the Cofactor Matrix

func ComplexApply

func ComplexApply(matrix [][]complex128, function func(x complex128) complex128) (result [][]complex128)

Apply a function to a complex matrix the function will receive a complex128 and returns a complex128

func Concatenate

func Concatenate(firstMatrix [][]float64, secondMatrix [][]float64, axis int) (result [][]float64)

Concatenate two matrices along with their axises axis=0 => row-wise axis=1 => column-wise

func ConjugateMatrix

func ConjugateMatrix(matrix [][]complex128) (result [][]complex128)

Returns the Congugate Matrix

func CumulativeSum

func CumulativeSum(matrix [][]float64, axis int) (result []float64, ok bool)

Cumulative Sum of Matrix along with axis axis=0 => row-wise axis=1 => column-wise

func Determinant

func Determinant(matrix [][]float64) (result float64)

Calculates the determinant of the matrix

func Diagonal

func Diagonal(matrix [][]float64) (result []float64, ok bool)

Returns the diagonal of a matrix

func Divide

func Divide(firstMatrix [][]float64, secondMatrix [][]float64) [][]float64

Divide the first matrix by the second one

func DotProduct

func DotProduct(firstMatrix [][]float64, secondMatrix [][]float64) (result [][]float64)

Dot (Inner) product

func Eye

func Eye(args ...int) (result [][]float64, ok bool)

Returns an array where diagonal elements are 1 and remaining positions are 0 If it has been passed one parameter, it yields a square matrix Two parameters define the size of the matrix

func Inverse

func Inverse(matrix [][]float64) [][]float64

Calculates the inverse matrix

func LowerTriangle

func LowerTriangle(matrix [][]float64) (result [][]float64)

Lower Triangle Matrix

func Max

func Max(matrix [][]float64, axis int) (result []float64, ok bool)

Maximum of matrix along with axis axis=0 => row-wise axis=1 => column-wise

func Mean

func Mean(matrix [][]float64, axis int) (result []float64, ok bool)

Mean of matrix along with axis axis=0 => row-wise axis=1 => column-wise

func Median

func Median(matrix [][]float64, axis int) (result []float64, ok bool)

Median of matrix along with axis axis=0 => row-wise axis=1 => column-wise

func Min

func Min(matrix [][]float64, axis int) (result []float64, ok bool)

Minimum of matrix along with axis axis=0 => row-wise axis=1 => column-wise

func MinorMatrix

func MinorMatrix(matrix [][]float64) (result [][]float64)

Minor matrix of a given matrix

func MultTranspose

func MultTranspose(firstMatrix [][]float64, secondMatrix [][]float64) (result [][]float64)

Multiply on matrix by the Transposepose of the second matrix

func Multiply

func Multiply(firstMatrix [][]float64, secondMatrix [][]float64) (result [][]float64)

Multiplication of two matrices; element-wise

func MultiplyByScalar

func MultiplyByScalar(matrix [][]float64, scalar float64) [][]float64

Returns the rm of multiply all the elements of a matrix by a float number

func Subtract

func Subtract(firstMatrix [][]float64, secondMatrix [][]float64) [][]float64

Subtraction operation on two matrices

func Sum

func Sum(matrix [][]float64, axis int) (result []float64, ok bool)

Sum of the matrix along with axis axis=0 => row-wise axis=1 => column-wise

func SumAll

func SumAll(m [][]float64) (result float64)

Sum all the elements in a matrix

func Take

func Take(matrix [][]float64, indices []int) (result []float64, ok bool)

Take the elements of the matrix given in indices uses so called fancy indexing to determine the positions of the array

func Transpose

func Transpose(matrix [][]float64) (result [][]float64)

Matrix Transpose

func UpperTriangle

func UpperTriangle(matrix [][]float64) (result [][]float64)

Upper Triangle of Matrix

func Where

func Where(matrix [][]float64, function func(x float64) bool) (result []float64)

Returns the elements of the matrix which returns true for a given function

func Zeros

func Zeros(args []int) (result [][]float64, ok bool)

Returns an array filled with 0.s If it has been passed one parameter, it yields a square matrix Two parameters define the size of the matrix

Types

This section is empty.

Jump to

Keyboard shortcuts

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