A symbolic matrix whose elements are arbitrary expressions.
This is the AST-side matrix; the fully-reduced counterpart is _MatrixValue (a dense Array[Double] in core). Elements may be numbers, variables, functions, functionals, or any other _Expression.
eval reduces every element: when all of them fold to _Number values the matrix collapses to a single _MatrixValue; otherwise it stays symbolic with each element as far reduced as it goes (the dual-evaluation contract, applied element-wise).
Marked _ElementWise: derive/simplify/expand/integrate distribute over the elements (e.g. d/dx [a_ij] = [d(a_ij)/dx]), which is valid because the matrix is a plain container with no coupling between cells.
children / rebuild expose the elements to generic traversals, so substitute and dependsOn work through matrix elements without matrix-specific cases.
Value parameters
cols
number of columns (must be positive)
elems
row-major element vector; must have exactly rows * cols entries