Documentation ¶
Overview ¶
mat contains routines for executing operations on matrices. Opersions are split into easy to use methods which might be somewhat wasteful with memory consumption and execution time and slightly less easy to use methods which require explictly managing LU decomposition.
Pretty much everything only works on square matrices because that's all I've needed so far.
Index ¶
- func MultVec(m *Matrix, v, out []float64)
- func VecMult(v []float64, m *Matrix, out []float64)
- type LUFactors
- type LUFactors32
- type Matrix
- func (m *Matrix) Determinant() float64
- func (m *Matrix) Init(vals []float64, width, height int)
- func (m *Matrix) Invert() *Matrix
- func (m *Matrix) LU() *LUFactors
- func (m *Matrix) LUFactorsAt(luf *LUFactors)
- func (m1 *Matrix) Mult(m2 *Matrix) *Matrix
- func (m1 *Matrix) MultAt(m2, out *Matrix) *Matrix
- func (m *Matrix) SolveMatrix(b *Matrix) *Matrix
- func (m *Matrix) SolveVector(bs []float64) []float64
- func (m *Matrix) Transpose() *Matrix
- func (m *Matrix) TransposeAt(out *Matrix)
- type Matrix32
- func (m *Matrix32) Determinant() float32
- func (m *Matrix32) Init(vals []float32, width, height int)
- func (m *Matrix32) Invert() *Matrix32
- func (m *Matrix32) LU() *LUFactors32
- func (m *Matrix32) LUFactorsAt(luf *LUFactors32)
- func (m1 *Matrix32) Mult(m2 *Matrix32) *Matrix32
- func (m1 *Matrix32) MultAt(m2, out *Matrix32) *Matrix32
- func (m *Matrix32) SolveMatrix(b *Matrix32) *Matrix32
- func (m *Matrix32) SolveVector(bs []float32) []float32
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LUFactors ¶
type LUFactors struct {
// contains filtered or unexported fields
}
LUFactors contains data fields neccessary for a number of matrix operations. Exporting this type allows calling routines to better manage their memory consumption and to prevent recomputing the same decomposition many times.
func NewLUFactors ¶
NewLUFactors creates an LUFactors instance of the requested dimensions.
func (*LUFactors) Determinant ¶
Determinant compute the determinant of of the matrix represented by the given LU decomposition.
func (*LUFactors) InvertAt ¶
InvertAt inverts the matrix represented by the given LU decomposition and writes the results into the specified out matrix.
func (*LUFactors) SolveMatrix ¶
SolveMatrix solves the equation m * x = b.
x and b may point to the same physical memory.
func (*LUFactors) SolveVector ¶
SolveVector solves M * xs = bs for xs.
bs and xs may poin to the same physical memory.
type LUFactors32 ¶
type LUFactors32 struct {
// contains filtered or unexported fields
}
LUFactors32 contains data fields neccessary for a number of matrix operations. Exporting this type allows calling routines to better manage their memory consumption and to prevent recomputing the same decomposition many times.
func NewLUFactors32 ¶
func NewLUFactors32(n int) *LUFactors32
NewLUFactors32 creates an LUFactors32 instance of the requested dimensions.
func (*LUFactors32) Determinant ¶
func (luf *LUFactors32) Determinant() float32
Determinant compute the determinant of of the matrix represented by the given LU decomposition.
func (*LUFactors32) InvertAt ¶
func (luf *LUFactors32) InvertAt(out *Matrix32) *Matrix32
InvertAt inverts the matrix represented by the given LU decomposition and writes the results into the specified out matrix.
func (*LUFactors32) SolveMatrix ¶
func (luf *LUFactors32) SolveMatrix(b, x *Matrix32) *Matrix32
SolveMatrix solves the equation m * x = b.
x and b may point to the same physical memory.
func (*LUFactors32) SolveVector ¶
func (luf *LUFactors32) SolveVector(bs, xs []float32) []float32
SolveVector solves M * xs = bs for xs.
bs and xs may poin to the same physical memory.
type Matrix ¶
Matrix represents a matrix of float64 values.
func (*Matrix) Determinant ¶
Determinant computes the determinant of a matrix.
func (*Matrix) LUFactorsAt ¶
LUFactorsAt stores the LU decomposition of a matrix at the specified location.
func (*Matrix) MultAt ¶
Mult multiplies to matrices together and writes the result to the specified matrix.
func (*Matrix) SolveMatrix ¶
SolveMatrix solves the equation m * x = b for x.
func (*Matrix) SolveVector ¶
SolveVector solves the equation m * xs = bs for xs.
func (*Matrix) TransposeAt ¶
type Matrix32 ¶
Matrix32 represents a matrix of float32 values.
func NewMatrix32 ¶
NewMatrix32 creates a matrix with the specified values and dimensions.
func (*Matrix32) Determinant ¶
Determinant computes the determinant of a matrix.
func (*Matrix32) LU ¶
func (m *Matrix32) LU() *LUFactors32
LU returns the LU decomposition of a matrix.
func (*Matrix32) LUFactorsAt ¶
func (m *Matrix32) LUFactorsAt(luf *LUFactors32)
LUFactorsAt stores the LU decomposition of a matrix at the specified location.
func (*Matrix32) MultAt ¶
Mult multiplies to matrices together and writes the result to the specified matrix.
func (*Matrix32) SolveMatrix ¶
SolveMatrix solves the equation m * x = b for x.
func (*Matrix32) SolveVector ¶
SolveVector solves the equation m * xs = bs for xs.