Multik 0.3.0 Help

Linear algebra

Overview

The mk.linalg entry point provides linear algebra operations on 2D matrices and 1D vectors. Functions are defined in the LinAlg and LinAlgEx interfaces; convenience extension functions and infix operators are also available.

Most functions accept Number, Float, and Complex types through separate overloads. Numeric overloads typically return Double results; float overloads preserve Float precision.

Operations

Operation

Function

Description

Dot product

dot

Matrix-matrix, matrix-vector, or vector-vector product.

Matrix inverse

inv

Inverse of a square matrix.

Matrix power

pow

Raise a square matrix to an integer power.

QR decomposition

qr

Decompose into orthogonal Q and upper-triangular R.

PLU decomposition

plu

Decompose into permutation P, lower-triangular L, upper-triangular U.

SVD

svd

Singular value decomposition (experimental).

Eigenvalues

eig

Eigenvalues and eigenvectors.

Eigenvalues only

eigVals

Eigenvalues without eigenvectors.

Solve

solve

Solve a linear system Ax = b.

Norms

norm

Matrix or vector norm (Frobenius, 1-norm, infinity, max).

Type support

Each operation has up to three overloads:

Overload

Input type

Output type

Default

MultiArray<T: Number, D2>

Double/NDArray<Double, …>

Float (…F)

MultiArray<Float, D2>

Float/NDArray<Float, …>

Complex (…C)

MultiArray<T: Complex, D2>

NDArray<T, …>

Quick example

val a = mk.ndarray(mk[mk[1.0, 2.0], mk[3.0, 4.0]]) val b = mk.ndarray(mk[mk[5.0, 6.0], mk[7.0, 8.0]]) // Dot product val c = mk.linalg.dot(a, b) // 2×2 matrix product // Inverse val aInv = mk.linalg.inv(a) // inverse of a // Solve Ax = b val x = mk.linalg.solve(a, mk.ndarray(mk[1.0, 2.0]))
19 February 2026