![]() |
KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
|
Various mathematical utilities to compute SVD and the condition number of a matrix. More...
#include <svd_utils.h>
Static Public Member Functions | |
Operations | |
static std::size_t | SingularValueDecomposition (const MatrixType &InputMatrix, MatrixType &UMatrix, MatrixType &SMatrix, MatrixType &VMatrix, Parameters ThisParameters) |
This function gives the SVD of a given mxn matrix (m>=n), returns U,S; where A=U*S*V. More... | |
static std::size_t | SingularValueDecomposition (const MatrixType &InputMatrix, MatrixType &UMatrix, MatrixType &SMatrix, MatrixType &VMatrix, const std::string &TypeSVD="Jacobi", const TDataType Tolerance=std::numeric_limits< double >::epsilon(), const IndexType MaxIter=200) |
This function gives the SVD of a given mxn matrix (m>=n), returns U,S; where A=U*S*V. More... | |
static std::size_t | JacobiSingularValueDecomposition (const MatrixType &InputMatrix, MatrixType &UMatrix, MatrixType &SMatrix, MatrixType &VMatrix, const TDataType Tolerance=std::numeric_limits< double >::epsilon(), const IndexType MaxIter=200) |
This function gives the Jacobi SVD of a given mxn matrix (m>=n), returns U,S; where A=U*S*V. More... | |
static void | SingularValueDecomposition2x2 (const MatrixType &InputMatrix, MatrixType &UMatrix, MatrixType &SMatrix, MatrixType &VMatrix) |
This function gives the Jacobi SVD of a given 2x2 matrix, returns U,S; where A=U*S*V. More... | |
static void | SingularValueDecomposition2x2Symmetric (const MatrixType &InputMatrix, MatrixType &UMatrix, MatrixType &SMatrix, MatrixType &VMatrix) |
static void | Jacobi (MatrixType &J1, MatrixType &J2, const MatrixType &InputMatrix, const SizeType &Size1, const SizeType &Size2, const SizeType &Index1, const SizeType &Index2) |
This method computes the Jacobi rotation operation. More... | |
static void | Jacobi (MatrixType &J1, const MatrixType &InputMatrix, const SizeType &Size1, const SizeType &Index1, const SizeType &Index2) |
This method computes the Jacobi rotation operation. More... | |
static TDataType | SVDConditionNumber (const MatrixType &InputMatrix, const std::string TypeSVD="Jacobi", const TDataType Tolerance=std::numeric_limits< double >::epsilon(), const IndexType MaxIter=200) |
This method computes the condition number using the SVD. More... | |
Type Definitions | |
typedef Matrix | MatrixType |
Definition of the matrix type. More... | |
typedef Vector | VectorType |
Definition of the vector type. More... | |
typedef std::size_t | SizeType |
Definition of the size type. More... | |
typedef std::size_t | IndexType |
Definition of index type. More... | |
typedef UblasSpace< TDataType, Matrix, Vector > | LocalSpaceType |
Definition of local space. More... | |
constexpr static TDataType | ZeroTolerance = std::numeric_limits<double>::epsilon() |
Definition of epsilon zero tolerance. More... | |
Various mathematical utilities to compute SVD and the condition number of a matrix.
Defines several utility functions
typedef std::size_t Kratos::SVDUtils< TDataType >::IndexType |
Definition of index type.
typedef UblasSpace<TDataType, Matrix, Vector> Kratos::SVDUtils< TDataType >::LocalSpaceType |
Definition of local space.
typedef Matrix Kratos::SVDUtils< TDataType >::MatrixType |
Definition of the matrix type.
typedef std::size_t Kratos::SVDUtils< TDataType >::SizeType |
Definition of the size type.
typedef Vector Kratos::SVDUtils< TDataType >::VectorType |
Definition of the vector type.
|
inlinestatic |
This method computes the Jacobi rotation operation.
J1 | First Jacobi matrix |
InputMatrix | The matrix to compute the Jacobi tolerance |
Size1 | The size of the matrix (number of rows) |
Size2 | The size of the matrix (number of columns) |
Index1 | The index to compute (row) |
Index2 | The index to compute (column) |
|
inlinestatic |
This method computes the Jacobi rotation operation.
J1 | First Jacobi matrix |
J2 | Second Jacobi matrix |
InputMatrix | The matrix to compute the Jacobi tolerance |
Size1 | The size of the matrix (number of rows) |
Size2 | The size of the matrix (number of columns) |
Index1 | The index to compute (row) |
Index2 | The index to compute (column) |
|
inlinestatic |
This function gives the Jacobi SVD of a given mxn matrix (m>=n), returns U,S; where A=U*S*V.
U and V are unitary, and S is a diagonal matrix. Where s_i >= 0, and s_i >= s_i+1 (which means that the biggest number is the first one and the smallest the last one)
InputMatrix | The matrix where perform the SVD |
UMatrix | The unitary U matrix |
SMatrix | The diagonal S matrix |
VMatrix | The unitary V matrix |
Tolerance | The tolerance considered |
MaxIter | Maximum number of iterations |
|
inlinestatic |
This function gives the SVD of a given mxn matrix (m>=n), returns U,S; where A=U*S*V.
U and V are unitary, and S is a diagonal matrix. Where s_i >= 0, and s_i >= s_i+1 (which means that the biggest number is the first one and the smallest the last one)
InputMatrix | The matrix where perform the SVD |
UMatrix | The unitary U matrix |
SMatrix | The diagonal S matrix |
VMatrix | The unitary V matrix |
TypeSVD | The type of SVD algorithm (Jacobi by default) |
Tolerance | The tolerance considered |
MaxIter | Maximum number of iterations |
|
inlinestatic |
This function gives the SVD of a given mxn matrix (m>=n), returns U,S; where A=U*S*V.
U and V are unitary, and S is a diagonal matrix. Where s_i >= 0, and s_i >= s_i+1 (which means that the biggest number is the first one and the smallest the last one)
InputMatrix | The matrix where perform the SVD |
UMatrix | The unitary U matrix |
SMatrix | The diagonal S matrix |
VMatrix | The unitary V matrix |
ThisParameters | The configuration parameters |
|
inlinestatic |
This function gives the Jacobi SVD of a given 2x2 matrix, returns U,S; where A=U*S*V.
U and V are unitary, and S is a diagonal matrix. Where s_i >= 0, and s_i >= s_i+1
InputMatrix | The matrix where perform the SVD |
UMatrix | The unitary U matrix |
SMatrix | The diagonal S matrix |
VMatrix | The unitary V matrix |
|
inlinestatic |
This function gives the Jacobi SVD of a given 2x2 matrix, returns U,S; where A=U*S*V U and V are unitary, and S is a diagonal matrix. Where s_i >= 0, and s_i >= s_i+1
InputMatrix | The matrix where perform the SVD |
UMatrix | The unitary U matrix |
SMatrix | The diagonal S matrix |
VMatrix | The unitary V matrix |
|
inlinestatic |
This method computes the condition number using the SVD.
The condition number can be estimated as the ratio between the largest singular value and the smallest singular value
InputMatrix | The matrix to be evaluated |
Tolerance | The tolerance considered |
|
staticconstexpr |
Definition of epsilon zero tolerance.