Docs / nablatensor-tensor / com.nablatensor.tensor

final class

Linalg

Dense linear-algebra factorizations and solves over Tensor: cholesky, lu, qr, solve, inv, det.

These run through DenseLinalg — custom, unblocked, F32 factorizations, no BLAS/LAPACK. The tensor is brought to the host, factored, and the results uploaded back to the same device, so every backend (CPU, SIMD, CUDA, Vulkan, ROCm) gets factorizations even though none has a native kernel for them. That host round-trip is O(n²) against the O(n³) factorization, and factorizations are rarely on a hot path — but do not put these inside an inner loop over a GPU-resident tensor.

Methods

static Tensor cholesky(Tensor a)

Cholesky factor of a symmetric positive-definite A (n×n): lower-triangular L with A = L·Lᵀ.

throws
IllegalArgumentExceptionif A is not square or not SPD
static Lu lu(Tensor a)

LU factorization with partial pivoting of A (n×n): returns unit-lower L, upper U, and a length-n pivot vector where pivots[i] is the original row now at position i (so L·U equals A with its rows permuted by pivots).

static Qr qr(Tensor a)

Full Householder QR of A (m×n), m >= n: orthogonal Q (m×m) and upper R (m×n) with A = Q·R.

static Eigh eigh(Tensor a)

Eigendecomposition of a symmetric A (n×n) by cyclic Jacobi. The input is symmetrized ((A + Aᵀ)/2) first, so only the symmetric part is used. Returns eigenvalues ascending and the matching eigenvectors in the columns of vectors, with A = V·diag(values)·Vᵀ.

static Svd svd(Tensor a)

Thin SVD of A (m×n, m >= n) by one-sided Jacobi: U (m×n, orthonormal columns), s (n, descending ≥ 0), V (n×n, orthogonal), with A = U·diag(s)·Vᵀ.

static Tensor solve(Tensor a, Tensor b)

Solves A·X = B for X via LU with partial pivoting. A is (n×n); B is a length-n vector or an (n×p) matrix, and X has the same shape as B.

static Tensor inv(Tensor a)

The inverse of a square A, i.e. solve(A, I).

static double det(Tensor a)

The determinant of a square A, computed from its LU factorization (in double).