NDWasmDecomp

Namespace

NDWasmDecomp

Description:
  • NDWasmDecomp: Decompositions & Solvers Handles O(n^3) matrix factorizations and linear system solutions.

Source:

Methods

(static) cholesky(a) → {NDArray}

Description:
  • Computes the Cholesky decomposition of a symmetric, positive-definite matrix: A = L * L^T. Complexity: O(n^3)

Source:
Parameters:
Name Type Description
a NDArray

Symmetric positive-definite matrix of shape [n, n].

Returns:

Lower triangular matrix L of shape [n, n].

Type
NDArray

(static) det(a) → {number}

Description:
  • Computes the determinant of a square matrix. Complexity: O(n^3)

Source:
Parameters:
Name Type Description
a NDArray

Square matrix of shape [n, n].

Returns:

The determinant.

Type
number

(static) eigen(a) → {Object}

Description:
  • Computes the eigenvalues and eigenvectors of a general square matrix. Eigenvalues and eigenvectors can be complex numbers. The results are returned in an interleaved format where each complex number (a + bi) is represented by two consecutive float64 values (a, b).

Source:
Parameters:
Name Type Description
a NDArray

Input square matrix of shape [n, n]. Must be float64.

Throws:

If WASM runtime is not loaded, input is not a square matrix, or input dtype is not float64.

Type
Error
Returns:

An object containing:

  • values: Complex eigenvalues as an NDArray of shape [n, 2], where [i, 0] is real and [i, 1] is imaginary.
  • vectors: Complex right eigenvectors as an NDArray of shape [n, n, 2], where [i, j, 0] is real and [i, j, 1] is imaginary. (Note: these are column vectors, such that A * v = lambda * v).
Type
Object

(static) inv(a) → {NDArray}

Description:
  • Computes the multiplicative inverse of a square matrix. Complexity: O(n^3)

Source:
Parameters:
Name Type Description
a NDArray

Square matrix to invert of shape [n, n].

Returns:

The inverted matrix of shape [n, n].

Type
NDArray

(static) logDet(a) → {Object}

Description:
  • Computes the log-determinant for improved numerical stability. Complexity: O(n^3)

Source:
Parameters:
Name Type Description
a NDArray

Square matrix of shape [n, n].

Returns:
Type
Object

(static) lu(a) → {NDArray}

Description:
  • Computes the LU decomposition of a matrix: A = P * L * U. The result is stored in-place in the output matrix.

Source:
Parameters:
Name Type Description
a NDArray

Input matrix of shape [m, n].

Returns:

LU matrix of shape [m, n].

Type
NDArray

(static) pinv(a) → {NDArray}

Description:
  • Computes the Moore-Penrose pseudo-inverse of a matrix using SVD. Complexity: O(n^3)

Source:
Parameters:
Name Type Description
a NDArray

Input matrix of shape [m, n].

Returns:

Pseudo-inverted matrix of shape [n, m].

Type
NDArray

(static) qr(a) → {Object}

Description:
  • Computes the QR decomposition: A = Q * R. Complexity: O(n^3)

Source:
Parameters:
Name Type Description
a NDArray

Input matrix of shape [m, n].

Returns:
Type
Object

(static) solve(a, b) → {NDArray}

Description:
  • Solves a system of linear equations: Ax = B for x. Complexity: O(n^3)

Source:
Parameters:
Name Type Description
a NDArray

Square coefficient matrix of shape [n, n].

b NDArray

Right-hand side matrix or vector of shape [n, k].

Returns:

Solution matrix x of shape [n, k].

Type
NDArray

(static) svd(a) → {Object}

Description:
  • Computes the Singular Value Decomposition (SVD): A = U * S * V^T. Complexity: O(m * n * min(m, n))

Source:
Parameters:
Name Type Description
a NDArray

Input matrix of shape [m, n].

Returns:
Type
Object