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

fun matrix(rows: List<List<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

fun matrixIdentity(size: kotlin.ULong): UniffiMatrix

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

matrix_zero#

Explicit context

fun matrixZero(rows: kotlin.ULong, columns: kotlin.ULong): UniffiMatrix

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

matrix_diagonal#

Explicit context

fun matrixDiagonal(entries: List<UniffiExpression>): UniffiMatrix

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

Shape and access#

rows#

UniffiMatrix method

fun rows(): kotlin.ULong

columns#

UniffiMatrix method

fun columns(): kotlin.ULong

entry#

UniffiMatrix method

fun entry(row: kotlin.ULong, column: kotlin.ULong): UniffiExpression

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

Example#

Additional API#

diagonal_matrix#

Explicit context

fun diagonalMatrix(subject: UniffiMatrix): UniffiAssumptionProposition

Provides the diagonal_matrix operation on this mobile object.

identity_matrix#

Explicit context

fun identityMatrix(subject: UniffiMatrix): UniffiAssumptionProposition

Provides the identity_matrix operation on this mobile object.

zero_matrix#

Explicit context

fun zeroMatrix(subject: UniffiMatrix): UniffiAssumptionProposition

Provides the zero_matrix operation on this mobile object.

Symi documentation · Kotlin