Expand description
Dense and sparse linear algebra.
Matrix is the dense row-major f64 type everything here operates
on. The factorizations are chosen by what the matrix is: lu with
partial pivoting for a general square solve, cholesky for symmetric
positive-definite (half the work, and it fails cleanly if the matrix is
not), qr by Householder reflections for least squares, svd by
one-sided Jacobi for rank and pseudo-inverse, and tridiagonal for
the Thomas algorithm in O(n).
eigen provides the symmetric eigenproblem and general eigenvalues.
sparse provides CSR storage with conjugate gradient and a
Jacobi-preconditioned variant, for the large systems that the PDE
solvers in crate::fem produce.
Note that pcg_jacobi’s tolerance is relative to the norm of the
right-hand side, not absolute.
Re-exports§
pub use cholesky::cholesky;pub use cholesky::cholesky_solve;pub use eigen::eigen_symmetric;pub use eigen::eigenvalues_general;pub use eigen::SymEigen;pub use lu::lu_decompose;pub use lu::solve;pub use lu::Lu;pub use matrix::Matrix;pub use qr::least_squares;pub use qr::qr_householder;pub use qr::Qr;pub use sparse::conjugate_gradient;pub use sparse::pcg_jacobi;pub use sparse::CsrMatrix;pub use svd::kabsch;pub use svd::pseudoinverse;pub use svd::rank;pub use svd::svd;pub use svd::Svd;pub use tridiagonal::eigen_symmetric_tridiagonal;pub use tridiagonal::thomas_solve;
Modules§
- cholesky
- Cholesky factorization of symmetric positive-definite matrices.
- eigen
- Eigenvalue solvers.
- lu
- LU decomposition with partial pivoting (Doolittle form).
- matrix
- Dense row-major matrix of
f64. - qr
- QR decomposition by Householder reflections and least-squares solve.
- sparse
- Compressed sparse row (CSR) matrices and conjugate-gradient solvers.
- svd
- Singular value decomposition by one-sided Jacobi rotations.
- tridiagonal
- Tridiagonal linear solve (Thomas algorithm).
Structs§
Functions§
- cartesian_
to_ cylindrical - Returns (rho, phi, z) where rho is the radial distance in the xy-plane and phi is the azimuthal angle from +x.
- cartesian_
to_ polar - Returns (r, theta) where theta is the angle from +x.
- cartesian_
to_ spherical - Returns (r, theta, phi) where theta is the polar angle from +z and phi is the azimuthal angle from +x.
- cylindrical_
to_ cartesian - Converts cylindrical coordinates (rho, phi, z) to Cartesian (x, y, z).
- polar_
to_ cartesian - Converts 2D polar coordinates (r, theta) to Cartesian (x, y).
- rotation_
axis_ angle - Rodrigues’ rotation formula: rotate by
angleradians aboutaxis. The axis is normalized internally. - rotation_
x - Rotation matrix about the x-axis by the given angle in radians.
- rotation_
y - Rotation matrix about the y-axis by the given angle in radians.
- rotation_
z - Rotation matrix about the z-axis by the given angle in radians.
- spherical_
to_ cartesian - Converts spherical coordinates (r, theta, phi) to Cartesian (x, y, z).