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>>): UniffiMatrixBuild 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): UniffiMatrixThe identity; size 0 raises.
matrix_zero#
Explicit context
fun matrixZero(rows: kotlin.ULong, columns: kotlin.ULong): UniffiMatrixThe zero matrix.
matrix_diagonal#
Explicit context
fun matrixDiagonal(entries: List<UniffiExpression>): UniffiMatrixSquare matrix with the given main diagonal and zeros elsewhere; the empty list raises.
Shape and access#
rows#
UniffiMatrix method
fun rows(): kotlin.ULongcolumns#
UniffiMatrix method
fun columns(): kotlin.ULongentry#
UniffiMatrix method
fun entry(row: kotlin.ULong, column: kotlin.ULong): UniffiExpressionElement access. Notes: Python uses indexing m[row, column] instead.
Example#
Additional API#
diagonal_matrix#
Explicit context
fun diagonalMatrix(subject: UniffiMatrix): UniffiAssumptionPropositionProvides the diagonal_matrix operation on this mobile object.
identity_matrix#
Explicit context
fun identityMatrix(subject: UniffiMatrix): UniffiAssumptionPropositionProvides the identity_matrix operation on this mobile object.
zero_matrix#
Explicit context
fun zeroMatrix(subject: UniffiMatrix): UniffiAssumptionPropositionProvides the zero_matrix operation on this mobile object.