Skip to main content

oxicuda_solver/
lib.rs

1//! # OxiCUDA Solver — GPU-Accelerated Matrix Decompositions
2//!
3//! This crate provides GPU-accelerated matrix decompositions and linear solvers,
4//! serving as a pure Rust equivalent to NVIDIA's cuSOLVER library.
5//!
6//! ## Dense decompositions
7//!
8//! - **LU** — LU factorization with partial pivoting (`P * A = L * U`)
9//! - **QR** — QR factorization via blocked Householder reflections (`A = Q * R`)
10//! - **Cholesky** — Cholesky decomposition for SPD matrices (`A = L * L^T`)
11//! - **SVD** — Singular Value Decomposition (`A = U * Σ * V^T`)
12//! - **DC-SVD** — Divide-and-Conquer SVD for medium-to-large matrices
13//! - **LDL^T** — Bunch-Kaufman factorization for symmetric indefinite matrices
14//! - **Eigendecomposition** — Symmetric eigenvalue decomposition (`A = Q * Λ * Q^T`)
15//! - **Inverse** — Matrix inverse via LU (`A^{-1}`)
16//! - **Determinant** — Determinant and log-determinant via LU
17//! - **Least squares** — Least squares solver via QR (`min ||A*x - b||`)
18//!
19//! ## Dense solvers
20//!
21//! - **Tridiagonal** — Thomas algorithm and cyclic reduction for tridiagonal systems
22//! - **Band** — LU and Cholesky for banded matrices (O(n*b^2) complexity)
23//!
24//! ## Iterative sparse solvers
25//!
26//! - **CG** — Conjugate Gradient for SPD systems
27//! - **BiCGSTAB** — Biconjugate Gradient Stabilized for non-symmetric systems
28//! - **GMRES(m)** — Generalized Minimal Residual with restart
29//! - **FGMRES(m)** — Flexible GMRES with variable preconditioner
30//! - **Direct** — Direct sparse solver via dense LU (small systems)
31//! - **Preconditioned CG** — PCG with pluggable preconditioners (Identity, Jacobi, ILU, IC)
32//! - **Preconditioned GMRES** — Left-preconditioned GMRES(m) with restart
33//!
34//! ## Example
35//!
36//! ```rust,no_run
37//! use oxicuda_solver::prelude::*;
38//! ```
39//!
40//! (C) 2026 COOLJAPAN OU (Team KitaSan)
41
42#![warn(clippy::all)]
43#![warn(missing_docs)]
44
45pub mod dense;
46pub mod error;
47pub mod handle;
48pub mod helpers;
49pub mod sparse;
50
51#[allow(dead_code)]
52pub(crate) mod ptx_helpers;
53
54pub use dense::{
55    AdvectionEquation1D, BandMatrix, BatchAlgorithm, BatchConfig, BatchedResult, BatchedSolver,
56    Bdf2Solver, BoundaryCondition, CpAlsConfig, CpDecomposition, DcSvdConfig, EigJob, EulerSolver,
57    Grid1D, Grid2D, HeatEquation1D, ImplicitEulerSolver, LdltResult, LuResult, Matrix, OdeConfig,
58    OdeMethod, OdeSolution, OdeSystem, PdeConfig, Poisson1D, RandomizedSvdConfig,
59    RandomizedSvdResult, Rk4Solver, Rk45Solver, StepResult, SvdJob, SvdResult, Tensor, TtConfig,
60    TtDecomposition, TuckerConfig, TuckerDecomposition, WaveEquation1D,
61};
62pub use error::{SolverError, SolverResult};
63pub use handle::SolverHandle;
64pub use sparse::{
65    AdjacencyGraph, EliminationTree, FgmresConfig, MultifrontalLUSolver, NestedDissectionOrdering,
66    OrderingQuality, Permutation, SupernodalCholeskySolver, SupernodalStructure,
67    SymbolicFactorization, fgmres, sparse_cholesky_solve, sparse_lu_solve,
68};
69
70/// Prelude for convenient imports.
71pub mod prelude {
72    pub use crate::dense::*;
73    pub use crate::error::{SolverError, SolverResult};
74    pub use crate::handle::SolverHandle;
75    pub use crate::sparse::direct_factorization::{
76        EliminationTree, MultifrontalLUSolver, SupernodalCholeskySolver, SupernodalStructure,
77        SymbolicFactorization, sparse_cholesky_solve, sparse_lu_solve,
78    };
79    pub use crate::sparse::nested_dissection::{
80        AdjacencyGraph, NestedDissectionOrdering, OrderingQuality, Permutation,
81    };
82}