Documentation ¶
Index ¶
- func Equals(m1, m2 MatrixExp) bool
- type Add
- func (m1 *Add) Add(m2 MatrixExp) MatrixExp
- func (m1 *Add) At(r, c int) float64
- func (m1 *Add) Copy() MatrixExp
- func (m1 *Add) Dims() (r, c int)
- func (m1 *Add) DivElem(m2 MatrixExp) MatrixExp
- func (m1 *Add) Err() error
- func (m1 *Add) Eval() MatrixLiteral
- func (m1 *Add) Mul(m2 MatrixExp) MatrixExp
- func (m1 *Add) MulElem(m2 MatrixExp) MatrixExp
- func (m1 *Add) Scale(c float64) MatrixExp
- func (m1 *Add) String() string
- func (m1 *Add) Sub(m2 MatrixExp) MatrixExp
- func (m1 *Add) T() MatrixExp
- type Async
- func (m1 *Async) Add(m2 MatrixExp) MatrixExp
- func (m1 *Async) At(r, c int) float64
- func (m1 *Async) Copy() MatrixExp
- func (m1 *Async) Dims() (r, c int)
- func (m1 *Async) DivElem(m2 MatrixExp) MatrixExp
- func (m1 *Async) Err() error
- func (m1 *Async) Eval() MatrixLiteral
- func (m1 *Async) Mul(m2 MatrixExp) MatrixExp
- func (m1 *Async) MulElem(m2 MatrixExp) MatrixExp
- func (m1 *Async) Scale(c float64) MatrixExp
- func (m1 *Async) String() string
- func (m1 *Async) Sub(m2 MatrixExp) MatrixExp
- func (m1 *Async) T() MatrixExp
- type DivElem
- func (m1 *DivElem) Add(m2 MatrixExp) MatrixExp
- func (m1 *DivElem) At(r, c int) float64
- func (m1 *DivElem) Copy() MatrixExp
- func (m1 *DivElem) Dims() (r, c int)
- func (m1 *DivElem) DivElem(m2 MatrixExp) MatrixExp
- func (m1 *DivElem) Err() error
- func (m1 *DivElem) Eval() MatrixLiteral
- func (m1 *DivElem) Mul(m2 MatrixExp) MatrixExp
- func (m1 *DivElem) MulElem(m2 MatrixExp) MatrixExp
- func (m1 *DivElem) Scale(c float64) MatrixExp
- func (m1 *DivElem) String() string
- func (m1 *DivElem) Sub(m2 MatrixExp) MatrixExp
- func (m1 *DivElem) T() MatrixExp
- type ErrDimMismatch
- type ErrInnerDimMismatch
- type ErrInvalidCols
- type ErrInvalidDataLen
- type ErrInvalidRows
- type ErrInvalidStride
- type ErrStrideLessThanCols
- type Future
- func (m1 *Future) Add(m2 MatrixExp) MatrixExp
- func (m1 *Future) AsGeneral() blas64.General
- func (m1 *Future) AsVector() []float64
- func (m1 *Future) At(r, c int) float64
- func (m1 *Future) Copy() MatrixExp
- func (m1 *Future) Dims() (r, c int)
- func (m1 *Future) DivElem(m2 MatrixExp) MatrixExp
- func (m1 *Future) Err() error
- func (m1 *Future) Eval() MatrixLiteral
- func (m1 *Future) Mul(m2 MatrixExp) MatrixExp
- func (m1 *Future) MulElem(m2 MatrixExp) MatrixExp
- func (m1 *Future) Scale(c float64) MatrixExp
- func (m1 *Future) Set(r, c int, v float64)
- func (m1 *Future) String() string
- func (m1 *Future) Sub(m2 MatrixExp) MatrixExp
- func (m1 *Future) T() MatrixExp
- type General
- func (m1 *General) Add(m2 MatrixExp) MatrixExp
- func (m1 *General) AsGeneral() blas64.General
- func (m1 *General) AsVector() []float64
- func (m1 *General) At(r, c int) float64
- func (m1 *General) Copy() MatrixExp
- func (m1 *General) Dims() (r, c int)
- func (m1 *General) DivElem(m2 MatrixExp) MatrixExp
- func (m1 *General) Err() error
- func (m1 *General) Eval() MatrixLiteral
- func (m1 *General) Mul(m2 MatrixExp) MatrixExp
- func (m1 *General) MulElem(m2 MatrixExp) MatrixExp
- func (m1 *General) Scale(c float64) MatrixExp
- func (m1 *General) Set(r, c int, v float64)
- func (m1 *General) String() string
- func (m1 *General) Sub(m2 MatrixExp) MatrixExp
- func (m1 *General) T() MatrixExp
- type MatrixExp
- type MatrixLiteral
- type Mul
- func (m1 *Mul) Add(m2 MatrixExp) MatrixExp
- func (m1 *Mul) At(r, c int) float64
- func (m1 *Mul) Copy() MatrixExp
- func (m1 *Mul) Dims() (r, c int)
- func (m1 *Mul) DivElem(m2 MatrixExp) MatrixExp
- func (m1 *Mul) Err() error
- func (m1 *Mul) Eval() MatrixLiteral
- func (m1 *Mul) Mul(m2 MatrixExp) MatrixExp
- func (m1 *Mul) MulElem(m2 MatrixExp) MatrixExp
- func (m1 *Mul) Scale(c float64) MatrixExp
- func (m1 *Mul) String() string
- func (m1 *Mul) Sub(m2 MatrixExp) MatrixExp
- func (m1 *Mul) T() MatrixExp
- type MulElem
- func (m1 *MulElem) Add(m2 MatrixExp) MatrixExp
- func (m1 *MulElem) At(r, c int) float64
- func (m1 *MulElem) Copy() MatrixExp
- func (m1 *MulElem) Dims() (r, c int)
- func (m1 *MulElem) DivElem(m2 MatrixExp) MatrixExp
- func (m1 *MulElem) Err() error
- func (m1 *MulElem) Eval() MatrixLiteral
- func (m1 *MulElem) Mul(m2 MatrixExp) MatrixExp
- func (m1 *MulElem) MulElem(m2 MatrixExp) MatrixExp
- func (m1 *MulElem) Scale(c float64) MatrixExp
- func (m1 *MulElem) String() string
- func (m1 *MulElem) Sub(m2 MatrixExp) MatrixExp
- func (m1 *MulElem) T() MatrixExp
- type Scale
- func (m1 *Scale) Add(m2 MatrixExp) MatrixExp
- func (m1 *Scale) At(r, c int) float64
- func (m1 *Scale) Copy() MatrixExp
- func (m1 *Scale) Dims() (r, c int)
- func (m1 *Scale) DivElem(m2 MatrixExp) MatrixExp
- func (m1 *Scale) Err() error
- func (m1 *Scale) Eval() MatrixLiteral
- func (m1 *Scale) Mul(m2 MatrixExp) MatrixExp
- func (m1 *Scale) MulElem(m2 MatrixExp) MatrixExp
- func (m1 *Scale) Scale(c float64) MatrixExp
- func (m1 *Scale) String() string
- func (m1 *Scale) Sub(m2 MatrixExp) MatrixExp
- func (m1 *Scale) T() MatrixExp
- type Sub
- func (m1 *Sub) Add(m2 MatrixExp) MatrixExp
- func (m1 *Sub) At(r, c int) float64
- func (m1 *Sub) Copy() MatrixExp
- func (m1 *Sub) Dims() (r, c int)
- func (m1 *Sub) DivElem(m2 MatrixExp) MatrixExp
- func (m1 *Sub) Err() error
- func (m1 *Sub) Eval() MatrixLiteral
- func (m1 *Sub) Mul(m2 MatrixExp) MatrixExp
- func (m1 *Sub) MulElem(m2 MatrixExp) MatrixExp
- func (m1 *Sub) Scale(c float64) MatrixExp
- func (m1 *Sub) String() string
- func (m1 *Sub) Sub(m2 MatrixExp) MatrixExp
- func (m1 *Sub) T() MatrixExp
- type T
- func (m1 *T) Add(m2 MatrixExp) MatrixExp
- func (m1 *T) At(r, c int) float64
- func (m1 *T) Copy() MatrixExp
- func (m1 *T) Dims() (r, c int)
- func (m1 *T) DivElem(m2 MatrixExp) MatrixExp
- func (m1 *T) Err() error
- func (m1 *T) Eval() MatrixLiteral
- func (m1 *T) Mul(m2 MatrixExp) MatrixExp
- func (m1 *T) MulElem(m2 MatrixExp) MatrixExp
- func (m1 *T) Scale(c float64) MatrixExp
- func (m1 *T) String() string
- func (m1 *T) Sub(m2 MatrixExp) MatrixExp
- func (m1 *T) T() MatrixExp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Add ¶
Add represents matrix addition.
type Async ¶
type Async struct {
M MatrixExp
}
Async represents a matrix expression that evaluates into a Future.
func (*Async) Err ¶
Err returns the first error encountered while constructing the matrix expression.
type DivElem ¶
DivElem represents element-wise division.
func (*DivElem) Err ¶
Err returns the first error encountered while constructing the matrix expression.
type ErrDimMismatch ¶
ErrDimMismatch happens when two matrices cannot be operated on due to differnt sizes. For example, you can't perform element-wise multiplication between a 2x2 matrix and a 3x3 matrix.
func (ErrDimMismatch) Error ¶
func (e ErrDimMismatch) Error() string
type ErrInnerDimMismatch ¶
type ErrInnerDimMismatch struct {
C, R int
}
ErrInnerDimMismatch happens when you try to use matrix multiplication on two matrices that have different inner dimensions.
func (ErrInnerDimMismatch) Error ¶
func (e ErrInnerDimMismatch) Error() string
type ErrInvalidCols ¶
type ErrInvalidCols int
ErrInvalidCols happens when a literal has a negative number of columns.
func (ErrInvalidCols) Error ¶
func (e ErrInvalidCols) Error() string
type ErrInvalidDataLen ¶
type ErrInvalidDataLen struct {
GotLen, WantLen int
}
ErrInvalidDataLen happens when the slice of data is too small to fit all of the values that can be addressed in the matrix.
func (ErrInvalidDataLen) Error ¶
func (e ErrInvalidDataLen) Error() string
type ErrInvalidRows ¶
type ErrInvalidRows int
ErrInvalidRows happens when a literal has a negative number of rows.
func (ErrInvalidRows) Error ¶
func (e ErrInvalidRows) Error() string
type ErrInvalidStride ¶
type ErrInvalidStride int
ErrInvalidStride happens when a literal has a nonpositive stride.
func (ErrInvalidStride) Error ¶
func (e ErrInvalidStride) Error() string
type ErrStrideLessThanCols ¶
type ErrStrideLessThanCols struct {
Stride, Cols int
}
ErrStrideLessThanCols happens when a literal has stride less than columns.
func (ErrStrideLessThanCols) Error ¶
func (e ErrStrideLessThanCols) Error() string
type Future ¶
type Future struct {
// contains filtered or unexported fields
}
Future is a matrix literal that is asynchronously evaluating.
func NewFuture ¶
NewFuture constructs a Future MatrixLiteral from a Matrix Expression and then begins evaluating it.
func (*Future) AsVector ¶
AsVector returns a copy of the values in the matrix as a []float64, in row order.
func (*Future) Err ¶
Err returns the first error encountered while constructing the matrix expression.
type General ¶
General is a typical matrix literal.
func (*General) AsVector ¶
AsVector returns a copy of the values in the matrix as a []float64, in row order.
func (*General) Err ¶
Err returns the first error encountered while constructing the matrix expression.
type MatrixExp ¶
type MatrixExp interface { // Stringer interface String() string // not a part of the algebra, but very helpful Dims() (r, c int) // matrix dimensions At(r, c int) float64 // get a value from a given row, column index Eval() MatrixLiteral // Evaluates the matrix expression, producing a Matrix literal. Copy() MatrixExp // creates a (deep) copy of the matrix expression Err() error // returns the first error encountered while constructing the matrix expression. // Matrix Algebra T() MatrixExp // transpose Add(MatrixExp) MatrixExp // matrix addition Sub(MatrixExp) MatrixExp // matrix subtraction Scale(float64) MatrixExp // scalar multiplication Mul(MatrixExp) MatrixExp // matrix multiplication MulElem(MatrixExp) MatrixExp // element-wise multiplication DivElem(MatrixExp) MatrixExp // element-wise division }
MatrixExp represents any mathematical matrix expression, and defines its Algebra.
type MatrixLiteral ¶
type MatrixLiteral interface { MatrixExp AsVector() []float64 // vector returns all of the values in the matrix as a []float64, in row order AsGeneral() blas64.General // returns a Matrix as a MatrixExp.General Set(r, c int, v float64) // set a specific row, column to value }
MatrixLiteral is a literal matrix, which can be converted to a blas64.General.
type Mul ¶
Mul represents matrix multiplication.
type MulElem ¶
MulElem represents element-wise multiplication.
func (*MulElem) Err ¶
Err returns the first error encountered while constructing the matrix expression.
type Scale ¶
Scale represents scalar multiplication.
func (*Scale) Err ¶
Err returns the first error encountered while constructing the matrix expression.
type Sub ¶
Sub represents matrix subtraction.
type T ¶
type T struct {
M MatrixExp
}
T represents a transposed matrix expression.