Class Linalg
java.lang.Object
ai.beestream.jitnn.Linalg
Linear algebra on matrices and batches of matrices [..., rows, cols], after torch.linalg: LU,
triangular and general solves, inverse, determinants, Cholesky, QR, symmetric eigendecomposition
and SVD. Every function is differentiable with PyTorch's formulas.
The decompositions run one work-group per matrix (see
LinalgKernels), so they serve batches of small and medium
matrices (up to a few hundred rows), the sizes found inside models. Eigenvectors and singular
vectors are only defined up to sign; jitNN makes the largest-magnitude component of each
eigenvector, and of each left singular vector, positive. General (non-symmetric)
eigendecomposition is not provided: it needs complex numbers.
-
Method Summary
Modifier and TypeMethodDescriptionstatic TensorLower Cholesky factor L, A = L L^T, of symmetric positive-definite matrices (only the lower triangle is read).static TensorDeterminants [...] of square matrices.static Tensor[]Eigenvalues (ascending) [..., n] and eigenvectors (columns) [..., n, n] of symmetric matrices, torch.linalg.eigh.static TensorEigenvalues (ascending) of symmetric matrices, torch.linalg.eigvalsh.static TensorInverse of square matrices.static Tensor[]P, L, U with A = P L U, torch.linalg.lu for square matrices.static Tensor[]LU factorisation with partial pivoting, torch.linalg.lu_factor: the packed factors (L unit lower below the diagonal, U on and above) and INT32 row indices perm, with row i of P^T A being row perm[i] of A (0-based, unlike LAPACK's swap list).static Tensor[]Reduced QR, torch.linalg.qr: Q [..., m, k] and R [..., k, n], k = min(m, n).static Tensor[]torch.linalg.slogdet: [sign, log |det|], each [...]; only the logarithm carries a gradient.static TensorSolves A X = B for square A [..., n, n] and B [..., n, k] through LU with partial pivoting.static TensorsolveTriangular(Tensor t, Tensor b, boolean upper, boolean unitDiagonal) Solves T X = B for triangular T, torch.linalg.solve_triangular (left side): only T'supperor lower triangle is read, and withunitDiagonalnot its diagonal either.static Tensor[]Reduced SVD, torch.linalg.svd(full_matrices=False): U [..., m, k], S [..., k] descending and V [..., n, k] (V, not V^T), k = min(m, n).static TensorSingular values (descending), torch.linalg.svdvals.
-
Method Details
-
luFactor
-
lu
-
solveTriangular
-
solve
-
inv
-
det
-
slogdet
-
cholesky
-
qr
-
eigh
-
eigvalsh
-
svd
-
svdvals
-