_MatrixOperation

it.grypho.scala.leonardo.matrix._MatrixOperation

Marker trait for matrix-valued AST nodes.

Evaluation is two-path: when both operands reduce to dense _MatrixValues the dense kernels in _MatrixValue are used (fast path); otherwise, matrix literals combine element-wise via the sumOf/productOf helpers, and the resulting _Matrix collapses to a dense value when every element folded, or stays symbolic otherwise.

Dimension mismatches and non-finite results are domain errors and stay symbolic, exactly like x/0 in scalar.Ratio.

Not every matrix-related node extends _MatrixOperation: Determinant and _MatrixIndex produce scalar results, so they extend _Expression directly to prevent the parser from treating 2 * det(A) as a matrix scale.

Attributes

Graph
Supertypes
trait _Expression
class Object
trait Matchable
class Any
Known subtypes
class Inverse
class MatProduct
class MatScale
class MatSum
class Transpose
class ZeroMatrix
Show all

Members list

Value members

Inherited and Abstract methods

def children: List[_Expression]

Sub-expressions subject to recursive structural traversal. Binder positions (e.g. the differentiation variable) are excluded.

Sub-expressions subject to recursive structural traversal. Binder positions (e.g. the differentiation variable) are excluded.

Attributes

Inherited from:
_Expression
def eval(env: Environment): Either[_Expression, _Value]

Reduces this expression in the given environment.

Reduces this expression in the given environment.

Value parameters

env

variable bindings and display precision

Attributes

Returns

Right(v) when all free variables resolved to concrete values; Left(e) when reduction is partial or impossible

Inherited from:
_Expression
def rebuild(newChildren: List[_Expression]): _Expression

Reconstructs the same node shape with replacement sub-expressions.

Reconstructs the same node shape with replacement sub-expressions.

Value parameters

newChildren

replacements in the same order and count as children

Attributes

Inherited from:
_Expression

Inherited fields

lazy val freeVars: Set[String]

Cached set of free variable names; O(1) after the first access.

Cached set of free variable names; O(1) after the first access.

Attributes

Inherited from:
_Expression