Skip to content
Symi Docs
Swift
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

func matrix(rows: [[UniffiExpression]]) -> UniffiMatrix

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#

Explicit context

func matrixIdentity(size: UInt64) -> UniffiMatrix

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

matrix_zero#

Explicit context

func matrixZero(rows: UInt64, columns: UInt64) -> UniffiMatrix

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

matrix_diagonal#

Explicit context

func matrixDiagonal(entries: [UniffiExpression]) -> UniffiMatrix

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

Shape and access#

rows#

UniffiMatrix method

func rows() -> UInt64

columns#

UniffiMatrix method

func columns() -> UInt64

entry#

UniffiMatrix method

func entry(row: UInt64, column: UInt64) -> UniffiExpression

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

Example#

Additional API#

diagonal_matrix#

Explicit context

func diagonalMatrix(subject: UniffiMatrix) -> UniffiAssumptionProposition

Provides the diagonal_matrix operation on this mobile object.

identity_matrix#

Explicit context

func identityMatrix(subject: UniffiMatrix) -> UniffiAssumptionProposition

Provides the identity_matrix operation on this mobile object.

zero_matrix#

Explicit context

func zeroMatrix(subject: UniffiMatrix) -> UniffiAssumptionProposition

Provides the zero_matrix operation on this mobile object.

Symi documentation · Swift