The MathLin package provides modern C++ implementations of linear algebra solvers for the Open CASCADE Technology (OCCT) library. These solvers are designed for solving linear systems, matrix decompositions, eigenvalue problems, and least squares computations.
LU decomposition with partial pivoting for solving general linear systems Ax = b.
LU() - LU decomposition of a square matrixSolve() - Solve linear system using LU decompositionSolveMultiple() - Solve multiple right-hand sides (returns full solution matrix)Determinant() - Compute matrix determinantInvert() - Compute matrix inverseCrout (LDL^T) decomposition optimized for symmetric matrices.
Crout() - LDL^T decomposition for symmetric matricesSolveCrout() - Solve symmetric linear systemInvertCrout() - Invert symmetric matrixSingular Value Decomposition for general and ill-conditioned matrices.
SVD() - Compute singular value decomposition A = U * S * V^TSolveSVD() - Solve linear system using SVD (handles rank-deficient systems)PseudoInverse() - Compute Moore-Penrose pseudo-inverseConditionNumber() - Compute matrix condition numberNumericalRank() - Determine numerical rankQR decomposition using Householder reflections.
QR() - QR decomposition of a matrixSolveQR() - Solve overdetermined system (least squares)SolveQRMultiple() - Solve multiple right-hand sides (returns full solution matrix)Jacobi method for eigenvalue decomposition of symmetric matrices.
Jacobi() - Compute eigenvalues and eigenvectorsEigenValues() - Compute only eigenvaluesSpectralDecomposition() - Compute spectral decomposition A = V * D * V^TMatrixPower() - Compute matrix power using eigendecompositionMatrixSqrt() - Compute matrix square rootMatrixInvSqrt() - Compute inverse square rootLeast squares solvers with multiple methods.
LeastSquares() - Solve overdetermined systems with choice of methodWeightedLeastSquares() - Weighted least squaresRegularizedLeastSquares() - Tikhonov/Ridge regressionOptimalRegularization() - Find optimal regularization parameterQL algorithm for eigenvalue decomposition of tridiagonal matrices.
EigenTridiagonal() - Eigenvalues and eigenvectors of tridiagonal matrixGetEigenVector() - Extract single eigenvector from resultAll functions are in the MathLin namespace and return result structures with status information:
#include <MathLin_Gauss.hxx> #include <math_Matrix.hxx> #include <math_Vector.hxx> math_Matrix A(1, 3, 1, 3); math_Vector b(1, 3); // ... initialize A and b ... auto result = MathLin::Solve(A, b); if (result.IsDone()) { const math_Vector& x = *result.Solution; // Use solution x }
For matrix right-hand sides (SolveMultiple, SolveQRMultiple), APIs return LinearMultipleResult with Solutions (math_Matrix) instead of a single vector.
The MathLin package depends on: