Documentation ¶
Index ¶
- type AnyExp
- func (m1 *AnyExp) Add(m2 matrixexp.MatrixExp) matrixexp.MatrixExp
- func (m1 *AnyExp) At(r, c int) float64
- func (m1 *AnyExp) Copy() matrixexp.MatrixExp
- func (m1 *AnyExp) Dims() (r, c int)
- func (m1 *AnyExp) DivElem(m2 matrixexp.MatrixExp) matrixexp.MatrixExp
- func (m1 *AnyExp) Err() error
- func (m1 *AnyExp) Eval() matrixexp.MatrixLiteral
- func (m1 *AnyExp) Match(m2 matrixexp.MatrixExp) error
- func (m1 *AnyExp) Mul(m2 matrixexp.MatrixExp) matrixexp.MatrixExp
- func (m1 *AnyExp) MulElem(m2 matrixexp.MatrixExp) matrixexp.MatrixExp
- func (m1 *AnyExp) Scale(c float64) matrixexp.MatrixExp
- func (m1 *AnyExp) String() string
- func (m1 *AnyExp) Sub(m2 matrixexp.MatrixExp) matrixexp.MatrixExp
- func (m1 *AnyExp) T() matrixexp.MatrixExp
- type Compiler
- type ExpMismatch
- type Matcher
- type NewExpMismatch
- type Rewriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnyExp ¶
type AnyExp int
AnyExp represents any matrix expression. It is intended for use with the Template rewriter. It implements matrix algebra but if it is ever used for calculations it will cause a runtime panic. Note that this is an int so that it actually takes up memory - this is intentional. Go puts zero sized structs into the same address, which is no good if we want to compare their memory location to determine identity for wildcard matching.
func (*AnyExp) Copy ¶
Copy normally creates a (deep) copy of the Matrix Expression. However, to aid in rewriting expressions, Copy() of matrix expression wildcards is a nop.
func (*AnyExp) Err ¶
Err returns the first error encountered while constructing the matrix expression.
func (*AnyExp) Eval ¶
func (m1 *AnyExp) Eval() matrixexp.MatrixLiteral
Eval returns a matrix literal.
func (*AnyExp) Match ¶
Match determines if a matrix expression wildcard matches another matrix expression.
type Compiler ¶
type Compiler interface { // Compile transforms a matrix, or returns an error indicating a problem // with either the matrix expression or the compiler. Compile(matrixexp.MatrixExp) (matrixexp.MatrixExp, error) // MustCompile is just like Compile, except that instead of returning an error // it will panic if it encounters a problem. It is intended for use in init() MustCompile(matrixexp.MatrixExp) matrixexp.MatrixExp }
A Compiler can transform matrix expressions by applying various optimizations to it, such as converting a.T().Mul(b.T()) to an appropriate call to DGEMM, or allowing concurrent evaluation of (a.Mul(b)).Add(c.Mul(d)) via Async.
type ExpMismatch ¶
type ExpMismatch struct {
// contains filtered or unexported fields
}
ExpMismatch indicates that an expression does not match an expected pattern.
func (*ExpMismatch) Error ¶
func (e *ExpMismatch) Error() string
Error implements the error interface.
type Matcher ¶
A Matcher can determine if an expression wildcard matches another matrix expression. If the expression does not match the wildcard then it returns an error explaining why.
type NewExpMismatch ¶
type NewExpMismatch struct {
// contains filtered or unexported fields
}
NewExpMismatch indicates that a wildcard was expected to be repeated in the expression tree, but a new matrix expressio was found. For example, the expression A.Mul(A.T()) would return this when compared with B.Mul(C.T())
func (*NewExpMismatch) Error ¶
func (e *NewExpMismatch) Error() string
Error implements the error interface.