Skip to content

This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.

MatrixData

Defined in: packages/engine/src/vm/Value.ts:30

A general rows×cols matrix, a vector is just a 1×N (row) or N×1 (column) matrix. data is COLUMN-MAJOR (data[row + col*rows]), matching the spec’s own a[index] column-major indexing semantics directly (no translation needed for single-index reads). hasSymbolic lets every numeric matrix op fast-path the all-numeric case with one boolean check, mirroring binaryOp()’s existing Number+Number fast path, computed by matrixValue() itself (true the moment any cell is a SymbolicNode object rather than a plain number/boolean), not something callers set by hand.

readonly cols: number;

Defined in: packages/engine/src/vm/Value.ts:32


readonly data: readonly MatrixEntry[];

Defined in: packages/engine/src/vm/Value.ts:33


readonly hasSymbolic: boolean;

Defined in: packages/engine/src/vm/Value.ts:34


readonly optional places?: readonly (number | undefined)[];

Defined in: packages/engine/src/vm/Value.ts:50

The decimal places each cell is shown to, in the order of data, when the list was rounded ([0.001, 0.006] to 4 dp, round(v, 2), to 3 sf): the list’s own form of a number’s decimalPlaces. A cell with no entry (undefined) is shown the ordinary way. A display sidecar like that one, so arithmetic on the list builds a new matrix without it and re-decides the precision.


readonly rows: number;

Defined in: packages/engine/src/vm/Value.ts:31


readonly optional unit?: string;

Defined in: packages/engine/src/vm/Value.ts:41

The one unit every numeric cell is read in (km for [1 km, 500 m], whose cells are then 1 and 0.5), or undefined for a list of plain numbers (issue #745). A list carries one unit, taken from its first quantity cell, as the comma aggregates take theirs.