Linear algebra: API index¶
Find an operation by its purpose. Entries link to the complete signature and contract.
HMath.Backend¶
| API | Purpose |
|---|---|
| Provider | Pure reference, OpenBLAS, BLIS, Intel oneMKL SDL, or Apple's system framework. |
| Pure | Declaration and type contract below. |
| OpenBLAS | Declaration and type contract below. |
| BLIS | Declaration and type contract below. |
| OneMKL | Declaration and type contract below. |
| Accelerate | Declaration and type contract below. |
| IntegerABI | BLAS/LAPACK integer width; Haskell dimensions must additionally fit Int. |
| LP64 | Declaration and type contract below. |
| ILP64 | Declaration and type contract below. |
| BackendRequest | Optional path overrides the provider default; Accelerate only accepts its system framework. |
| AutoBackend | Declaration and type contract below. |
| RequireBackend | Declaration and type contract below. |
| Backend | Opaque selected reference/native backend owner. |
| BackendInfo | Actual selected BLAS provider and integer-width ABI, available through backendInfo. |
| BackendInfo | Declaration and type contract below. |
| selectedProvider | Provider actually selected, including Pure when reference fallback is used. |
| selectedIntegerABI | Selected BLAS integer width: LP64 uses 32-bit indices and ILP64 uses 64-bit indices. |
| selectBackend | Given AutoBackend or explicit providerinteger-ABIlibrary request, select a reference or native BLAS backend in IO. |
| backendInfo | Provider identity is immutable for the lifetime of a handle. |
| pureBackend | Construct the deterministic reference backend without dynamically loading BLAS. |
| setBackendThreads | Positive thread count; Pure supports one thread. |
| lapackAvailable | Availability of the once-initialized independent LAPACKE loader. |
| BackendLayout | Physical matrix storage order: RowMajor or ColumnMajor, independent of mathematical transpose. |
| RowMajor | Declaration and type contract below. |
| ColumnMajor | Declaration and type contract below. |
| Transpose | BLAS operand transformation: unchanged,transposed,or conjugate-transposed. |
| NoTranspose | Declaration and type contract below. |
| Transpose | Declaration and type contract below. |
| ConjugateTranspose | Declaration and type contract below. |
| matrixFromLayout | Layout conversion is a checked, explicit copy; zero shapes retain rank. |
| matrixToLayout | Given RowMajor/ColumnMajor layout then Matrix, return values in that physical order without changing the logical matrix. |
| axpy | Given backend,alpha,x,y, return alpha*x+y as a new Double list. |
| dot | Real inner product. |
| nrm2 | Given backend then finite Double vector, return Euclidean norm through the selected provider or reference path. |
| gemv | y := alpha op(A) x + beta y. |
| gemm | C := alpha op(A) op(B) + beta C. |
| complexAxpy | Given backend,complex alpha,x,y, compute alpha*x+y, requiring equal lengths and finite realimaginary components. |
| complexDot | Set the Boolean to True for the Hermitian dot product (conjugate x). |
| complexNrm2 | Given backend then complex vector, return real Euclidean norm of all real/imaginary components. |
| complexGemv | Given backend,transpose selector,alpha,A,x,beta,y, return alphaop(A)x+beta*y as a new complex list. |
| complexGemm | Given backend,transpose A,transpose B,alpha,A,B,beta,C, return alphaop(A)op(B)+beta*C as a new complex matrix. |
| batchedGemm | Uniform scalar/transpose options, independently checked matrix triples. |
| stridedBatchedGemm | Row-major batches of A(m,k) and B(k,n). |
| backendLU | Given backend then real matrix, compute checked column-independent LU using the reference pivoted LU implementation. |
| backendQR | Given backend then real matrix, compute reference column-pivoted Householder QR; selection does not change this routine's provider. |
| backendSolve | Given backend,square real matrix,then RHS list, solve via reference LU for Pure or the independent LAPACKE solve bridge for a native backend. |
| backendCholesky | Given backend then finite symmetric positive-definite matrix, return reference lower Cholesky factor. |
| backendLeastSquares | Given backend,design matrix,then RHS list, solve using reference pivoted QR. |
| backendSVD | Given backend then finite real matrix, use bounded pure reference SVD for Pure or LAPACK thin SVD for native selection. |
| backendSymmetricEigen | Given backend then finite symmetric square matrix, use bounded cyclic-Jacobi reference solver for Pure or LAPACK otherwise. |
| pureSVD | Thin real SVD by one-sided Jacobi orthogonalization, at most 100 sweeps, dimensions <=128. |
| pureSymmetricEigen | Cyclic Jacobi symmetric eigensolver, at most 100 sweeps, ascending eigenvalues. |
| lapackStatus | Convert the LAPACK convention without losing the distinction between an invalid argument and failed numerical convergence. |
HMath.Linear¶
| API | Purpose |
|---|---|
| dot | Inner product. |
| dotChecked | Inner product, or VectorLengthMismatch with the left and right lengths. |
| magnitude | Euclidean magnitude. |
| normalize | Normalize by Euclidean magnitude. |
| add | Elementwise addition. |
| addChecked | Elementwise addition, requiring equal lengths. |
| subtractChecked | Elementwise left-minus-right subtraction, requiring equal lengths. |
| scale | Multiply every component by a scalar, preserving length. |
HMath.Matrix¶
| API | Purpose |
|---|---|
| Matrix | An abstract dense matrix with explicit dimensions and flat row-major storage. |
| fromList | Construct a matrix from a finite list in row-major order. |
| fromListChecked | Checked fromList. |
| toList | Return all elements in row-major order. |
| shape | Return (rows, columns), including either dimension of an empty matrix. |
| zeroMatrix | Construct a matrix filled with zeros, subject to the same shape checks as fromList. |
| zeroMatrixChecked | Checked zeroMatrix. |
| diagonal | Construct a square matrix with the finite input list on its diagonal and zeros elsewhere. |
| diagonalChecked | Checked diagonal. |
| at | Look up an element using zero-based row and column indices. |
| atChecked | Checked at. |
| sliceMatrix | Extract a slice given its (startRow, startColumn) and (rowCount, columnCount). |
| sliceMatrixChecked | Checked sliceMatrix. |
| reshape | Change the shape while preserving row-major element order. |
| reshapeChecked | Checked reshape. |
| addMatrix | Add matrices with equal shapes. |
| addMatrixChecked | Checked addMatrix. |
| subtractMatrix | Subtract matrices with equal shapes. |
| subtractMatrixChecked | Checked subtractMatrix. |
| hadamard | Multiply corresponding elements of matrices with equal shapes. |
| hadamardChecked | Checked hadamard. |
| scaleMatrix | Multiply every element by the scalar, preserving the shape. |
| multiply | Matrix product when the left column count equals the right row count and the output element count fits in Int. |
| multiplyChecked | Checked multiply. |
| transposeMatrix | Swap rows and columns. |
| identity | Construct a square identity matrix of nonnegative order. |
| identityChecked | Checked identity. |
HMath.Matrix.Advanced¶
| API | Purpose |
|---|---|
| generateMatrix | Given row count, column count, then zero-based (row,column) generator, construct a row-major matrix. |
| triangularMatrix | Given lower flag then matrix, preserve entries onbelow the diagonal if True, onabove if False, and zero the rest. |
| symmetricMatrix | Return (A+transpose(A))/2 for a square matrix. |
| hermitianMatrix | Return (A+conjugateTranspose(A))/2 for a square complex matrix. |
| permutationMatrix | Given a permutation p of [0..n-1], construct n-by-n P with P[i,p[i]]=1. |
| blockMatrix | Assemble a rectangular grid of matrix blocks. |
| bandedMatrix | Given rows, columns, then (diagonal offset,values) pairs, construct a matrix with zeros elsewhere. |
| conjugateTranspose | Transpose a complex matrix and conjugate every entry, exchanging its row/column dimensions. |
| zipMatrixWith | Given elementwise function and two identically shaped matrices, apply it to corresponding entries and return a new matrix. |
| batchedMultiply | Multiply pairs of matrices from equally long lists, preserving batch order. |
| kronecker | Return the block Kronecker product of matrices A and B, of shape (ArowsBrows,AcolsBcols). |
| khatriRao | Return columnwise Kronecker product, requiring equal column counts. |
| matrixPower | Given Integer exponent then square real matrix, compute power by squaring. |
| trace | Return sum of main diagonal of a square matrix; non-square input returns NonSquareMatrix. |
| matrixNorm1 | Return maximum absolute column sum (induced one norm). |
| matrixNormInfinity | Return maximum absolute row sum (induced infinity norm). |
| frobeniusNorm | Return scaled Euclidean norm of all entries, reducing intermediate overflow; empty matrix norm is zero. |
| spectralNorm | Return largest singular value via SVD, or zero for an empty singular spectrum. |
| pseudoinverse | Given relative singular-value tolerance then m-by-n matrix, return n-by-m Moore-Penrose pseudoinverse via thresholded SVD. |
| complexPseudoinverse | Complex128 Moore-Penrose pseudoinverse, thresholded relative to the largest singular value. |
| matrixRank | Given finite nonnegative relative tolerance then matrix, count positive singular values whose ratio to the largest exceeds tolerance. |
| conditionNumber | Return largest/smallest singular-value ratio; singular matrices yield positive infinity, empty spectrum yields 1. |
| nullSpace | Given relative singular-value tolerance then m-by-n matrix, return an n-by-(n-rank) basis for its numerical right null space using full SVD. |
| columnSpace | Given relative SVD rank tolerance then matrix, return columns of left singular vectors spanning its numerical column space. |
| rowSpace | Given relative rank tolerance then matrix, return a column basis for its row space by applying columnSpace to its transpose. |
| changeCoordinates | Given source basis matrix, target square basis matrix, then source coordinate list, map to physical coordinates and solve in target basis. |
| matrixExp | Given positive finite tolerance, positive iteration budget, then square finite matrix, approximate exp(A) by scaling, Taylor series and squaring. |
| matrixLog | Compute principal real matrix logarithm of a symmetric positive-definite Double matrix using symmetric eigendecomposition. |
| matrixSqrt | Compute symmetric positive-semidefinite matrix square root by spectral decomposition; tolerate eigenvalues down to -1e-12 and clamp them to zero. |
| matrixLogGeneral | Real principal matrix logarithm on the same spectral domain as matrixSqrtGeneral. |
| matrixSqrtGeneral | Principal square root for invertible real matrices whose spectra avoid the nonpositive real axis. |
| polar | Return (U,P) from SVD so A=U*P, with P positive semidefinite; rectangular input uses the thin polar factors. |
HMath.Matrix.Decomposition¶
| API | Purpose |
|---|---|
| gaussianElimination | Given finite nonnegative relative tolerance then finite matrix, return normalized row-echelon form and zero-based pivot columns. |
| gaussJordan | Given relative tolerance then finite matrix, return reduced row-echelon form and zero-based pivot columns using row pivoting. |
| cholesky | Factor a finite symmetric positive-definite matrix as L*transpose(L), returning lower-triangular L. |
| ldlt | Factor a finite symmetric matrix as Ldiag(d)transpose(L), returning unit lower L and diagonal list d. |
| givensQR | Factor finite m-by-n matrix as Q*R using Givens rotations, returning square m-by-m Q and m-by-n R without column pivoting. |
| Bidiagonal | Orthogonal factors A=UBtranspose(V), retaining a rectangular bidiagonal B. |
| Bidiagonal | Declaration and type contract below. |
| bidiagonalU | Left orthogonal factor in A=UBtranspose(V). |
| bidiagonalB | Bidiagonal matrix in the factorization, retaining input shape. |
| bidiagonalV | Right orthogonal factor in A=UBtranspose(V). |
| bidiagonalize | Reduce a finite rectangular matrix to bidiagonal form with orthogonal factors, returning Bidiagonal fields. |
| tridiagonalize | Reduce a symmetric finite square matrix to (Q,T), satisfying A = Q * T * transpose Q with tridiagonal T. |
| Iteration | Accepted eigenpair estimate with residual and iteration count. |
| Iteration | Declaration and type contract below. |
| iterationValue | Returned real eigenvalue estimate. |
| iterationVector | Returned normalized eigenvector estimate. |
| iterationResidual | Eigenpair residual norm used to assess convergence. |
| iterationCount | Number of eigen-iteration updates performed. |
| powerIteration | Given positive finite tolerance,positive budget,square finite matrix,then nonzero starting vector, estimate a dominant eigenpair. |
| inverseIteration | Given tolerance,budget,shift,square matrix,then starting vector, estimate an eigenpair near shift by repeated shifted solves. |
| rayleighIteration | Given tolerance,budget,square matrix,then nonzero initial vector, refine an eigenpair with Rayleigh-quotient shifts. |
| Arnoldi | Krylov basis columns and upper-Hessenberg projection returned by arnoldi; exact breakdown may shorten the basis. |
| Arnoldi | Declaration and type contract below. |
| arnoldiBasis | Orthonormal Krylov basis vectors as matrix columns. |
| arnoldiHessenberg | Hessenberg projection relating the matrix action to the Arnoldi basis. |
| arnoldi | Given positive finite tolerance,requested basis size,square matrix,then nonzero initial vector, build Arnoldi basis/projection. |
| lanczos | Symmetric Lanczos with the three-term recurrence and two full reorthogonalization passes. |
| qrIteration | Given positive finite tolerance,positive budget,then finite square matrix, iterate QR to return (Q,T): accumulated orthogonal vectors and the resulting iterate. |
| jordanChains | Verify supplied Jordan chains against A and lambda and construct J and P. |
| jordanForm | Exact Jordan construction over Rational with a caller-provided complete set of distinct rational eigenvalues (multiplicities are inferred). |
HMath.Matrix.Iterative¶
| API | Purpose |
|---|---|
| IterativeOptions | Absolute and relative residual tolerances and maximum iterations. |
| IterativeOptions | Declaration and type contract below. |
| absoluteTolerance | Finite nonnegative absolute residual tolerance. |
| relativeTolerance | Finite nonnegative relative residual tolerance. |
| maximumIterations | Nonnegative maximum iteration count. |
| defaultIterativeOptions | 1000 iterations, zero absolute tolerance and relative tolerance 1e-10. |
| IterativeResult | Converged state with norms evaluated from the original matrix and rhs. |
| IterativeResult | Declaration and type contract below. |
| iterativeSolution | Solution in original variable order. |
| iterativeIterations | Number of completed updates. |
| iterativeResidualNorm | Euclidean norm of b-Ax. |
| iterativeNormalResidualNorm | Euclidean norm of A^T(b-Ax), useful for inconsistent least squares. |
| Preconditioner | A checked inverse action M^-1; constructors retain their input dimension. |
| applyPreconditioner | Apply an inverse action; wrong vector lengths and nonfinite values fail. |
| identityPreconditioner | Identity inverse action in a nonnegative dimension. |
| jacobiPreconditioner | Inverse diagonal preconditioner. |
| blockJacobiPreconditioner | Block Jacobi from contiguous positive block sizes summing to the dimension. |
| ilu0Preconditioner | Incomplete LU with zero fill and no pivoting. |
| ic0Preconditioner | Incomplete Cholesky with zero fill for a symmetric positive-definite input. |
| conjugateGradient | Conjugate gradient for symmetric positive-definite matrices. |
| preconditionedCG | Preconditioned conjugate gradient. |
| gmres | Restarted GMRES with modified Gram--Schmidt Arnoldi and a second orthogonalization pass. |
| minres | Minimum residual on the symmetric Lanczos Krylov space, including indefinite systems. |
| bicg | Bi-conjugate gradient for nonsymmetric square matrices; the initial shadow residual equals the initial residual. |
| bicgstab | Stabilized BiCG with a fixed initial shadow residual and a minimal-residual omega step. |
| lsqr | LSQR by Golub--Kahan bidiagonalization and plane-rotation recurrences. |
| lsmr | LSMR's minimum-normal-residual Krylov objective using explicit Golub--Kahan bases and QR on the projected tridiagonal normal operator. |
| jacobiSolve | Simultaneous Jacobi stationary iteration. |
| gaussSeidelSolve | Forward Gauss--Seidel stationary iteration. |
| sorSolve | Successive over-relaxation, requiring a finite relaxation 0<omega<2. |
| iterativeRefinement | Residual-correction refinement using a reusable partial-pivoted LU. |
HMath.Matrix.LAPACK¶
| API | Purpose |
|---|---|
| SVD | Real singular-value decomposition with U,descending nonnegative singular values,and VT. |
| SVD | Declaration and type contract below. |
| svdU | Left singular vectors as columns of the real thin/full SVD factor. |
| singularValues | Nonnegative real singular values in descending order. |
| svdVT | Transposed right singular-vector factor in A=Udiag(s)VT. |
| svd | Compute thin real SVD A=Udiag(s)VT via LAPACK, with descending nonnegative singular values and k=min(m,n). |
| fullSVD | Full square U and V^T, including null-space completion. |
| truncatedSVD | Given retained rank k then real matrix, compute thin SVD and retain its first k components. |
| randomizedSVD | Randomized range finder with an explicit seed, oversampling, and power iterations, followed by a small deterministic SVD. |
| Eigen | Complex eigenvalues with corresponding right eigenvector columns, including conjugate pairs from real input. |
| Eigen | Declaration and type contract below. |
| eigenvalues | Complex eigenvalues matching eigenvector column order. |
| eigenvectors | Right eigenvectors as complex matrix columns. |
| eigen | Compute complex eigenvalues and right eigenvectors of a finite real square matrix via LAPACK. |
| symmetricEigen | Real symmetric eigensolver with orthonormal columns, sorted ascending. |
| GeneralizedEigen | Projective eigenvalues alpha/beta preserve infinite eigenvalues and indeterminate singular pencils without dividing by a zero beta. |
| GeneralizedEigen | Declaration and type contract below. |
| eigenAlpha | Generalized-eigenvalue numerators alpha; retain with beta to represent infinite eigenvalues. |
| eigenBeta | Generalized-eigenvalue denominators beta; zero beta can represent an infinite eigenvalue. |
| generalizedEigenvectors | Right eigenvector columns satisfying betaAv=alphaBv. |
| generalizedEigen | Given equally sized square matrices A,B, compute generalized alpha/beta eigenvalue representation and right eigenvectors. |
| Schur | Real Schur factors A=QTtranspose(Q), with quasi-triangular T and complex eigenvalues. |
| Schur | Declaration and type contract below. |
| schurQ | Orthogonal basis in A=QTtranspose(Q). |
| schurT | Real quasi-upper-triangular Schur form, including 2-by-2 blocks for conjugate pairs. |
| schurEigenvalues | Complex eigenvalues decoded from the real Schur form. |
| schur | Compute real Schur form A=QTtranspose(Q), returning orthogonal Q, quasi-upper-triangular T and complex eigenvalues. |
| QZ | Generalized real Schur factors for a matrix pair, retaining alpha/beta eigenvalue representation to allow infinite eigenvalues. |
| QZ | Declaration and type contract below. |
| qzQ | Left orthogonal QZ transform, with A=QStranspose(Z). |
| qzZ | Right orthogonal QZ transform for both matrix factors. |
| qzS | First generalized real Schur factor S. |
| qzT | Second generalized real Schur factor T. |
| qzAlpha | Generalized Schur eigenvalue numerators alpha. |
| qzBeta | Generalized Schur eigenvalue denominators beta; do not divide blindly when zero. |
| qz | Compute generalized real Schur factors for a finite square matrix pair A,B, retaining Q,Z,S,T and alphabeta eigenvalues. |
| Hessenberg | Orthogonal reduction A=QHtranspose(Q), with H upper Hessenberg. |
| Hessenberg | Declaration and type contract below. |
| hessenbergQ | Orthogonal transform in A=QHtranspose(Q). |
| hessenbergH | Upper Hessenberg form with zeros below the first subdiagonal. |
| hessenberg | Reduce finite real square A to upper Hessenberg H with orthogonal Q, satisfying A=QHtranspose(Q). |
| Balance | D^-1 A D = balancedMatrix. |
| Balance | Declaration and type contract below. |
| balancedMatrix | Matrix after LAPACK diagonal balancing. |
| balanceScales | Diagonal basis scaling factors used by the balancing transformation. |
| balance | Balance a real square matrix by diagonal scaling, returning the balanced matrix and scales needed to interpret its basis. |
| ComplexSVD | Complex128 thin SVD: A = U diag(s) V, where complexVT already stores V. |
| ComplexSVD | Declaration and type contract below. |
| complexU | Complex left singular vectors as columns. |
| complexSingularValues | Descending nonnegative real singular values of the complex matrix. |
| complexVT | Conjugate-transposed right singular vectors in complex SVD. |
| complexSVD | Compute thin complex SVD with conjugate-transposed right factor VT and real nonnegative singular values. |
| complexEigen | Compute complex eigenvalues and right eigenvectors of a finite complex square matrix via LAPACK. |
HMath.Matrix.LU¶
| API | Purpose |
|---|---|
| LU | An immutable, reusable factorization. |
| luDecompose | Factor a square matrix using the default relative pivot tolerance. |
| luDecomposeWithTolerance | Factor with a finite, nonnegative relative tolerance. |
| luLower | Unit lower-triangular factor. |
| luUpper | Upper-triangular factor. |
| luPermutation | Final zero-based row order: row i of P A is row luPermutation factors !! i of A. |
| solveLU | Solve A x = b using an existing factorization. |
| solveMatrixLU | Solve A X = B for any number of right-hand-side columns. |
| solve | Factor A with the default tolerance and solve A x = b. |
| solveMatrix | Factor A with the default tolerance and solve A X = B. |
| determinantLU | Determinant from the permutation sign and diagonal of U. |
| determinant | Determinant using the default factorization policy. |
| inverse | Invert a nonsingular square matrix by solving against the identity. |
HMath.Matrix.QR¶
| API | Purpose |
|---|---|
| QR | Opaque column-pivoted Householder factors satisfying A[:,p]=Q*R, with numerical-rank estimate. |
| qrDecompose | Column-pivoted Householder QR of a finite m-by-n matrix using relative rank tolerance max(m,n)*machine epsilon. |
| qrDecomposeWithTolerance | Given finite nonnegative relative rank tolerance then finite matrix, compute column-pivoted Householder QR. |
| qrQ | Extract the square m-by-m orthogonal Q factor from a QR decomposition. |
| qrR | Extract the m-by-n upper trapezoidal R factor. |
| qrPermutation | Return zero-based original column indices in pivoted order, satisfying A[:,p]=Q*R. |
| qrRank | Return estimated numerical rank selected by the factorization's relative diagonal-pivot tolerance. |
| applyQ | Given QR factorization then a matrix with m rows, return Q times that matrix. |
| applyQT | Given QR factorization then a matrix with m rows, return transpose(Q) times it. |
| leastSquares | Given finite m-by-n design matrix then m-element RHS, factor with pivoted QR and return least-squares coefficients. |
| leastSquaresMatrix | Given finite m-by-n design and m-by-k RHS matrices, return n-by-k least-squares solution via QR. |
| solveQR | Given full-column-rank QR factors of an m-by-n matrix then m-element right-hand side, return n least-squares coefficients in original column order. |
| solveMatrixQR | Given QR factors and an m-by-k RHS, return n-by-k least-squares coefficients, undoing column pivoting. |
| ridgeSolve | Given finite nonnegative lambda, design matrix, then RHS list, minimize squared residual plus lambda times squared coefficient norm. |
| ridgeSolveMatrix | Given lambda, m-by-n design, then m-by-k RHS, return n-by-k ridge coefficients via augmented QR. |
HMath.Sparse¶
| API | Purpose |
|---|---|
| Sparse | Canonical immutable sparse matrix with summed duplicate coordinates and explicit zeros removed. |
| SparseFormat | Interchange representation selector carrying COO,CSR,CSC,DIA,BSR,or ELLPACK arrays; validate through fromFormat. |
| COO | Declaration and type contract below. |
| CSR | Declaration and type contract below. |
| CSC | Declaration and type contract below. |
| DIA | Declaration and type contract below. |
| BSR | Declaration and type contract below. |
| ELLPACK | Declaration and type contract below. |
| sparse | Given rows,columns,then (row,column,value) entries, validate coordinates, sum duplicates and remove explicit zeros. |
| sparseShape | Return declared (row count,column count), including empty dimensions. |
| nonzeros | Return stored nonzero count after duplicate coalescing and zero removal. |
| sparseEntries | Return canonical nonzero (row,column,value) triples in ascending coordinate order. |
| fromFormat | Validate COOCSRCSCDIABSRELLPACK dimensions, pointersindices and values, then construct canonical sparse storage. |
| toCOO | Return coordinate-list SparseFormat with explicit rowcolumnvalue arrays, preserving canonical nonzeros. |
| toCSR | Return compressed sparse row format with row offsets, column indices and nonzero values. |
| toCSC | Return compressed sparse column format with column offsets, row indices and values. |
| toDIA | Return diagonal sparse format; absent positions in represented diagonals are padded with zero. |
| toBSR | Given positive block rows,block columns,then sparse matrix, build block-sparse-row format with zero padding within edge blocks. |
| toELLPACK | Return ELLPACK padded row storage, using row width equal to maximum nonzeros per row. |
| sparseToDense | Return a dense Matrix with the same dimensions and zeros for missing entries. |
| denseToSparse | Convert a dense matrix to canonical sparse storage, discarding exact zeros and preserving dimensions. |
| sparseTranspose | Exchange row/column coordinates and dimensions without changing values, returning canonical sparse order. |
| sparseAdd | Add equal-shaped sparse matrices, coalescing entries and dropping resulting zeros. |
| sparseSubtract | Subtract right sparse values from left for equal shapes; coalesce and remove zeros. |
| spmv | Given sparse matrix then dense vector, return matrix-vector product. |
| spmm | Multiply compatible sparse matrices using sparse row contributions. |
| sparseKronecker | Return sparse Kronecker product, multiplying row/column dimensions and nonzero pairs. |
| sparseTriangularSolve | Given lower Bool,square finite sparse matrix,then RHS list, solve by forward/back substitution. |
| sparseDiagonalSolve | Given diagonal square sparse matrix then RHS, divide by each diagonal pivot. |
| SparseLU | Opaque sparse row-pivoted LU factors with reconstruction permutation; solve through sparseSolveLU. |
| sparseLU | Given finite nonnegative relative pivot tolerance then square finite sparse matrix, compute sparse LU with row pivoting. |
| sparseLULower | Extract unit lower-triangular sparse factor from a SparseLU result. |
| sparseLUUpper | Extract upper-triangular sparse factor from a SparseLU result. |
| sparseLUPermutation | Return LU row permutation in pivoted order, for reconstructing PA=LU. |
| sparseSolveLU | Given sparse LU factors then RHS list, apply row permutation and triangular solves. |
| sparseCholesky | Factor a symmetric positive-definite finite sparse matrix into a lower sparse factor. |
| SparseQR | Opaque sparse QR factors with implicit orthogonal transform; use sparseQRUpper and sparseQRApplyQT. |
| sparseQR | Sparse Householder QR retains only the R nonzeros and compact reflectors; fill is retained, never silently dropped. |
| sparseQRUpper | Extract upper-triangular/trapezoidal sparse R from a sparse QR factorization. |
| sparseQRApplyQT | Given sparse QR factors then compatible RHS list, apply transpose(Q) without constructing dense Q. |
| sparseGraph | For a square sparse matrix, return one adjacency row per vertex with stored (column,value) neighbors. |
| sparseStorageBytes | Logical payload bytes: two machine-width indices and caller-provided scalar width per nonzero. |
| SparseTensor | Canonical sparse multidimensional entries, constructed by sparseTensor with checked coordinates and duplicate coalescing. |
| sparseTensor | Given dimensions then (coordinate-list,value) entries, validate rank/bounds, sum duplicate coordinates and remove zeros. |
| sparseTensorEntries | Return canonical nonzero (coordinate list,value) pairs in lexicographic coordinate order. |
| sparseTensorShape | Return axis dimensions of a sparse tensor; [] denotes a scalar. |
| sparseTensorLookup | Given sparse tensor then full zero-based coordinates, return stored value or zero. |
| sparseEigenReference | Small-problem spectral reference backend. |
| sparseSVDReference | Given explicit dense-byte budget then sparse Double matrix, densify only if within budget and run checked dense SVD. |
HMath.Sparse.Spectral¶
| API | Purpose |
|---|---|
| SparseSpectralOptions | Residual tolerances, per-pair iteration budget and an explicit workspace limit measured in scalar elements. |
| SparseSpectralOptions | Declaration and type contract below. |
| sparseAbsoluteTolerance | Absolute norm tolerance, finite and nonnegative. |
| sparseRelativeTolerance | Relative tolerance against max(abs eigen/singular value,maxAbs input). |
| sparseIterationLimit | Nonnegative number of power updates per pair. |
| sparseWorkspaceLimit | Maximum estimated simultaneous vector elements, nonnegative. |
| defaultSparseSpectralOptions | Absolute tolerance 1e-12, relative tolerance 1e-10, 1000 iterations per pair and a workspace limit of ten million scalar elements. |
| SparseEigenResult | A normalized real symmetric eigenpair and its independently checked residual. |
| SparseEigenResult | Declaration and type contract below. |
| sparseEigenvalue | Rayleigh quotient; negative dominant eigenvalues retain their sign. |
| sparseEigenvector | Unit Euclidean norm eigenvector. |
| sparseEigenResidual | Original norm ||A v-lambda v||_2. |
| sparseEigenIterations | Number of completed power updates. |
| sparseDominantEigen | Symmetric power iteration targeting the eigenvalue of largest magnitude. |
| SparseSVD | Compact singular triplets. |
| SparseSVD | Declaration and type contract below. |
| sparseSingularValues | Nonnegative singular estimates in extraction order. |
| sparseLeftVectors | Left unit vectors, one list per singular triplet. |
| sparseRightVectors | Right unit vectors (columns of V, rather than rows of V^T). |
| sparseSingularResiduals | Original (||A v-s u||_2,||A^T u-s v||_2) residuals. |
| sparseSingularIterations | Power updates used by each triplet. |
| sparseTruncatedSVD | Truncated SVD by two-sided power iteration and two-pass orthogonal deflation. |
HMath.Vector¶
| API | Purpose |
|---|---|
| Vector | Immutable dynamically sized coordinate list. |
| vector | Wrap a list as an immutable dynamic vector without numeric validation. |
| vectorValues | Extract the immutable list of vector values in order; no shape conversion or numeric validation occurs. |
| vectorDimension | Return the number of coordinates in a dynamic vector. |
| FixedVector | Opaque vector whose length matches its KnownNat type index. |
| SparseVector | Opaque dynamic vector with canonical nonzero coordinate entries. |
| fixedVector | Construct a vector whose list length equals the type-level KnownNat size. |
| fixedValues | Extract the ordered coordinates of a type-indexed vector; its length is the type-level size. |
| sparseVector | Given nonnegative dimension and (zero-based index,value) entries, sum duplicate indices and remove explicit zeros. |
| sparseVectorValues | Expand a sparse vector to a dense list of its declared dimension, filling absent entries with zero. |
| vectorSlice | Given start, count, then vector, return the half-open slice [start,start+count). |
| vectorConcat | Concatenate a list of vectors in order. |
| vectorAdd | Add corresponding values of equally sized vectors, returning a new vector. |
| vectorSubtract | Subtract corresponding right-hand coordinates from left-hand coordinates. |
| vectorScale | Given scalar then vector, multiply every coordinate by the scalar. |
| vectorDot | Sum coordinatewise products of equally sized vectors. |
| cross | Compute the right-handed cross product of two three-dimensional vectors. |
| outer | Return the matrix of pairwise products a[i]*b[j], with shape (dimension a,dimension b). |
| triple | Given a,b,c, compute scalar triple product a dot (b cross c). |
| norm0 | Count nonzero coordinates, returning Int. |
| norm1 | Sum absolute coordinate values. |
| norm2 | Compute Euclidean length using a scaled stable norm to reduce intermediate overflow/underflow. |
| normP | Given positive exponent p then finite vector, compute the scaled p-norm. |
| normInfinity | Return maximum absolute coordinate, or zero for an empty vector. |
| normalizeVector | Return a unit-length vector in the same direction. |
| project | Given a then b, return the projection of a onto b. |
| reflect | Given incident vector then surface normal, return incident minus twice its projection onto the normal. |
| refract | Given positive finite refractive-index ratio, incident vector, then normal, return the refracted unit-direction expression. |
| distance | Return Euclidean distance between equal-sized finite vectors. |
| angle | Return the angle in radians, acos of cosineSimilarity, between two nonzero finite equally sized vectors. |
| cosineSimilarity | Return normalized dot product clamped to [-1,1]. |
| gramSchmidt | Given finite nonnegative relative tolerance then vectors, perform two-pass modified Gram-Schmidt, returning an orthonormal basis in input order. |