Loading...
Searching...
No Matches
EigenFunctions Namespace Reference

Namespace to perform operation on Eigen objects. More...

Functions

void sortEigenvalues (Eigen::VectorXd &eigenvalues, Eigen::MatrixXd &eigenvectors)
 sort eigenvalues
Eigen::VectorXd ExpSpaced (double first, double last, int n)
 Returns exponentially spaced vector.
template<typename T>
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > vectorTensorProduct (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &g, const Eigen::Tensor< T, 3 > &c, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &a)
 A function that computes the product of g.T c a, where c is a third dim tensor.
template Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > vectorTensorProduct (const Eigen::Matrix< double, Eigen::Dynamic, 1 > &g, const Eigen::Tensor< double, 3 > &c, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &a)
template Eigen::Matrix< int, Eigen::Dynamic, Eigen::Dynamic > vectorTensorProduct (const Eigen::Matrix< int, Eigen::Dynamic, 1 > &g, const Eigen::Tensor< int, 3 > &c, const Eigen::Matrix< int, Eigen::Dynamic, 1 > &a)
template Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic > vectorTensorProduct (const Eigen::Matrix< float, Eigen::Dynamic, 1 > &g, const Eigen::Tensor< float, 3 > &c, const Eigen::Matrix< float, Eigen::Dynamic, 1 > &a)
Eigen::VectorXd repeatElements (Eigen::VectorXd input, int n)
 Repeat each element n times after themselves.
Eigen::VectorXd reorderVectorFromDim (Eigen::VectorXd input, int dim)
 Changes the order of the vector's elements given a dimension.
template<typename T>
Eigen::SparseMatrix< T > vectorize (Eigen::SparseMatrix< T > &Matrix)
 Vectorize a Sparse Matrix.
template<typename T>
max (Eigen::SparseMatrix< T > &mat, label &ind_row, label &ind_col)
 Find the maximum of a sparse Matrix (Useful for DEIM).
template<typename T>
min (Eigen::SparseMatrix< T > &mat, label &ind_row, label &ind_col)
 Find the minimum of a sparse Matrix (Useful for DEIM).
template<typename T>
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > innerProduct (List< Eigen::SparseMatrix< T > > &A, List< Eigen::SparseMatrix< T > > &B)
 Perform Frobenius inner Product between two list of sparse matrices A and B.
template<typename T>
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > innerProduct (List< Eigen::SparseMatrix< T > > &A, Eigen::SparseMatrix< T > &B)
 Perform Frobenius inner Product between a list of sparse matrices A and a sparse matrix B.
template<typename T>
innerProduct (Eigen::SparseMatrix< T > &A, Eigen::SparseMatrix< T > &B)
 Perform Frobenius inner Product between two sparse matrices A and B.
template<typename T>
Eigen::SparseMatrix< T > MVproduct (List< Eigen::SparseMatrix< T > > &A, Eigen::DenseBase< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > > &C)
 Sparse Matrix-Vector product between a list of sparse matrices and a vector of coefficients.
template<typename T>
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > MVproduct (const std::vector< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > > &A, Eigen::DenseBase< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > > &C)
 Dense Matrix-Vector product between a list of sparse matrices and a vector of coefficients.
template<typename T>
List< Eigen::SparseMatrix< T > > MMproduct (List< Eigen::SparseMatrix< T > > &A, Eigen::DenseBase< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > > &C)
 Sparse Matrix - Dense Matrix product between a list of sparse matrices and a dense matrix.
template<typename T>
condNumber (Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &A)
 Conditioning number of a dense matrix.

Detailed Description

Namespace to perform operation on Eigen objects.

Function Documentation

◆ condNumber()

template<typename T>
T EigenFunctions::condNumber ( Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & A)

Conditioning number of a dense matrix.

Parameters
[in]Ainput Matrix
Template Parameters
Ttype of object, i.e. double, float, ....
Returns
Conditioning number

Definition at line 451 of file EigenFunctions.H.

◆ ExpSpaced()

Eigen::VectorXd EigenFunctions::ExpSpaced ( double first,
double last,
int n )

Returns exponentially spaced vector.

Parameters
[in]firstFirst element of the vector
[in]lastLast element of the vector
[in]nNumber of elements
Template Parameters
Ttype of object, i.e. double, float, ....
Returns
Exponentially spaced vector

Definition at line 72 of file EigenFunctions.C.

◆ innerProduct() [1/3]

template<typename T>
T EigenFunctions::innerProduct ( Eigen::SparseMatrix< T > & A,
Eigen::SparseMatrix< T > & B )

Perform Frobenius inner Product between two sparse matrices A and B.

\[out = tr(\mathbf{A}^T \mathbf{B} ) \]

Parameters
[in]ASparse Matrix A
[in]BSparse Matrix B
Template Parameters
Ttype of object, i.e. double, float, ....
Returns
out Value of the inner products between the two matrices

Definition at line 385 of file EigenFunctions.H.

◆ innerProduct() [2/3]

template<typename T>
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > EigenFunctions::innerProduct ( List< Eigen::SparseMatrix< T > > & A,
Eigen::SparseMatrix< T > & B )

Perform Frobenius inner Product between a list of sparse matrices A and a sparse matrix B.

\[\mathbf{A} = [\mathbf{A_1}, \dots, \mathbf{A_N}] , out_i = tr(\mathbf{A_i}^T \mathbf{B} ) \]

Parameters
[in]AList of Matrices A
[in]BSparse Matrix B
Template Parameters
Ttype of object, i.e. double, float, ....
Returns
out Vector containing the inner products between the matrix lists

Definition at line 368 of file EigenFunctions.H.

◆ innerProduct() [3/3]

template<typename T>
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > EigenFunctions::innerProduct ( List< Eigen::SparseMatrix< T > > & A,
List< Eigen::SparseMatrix< T > > & B )

Perform Frobenius inner Product between two list of sparse matrices A and B.

\[ \mathbf{A} = [\mathbf{A_1}, \dots, \mathbf{A_N}] , \mathbf{B} = [\mathbf{B_1}, \dots, \mathbf{B_M}] , out_{ij} = tr(\mathbf{A_i}^T \mathbf{B_j} ) \]

Parameters
[in]AList of Matrices A
[in]BList of Matrices B
Template Parameters
Ttype of object, i.e. double, float, ....
Returns
out Matrix containing the inner products between the matrix lists

Definition at line 348 of file EigenFunctions.H.

◆ max()

template<typename T>
T EigenFunctions::max ( Eigen::SparseMatrix< T > & mat,
label & ind_row,
label & ind_col )

Find the maximum of a sparse Matrix (Useful for DEIM).

Parameters
[out]matThe matrix
[out]ind_rowThe ind row
[out]ind_colThe ind col
Template Parameters
Ttype of object, i.e. double, float, ....
Returns
the maximum

Definition at line 300 of file EigenFunctions.H.

◆ min()

template<typename T>
T EigenFunctions::min ( Eigen::SparseMatrix< T > & mat,
label & ind_row,
label & ind_col )

Find the minimum of a sparse Matrix (Useful for DEIM).

Parameters
[out]matThe matrix
[out]ind_rowThe index for the row
[out]ind_colThe ind col
Template Parameters
Ttype of object, i.e. double, float, ....
Returns
the minimum

Definition at line 324 of file EigenFunctions.H.

◆ MMproduct()

template<typename T>
List< Eigen::SparseMatrix< T > > EigenFunctions::MMproduct ( List< Eigen::SparseMatrix< T > > & A,
Eigen::DenseBase< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > > & C )

Sparse Matrix - Dense Matrix product between a list of sparse matrices and a dense matrix.

\[ \mathbf{A} = [\mathbf{A_1}, \dots, \mathbf{A_N}] , \mathbf{C} = [\mathbf{c_{\bullet 1}}, ...., \mathbf{c_{\bullet N}}], \mathbf{out} = [\mathbf{O_1},\dots,\mathbf{O_N}] \]

\[ \mathbf{O_i} = \sum_{k=1}^N \mathbf{A_k} c_{ki} \]

Parameters
[in]AList of sparse Matrices
[in]CDense Matrix
Template Parameters
Ttype of object, i.e. double, float, ....
Returns
List of Sparse Matrices containing the sum of all the matrices multiplied by the matrix coefficients by columns

Definition at line 433 of file EigenFunctions.H.

◆ MVproduct() [1/2]

template<typename T>
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > EigenFunctions::MVproduct ( const std::vector< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > > & A,
Eigen::DenseBase< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > > & C )

Dense Matrix-Vector product between a list of sparse matrices and a vector of coefficients.

\[ \mathbf{A} = [\mathbf{A_1}, \dots, \mathbf{A_N}] , \mathbf{c} = [c_1, ...., c_N] \]

\[ \mathbf{out} = \sum_{k=1}^N \mathbf{A_k} c_k \]

Parameters
[in]ADense Matrix A
[in]CDense Vector C
Template Parameters
Ttype of object, i.e. double, float, ....
Returns
Dense Matrix containing the sum of all the matrices multiplied by the vector coefficients

Definition at line 415 of file EigenFunctions.H.

◆ MVproduct() [2/2]

template<typename T>
Eigen::SparseMatrix< T > EigenFunctions::MVproduct ( List< Eigen::SparseMatrix< T > > & A,
Eigen::DenseBase< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > > & C )

Sparse Matrix-Vector product between a list of sparse matrices and a vector of coefficients.

\[ \mathbf{A} = [\mathbf{A_1}, \dots, \mathbf{A_N}] , \mathbf{c} = [c_1, ...., c_N] \]

\[ \mathbf{out} = \sum_{k=1}^N \mathbf{A_k} c_k \]

Parameters
[in]ASparse Matrix A
[in]CDense Vector C
Template Parameters
Ttype of object, i.e. double, float, ....
Returns
out Sparse Matrix containing the sum of all the matrices multiplied by the vector coefficients

Definition at line 399 of file EigenFunctions.H.

◆ reorderVectorFromDim()

Eigen::VectorXd EigenFunctions::reorderVectorFromDim ( Eigen::VectorXd input,
int dim )

Changes the order of the vector's elements given a dimension.

Example: input = (a_1, b_1, a_2, b_2, a_3, b_3); dim = 3 output = (a_1, a_2, a_3, b_1, b_2, b_3) Typically switch from a component then coordinate order to the opposite as did the change in the Foam2Eigen mapping

Parameters
inputEigen::VectorXd
dimint

Definition at line 146 of file EigenFunctions.C.

◆ repeatElements()

Eigen::VectorXd EigenFunctions::repeatElements ( Eigen::VectorXd input,
int n )

Repeat each element n times after themselves.

Example: input = (a, b); n = 3 output = (a, a, a, b, b, b)

Parameters
inputEigen::VectorXd
nint

Definition at line 125 of file EigenFunctions.C.

◆ sortEigenvalues()

void EigenFunctions::sortEigenvalues ( Eigen::VectorXd & eigenvalues,
Eigen::MatrixXd & eigenvectors )

sort eigenvalues

Parameters
[in,out]eigenvaluesThe eigenvalues
[in,out]eigenvectorsThe eigenvectors

Definition at line 39 of file EigenFunctions.C.

◆ vectorize()

template<typename T>
Eigen::SparseMatrix< T > EigenFunctions::vectorize ( Eigen::SparseMatrix< T > & Matrix)

Vectorize a Sparse Matrix.

Parameters
[in]MatrixThe matrix
Template Parameters
Ttype of object, i.e. double, float, ....
Returns
The Sparse Vector

Definition at line 278 of file EigenFunctions.H.

◆ vectorTensorProduct()

template<typename T>
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > EigenFunctions::vectorTensorProduct ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > & g,
const Eigen::Tensor< T, 3 > & c,
const Eigen::Matrix< T, Eigen::Dynamic, 1 > & a )

A function that computes the product of g.T c a, where c is a third dim tensor.

Parameters
[in]gThe first vector
[in]cThe three dim tensor
[in]aThe second vector
Returns
The vector which corresponds to the product g.T c a

Definition at line 89 of file EigenFunctions.C.