Skip to content
Symi Docs
WASM / JavaScript

Signatures in the WASM / JavaScript view are TypeScript. Where the JavaScript facade wraps an operation its form is listed first; the other calling forms are the raw wasm-bindgen exports.

On this page

Matrix construction and access

Construct matrices from ordered rows or from identity, zero, and diagonal families. Shape and entry access preserve row-major ordering.

Constructors#

matrix#

Explicit context

matrix(rows: Iterable<Iterable<ExpressionLike>>): Matrix
Calling forms

Raw WebAssembly: Explicit context: Context.matrix

matrix(rows: number, columns: number, entries: Expression[]): Matrix

SymiFacade method: SymiFacade.matrix

matrix(rows: Iterable<Iterable<ExpressionLike>>): Matrix

Build a matrix from ordered rows. Direct Python construction and the facade module function use the shared default context. The raw wasm-bindgen compatibility layer retains (rows, columns, flat_entries); new JavaScript code should use the nested facade form.

matrix_identity#

Not exposed by the WASM / JavaScript bindings. Available as Context.matrix_identity in Python, UniffiSession.matrixIdentity in Kotlin, UniffiSession.matrixIdentity in Swift, api::Session::matrix_identity in Rust.

The size×size\mathit{size}\times\mathit{size} identity; size 0 raises.

matrix_zero#

Not exposed by the WASM / JavaScript bindings. Available as Context.matrix_zero in Python, UniffiSession.matrixZero in Kotlin, UniffiSession.matrixZero in Swift, api::Session::matrix_zero in Rust.

The rows×columns\mathit{rows}\times\mathit{columns} zero matrix.

matrix_diagonal#

Not exposed by the WASM / JavaScript bindings. Available as Context.matrix_diagonal in Python, UniffiSession.matrixDiagonal in Kotlin, UniffiSession.matrixDiagonal in Swift, api::Session::matrix_diagonal in Rust.

Square matrix with the given main diagonal and zeros elsewhere; the empty list raises.

Shape and access#

rows#

Matrix property

readonly rows: number
Calling forms

Raw WebAssembly: Matrix property: Matrix.rows

readonly rows: number

columns#

Matrix property

readonly columns: number
Calling forms

Raw WebAssembly: Matrix property: Matrix.columns

readonly columns: number

entry#

Matrix method

entry(row: number, column: number): Expression
Calling forms

Raw WebAssembly: Matrix method: Matrix.entry

entry(row: number, column: number): Expression

Element access. Notes: Python uses indexing m[row, column] instead.

Example#

Build matrices from rows or from a structured constructor.

JavaScript
const x = symi.symbol("x");
const matrix = symi.matrix([[1, x], [x, 1]]);

console.log(matrix.rows(), matrix.columns());
console.log(matrix.entry(0, 1).toString());

Additional API#

diagonalMatrix#

Raw WebAssembly: Default context

diagonalMatrix(subject: Matrix): AssumptionProposition

Build a diagonal-matrix proposition in the default context.

Calling forms

Explicit context: Context.diagonalMatrix

diagonalMatrix(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.diagonalMatrix

diagonalMatrix(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.diagonalMatrix

diagonalMatrix(value: Matrix): AssumptionProposition

identityMatrix#

Raw WebAssembly: Default context

identityMatrix(subject: Matrix): AssumptionProposition

Build an identity-matrix proposition in the default context.

Calling forms

Explicit context: Context.identityMatrix

identityMatrix(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.identityMatrix

identityMatrix(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.identityMatrix

identityMatrix(value: Matrix): AssumptionProposition

matrixDiagonal#

Raw WebAssembly: Default context

matrixDiagonal(entries: Expression[]): Matrix

Square matrix with the given main diagonal and zeros elsewhere; the empty list raises.

Calling forms

Raw WebAssembly: Explicit context: Context.matrixDiagonal

matrixDiagonal(entries: Expression[]): Matrix

matrixIdentity#

Raw WebAssembly: Default context

matrixIdentity(size: number): Matrix

The size×size\mathit{size}\times\mathit{size} identity; size 0 raises.

Calling forms

Raw WebAssembly: Explicit context: Context.matrixIdentity

matrixIdentity(size: number): Matrix

matrixZero#

Raw WebAssembly: Default context

matrixZero(rows: number, columns: number): Matrix

The rows×columns\mathit{rows}\times\mathit{columns} zero matrix.

Calling forms

Raw WebAssembly: Explicit context: Context.matrixZero

matrixZero(rows: number, columns: number): Matrix

zeroMatrix#

Raw WebAssembly: Default context

zeroMatrix(subject: Matrix): AssumptionProposition

Build a zero-matrix proposition in the default context.

Calling forms

Explicit context: Context.zeroMatrix

zeroMatrix(value: Matrix): AssumptionProposition

Raw WebAssembly: Explicit context: Context.zeroMatrix

zeroMatrix(subject: Matrix): AssumptionProposition

SymiFacade method: SymiFacade.zeroMatrix

zeroMatrix(value: Matrix): AssumptionProposition

Symi documentation · WASM / JavaScript