Skip to main content

Crate rusolver

Crate rusolver 

Source
Expand description

Numerical linear algebra with explicit execution and failure contracts.

Default: dependency-free, synchronous host FP64. No GPU tensor is implicitly downloaded and no existing ruda-tensor LU entry point is replaced. Optional tensor: native FP32 small batched LU/QR/Cholesky/eigen/CG kernels. sparse adapts ruSPARSE CSR; collective adapts existing ruCCL host TCP. Host SVD, complex decompositions, sparse LU and reverse-mode pullbacks are dependency-free. These APIs report limitations rather than densifying or changing the execution backend silently.

This is an experimental numerical baseline, not LAPACK/cuSOLVER API parity. Dense inputs are nonempty, finite, row-major matrices; views also permit explicit positive strides and transposition. Numerical rank/pivot decisions use the supplied tolerance and do not estimate a condition number.

Modules§

adjoint
Real FP64 reverse-mode primitives. These differentiate the mathematical operation, NOT iterations/pivot choices. No finite differences in production. See ruda-autodiff’s opt-in solver-host module for actual graph integration.
complex
Host complex FP64 LU, Hermitian Cholesky and thin Householder QR. Each component is f64 (128 storage bits per complex value); not CUDA Complex64.
distributed
Row-partitioned HOST FP64 preconditioned CG. Matrix rows stay partitioned; search vectors are all-gathered, scalars globally reduced. No device/RDMA claim.
kernel_plan
Launch planning for explicit small-matrix warp-shared kernels. Dependency-free launch geometry for the opt-in warp-shared direct solvers. This describes source-level storage/work, NOT measured bandwidth or latency.
sparse_direct
Sparse Gaussian elimination with partial row pivoting and exact fill-in. Uses ordered sparse rows throughout; NEVER silently densifies or drops small fill. No symbolic reuse, supernodes, parallel factorization or fill-reducing ordering.

Structs§

CgOptions
CgReport
Cholesky
CholeskyOptions
EigenOptions
IdentityPreconditioner
JacobiPreconditioner
Positive diagonal preconditioner. Reciprocal overflow is rejected at construction.
LeastSquares
Lu
Reusable square LU with partial ROW pivoting. Convention: P * A = L * U. pivots[k] is the row interchanged with row k during elimination. The factors own a copy; the caller’s input is never modified. Not a blocked BLAS kernel.
Matrix
Owned finite row-major FP64 data. Empty axes are rejected in this first release.
MatrixView
Immutable matrix view. Constructor validates reachable indices and values; unrelated padding elements may contain arbitrary values. Overlapping READS are allowed; the view cannot be used to create mutable aliases.
Qr
Economy QR with recomputed column norms and column pivoting. Convention: A[:, permutation] = Q * R, where Q has m rows and n columns. Householder reflectors are stored, not a full m*m Q. Only m >= n is supported.
Svd
SvdOptions
SymmetricEigen
Tolerance
Absolute/relative cutoff: max(absolute, relative * scale). Both may be zero for exact-zero checks. Negative/nonfinite inputs are rejected.

Enums§

IterativeStatus
SolverError

Traits§

LinearOperator
Synchronous HOST linear map. Implementations must fully overwrite output, preserve inputs and implement a fixed linear map throughout one solve. Device-resident asynchronous algorithms will use a separate API, not hidden copies.
Preconditioner

Functions§

conjugate_gradient
Preconditioned conjugate gradient for a fixed real symmetric POSITIVE-DEFINITE operator and positive-definite preconditioner. Caller guarantees those global properties; positive-curvature checks can detect some violations, not prove SPD. Zero RHS and an already-correct initial guess converge in zero iterations. Failure to reach tolerance returns MaxIterations, never a false success.
l2_norm
Scaled sum of squares, avoiding overflow from squaring large finite entries. Returns an error if the norm itself exceeds the representable FP64 range.
relative_residual
||A*x-b||_2 / ||b||_2; for a zero RHS returns the absolute residual norm. This is a residual diagnostic, NOT a forward-error or condition estimate.
symmetric_eigen
Cyclic Jacobi rotations for a real symmetric, small/moderate dense matrix. Scales A by max(abs(A)); no general-complex eigensolver or cuSOLVER dispatch. A zero convergence tolerance and zero sweep budget are explicitly rejected.