svMultiPhysics
Loading...
Searching...
No Matches
Modules | Classes | Functions

Linear algebra vocabulary types and dense utilities for finite-element computations. More...

Collaboration diagram for Math:

Modules

 Matrix
 Fixed-size matrix type aliases.
 
 Vector
 Fixed-size vector type aliases.
 

Classes

struct  svmp::FE::math::DensePseudoInverseResult
 Result of a rank-revealing pseudo-inverse. More...
 
struct  svmp::FE::math::DenseMatrixDiagnostics
 SVD-based conditioning and rank diagnostics for a dense matrix. More...
 
struct  svmp::FE::math::DenseInverseResult
 A dense inverse together with its diagnostics. More...
 
struct  svmp::FE::math::DenseLUSolver
 LU factorization of a dense square matrix with a cached pivot summary. More...
 

Functions

double svmp::FE::math::dense_matrix_max_abs (std::span< const double > matrix) noexcept
 Largest absolute entry of a dense matrix.
 
double svmp::FE::math::dense_matrix_pivot_tolerance (std::size_t rows, std::size_t cols, double max_abs, double multiplier=double(64)) noexcept
 Scale-aware pivot tolerance for dense factorization.
 
double svmp::FE::math::dense_matrix_singular_value_tolerance (std::size_t rows, std::size_t cols, double largest_singular_value, double multiplier=double(64)) noexcept
 Scale-aware singular-value tolerance for rank decisions.
 
double svmp::FE::math::dense_matrix_condition_fallback_threshold () noexcept
 Condition estimate above which the inverse switches to an SVD fallback.
 
double svmp::FE::math::dense_matrix_condition_error_threshold () noexcept
 Condition estimate above which validation rejects a dense inverse.
 
DenseMatrixDiagnostics svmp::FE::math::dense_matrix_diagnostics (std::span< const double > matrix, std::size_t rows, std::size_t cols, std::string_view error_message_label="dense matrix")
 SVD-based rank and conditioning diagnostics for a dense matrix.
 
DenseLUSolver svmp::FE::math::factor_dense_matrix (std::vector< double > matrix, std::size_t n, std::string_view error_message_label="dense matrix")
 LU-factor a dense square matrix.
 
std::vector< double > svmp::FE::math::invert_dense_matrix (std::vector< double > matrix, std::size_t n, std::string_view error_message_label="dense matrix")
 Invert a dense square matrix.
 
DenseInverseResult svmp::FE::math::invert_dense_matrix_with_diagnostics (std::vector< double > matrix, std::size_t n, std::string_view error_message_label="dense matrix")
 Invert a dense square matrix with diagnostics, using an SVD fallback for high-condition matrices.
 
void svmp::FE::math::validate_dense_inverse_diagnostics (const DenseInverseResult &result, std::size_t expected_rank, std::string_view error_message_label="dense matrix", double max_condition=dense_matrix_condition_error_threshold())
 Validate that a dense inverse has full rank and acceptable conditioning.
 
std::size_t svmp::FE::math::dense_matrix_rank (std::vector< double > matrix, std::size_t rows, std::size_t cols)
 Numerical rank of a dense matrix from its singular values.
 
DensePseudoInverseResult svmp::FE::math::rank_revealing_pseudo_inverse (std::span< const double > matrix, std::size_t rows, std::size_t cols, std::string_view error_message_label="dense matrix")
 Moore-Penrose pseudo-inverse via a rank-revealing SVD.
 

Detailed Description

Linear algebra vocabulary types and dense utilities for finite-element computations.

The Math module defines the fixed-size vector and matrix types used in element-level kernels (as aliases of Eigen types) and dense linear algebra utilities used by basis construction and local transforms.

Function Documentation

◆ dense_matrix_condition_error_threshold()

double svmp::FE::math::dense_matrix_condition_error_threshold ( )
noexcept

Condition estimate above which validation rejects a dense inverse.

Returns
The error condition-number threshold.

◆ dense_matrix_condition_fallback_threshold()

double svmp::FE::math::dense_matrix_condition_fallback_threshold ( )
noexcept

Condition estimate above which the inverse switches to an SVD fallback.

Returns
The fallback condition-number threshold.

◆ dense_matrix_diagnostics()

DenseMatrixDiagnostics svmp::FE::math::dense_matrix_diagnostics ( std::span< const double >  matrix,
std::size_t  rows,
std::size_t  cols,
std::string_view  error_message_label = "dense matrix" 
)

SVD-based rank and conditioning diagnostics for a dense matrix.

Parameters
matrixRow-major matrix of size rows * cols.
rowsRow count.
colsColumn count.
error_message_labelPrefix for the message of any exception thrown.
Returns
Rank, tolerance, singular-value, and condition diagnostics.
Exceptions
FEExceptionIf the matrix size is inconsistent or the matrix is empty.

◆ dense_matrix_max_abs()

double svmp::FE::math::dense_matrix_max_abs ( std::span< const double >  matrix)
noexcept

Largest absolute entry of a dense matrix.

Parameters
matrixRow-major matrix entries.
Returns
Maximum of |entry| over all entries, or 0 for an empty matrix.

◆ dense_matrix_pivot_tolerance()

double svmp::FE::math::dense_matrix_pivot_tolerance ( std::size_t  rows,
std::size_t  cols,
double  max_abs,
double  multiplier = double(64) 
)
noexcept

Scale-aware pivot tolerance for dense factorization.

Proportional to machine epsilon scaled by the matrix size and magnitude; pivots below it are treated as rank-deficient.

Parameters
rowsRow count.
colsColumn count.
max_absLargest absolute matrix entry (see dense_matrix_max_abs()).
multiplierSafety factor applied to the epsilon-scaled tolerance.
Returns
Pivot magnitude threshold.

◆ dense_matrix_rank()

std::size_t svmp::FE::math::dense_matrix_rank ( std::vector< double >  matrix,
std::size_t  rows,
std::size_t  cols 
)

Numerical rank of a dense matrix from its singular values.

Parameters
matrixRow-major matrix of size rows * cols (consumed).
rowsRow count.
colsColumn count.
Returns
Number of singular values above the scale-aware tolerance.
Exceptions
FEExceptionIf the matrix size is inconsistent.

◆ dense_matrix_singular_value_tolerance()

double svmp::FE::math::dense_matrix_singular_value_tolerance ( std::size_t  rows,
std::size_t  cols,
double  largest_singular_value,
double  multiplier = double(64) 
)
noexcept

Scale-aware singular-value tolerance for rank decisions.

Singular values at or below the returned tolerance are treated as zero when computing rank or a pseudo-inverse.

Parameters
rowsRow count.
colsColumn count.
largest_singular_valueLargest singular value of the matrix.
multiplierSafety factor applied to the epsilon-scaled tolerance.
Returns
Singular-value threshold.

◆ factor_dense_matrix()

DenseLUSolver svmp::FE::math::factor_dense_matrix ( std::vector< double >  matrix,
std::size_t  n,
std::string_view  error_message_label = "dense matrix" 
)

LU-factor a dense square matrix.

Parameters
matrixRow-major n * n matrix (consumed).
nMatrix dimension.
error_message_labelPrefix for the message of any exception thrown.
Returns
The factorization.
Exceptions
FEExceptionIf the size is inconsistent or the matrix is rank-deficient.

◆ invert_dense_matrix()

std::vector< double > svmp::FE::math::invert_dense_matrix ( std::vector< double >  matrix,
std::size_t  n,
std::string_view  error_message_label = "dense matrix" 
)

Invert a dense square matrix.

Parameters
matrixRow-major n * n matrix (consumed).
nMatrix dimension.
error_message_labelPrefix for the message of any exception thrown.
Returns
Row-major inverse of size n * n.
Exceptions
FEExceptionIf the size is inconsistent or the matrix is singular.

◆ invert_dense_matrix_with_diagnostics()

DenseInverseResult svmp::FE::math::invert_dense_matrix_with_diagnostics ( std::vector< double >  matrix,
std::size_t  n,
std::string_view  error_message_label = "dense matrix" 
)

Invert a dense square matrix with diagnostics, using an SVD fallback for high-condition matrices.

Parameters
matrixRow-major n * n matrix (consumed).
nMatrix dimension.
error_message_labelPrefix for the message of any exception thrown.
Returns
Inverse plus diagnostics and whether the SVD fallback was used.
Exceptions
FEExceptionIf the size is inconsistent or the matrix is rank-deficient.

◆ rank_revealing_pseudo_inverse()

DensePseudoInverseResult svmp::FE::math::rank_revealing_pseudo_inverse ( std::span< const double >  matrix,
std::size_t  rows,
std::size_t  cols,
std::string_view  error_message_label = "dense matrix" 
)

Moore-Penrose pseudo-inverse via a rank-revealing SVD.

Parameters
matrixRow-major matrix of size rows * cols.
rowsRow count.
colsColumn count.
error_message_labelPrefix for the message of any exception thrown.
Returns
Row-major pseudo-inverse (cols * rows) plus rank/tolerance diagnostics.
Exceptions
FEExceptionIf the matrix size is inconsistent or the matrix is empty.

◆ validate_dense_inverse_diagnostics()

void svmp::FE::math::validate_dense_inverse_diagnostics ( const DenseInverseResult &  result,
std::size_t  expected_rank,
std::string_view  error_message_label = "dense matrix",
double  max_condition = dense_matrix_condition_error_threshold() 
)

Validate that a dense inverse has full rank and acceptable conditioning.

Parameters
resultResult from invert_dense_matrix_with_diagnostics().
expected_rankRequired (full) rank.
error_message_labelPrefix for the message of any exception thrown.
max_conditionLargest acceptable condition estimate.
Exceptions
FEExceptionIf the rank is below expected_rank or the condition exceeds max_condition.