CoDiPack  2.2.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
codi::SparseEigenLinearSystem< T_Type, T_Matrix, T_Vector > Struct Template Reference

#include <eigenLinearSystem.hpp>

Inheritance diagram for codi::SparseEigenLinearSystem< T_Type, T_Matrix, T_Vector >:

Public Types

using Identifier = typename Type::Identifier
 See LhsExpressionInterface.
 
using Index = typename Matrix::Index
 Index of an Eigen matrix.
 
using InterfaceTypes = EigenLinearSystemTypes<T_Type, T_Matrix, T_Vector>
 See LinearSystemInterface.
 
using Matrix = typename InterfaceTypes::Matrix
 See LinearSystemInterfaceTypes.
 
using MatrixIdentifier = typename InterfaceTypes::MatrixIdentifier
 See LinearSystemInterfaceTypes.
 
using MatrixReal = typename InterfaceTypes::MatrixReal
 See LinearSystemInterfaceTypes.
 
using Real = typename Type::Real
 See LhsExpressionInterface.
 
using Type = typename InterfaceTypes::Type
 See LinearSystemInterfaceTypes.
 
using Vector = typename InterfaceTypes::Vector
 See LinearSystemInterfaceTypes.
 
using VectorIdentifier = typename InterfaceTypes::VectorIdentifier
 See LinearSystemInterfaceTypes.
 
using VectorReal = typename InterfaceTypes::VectorReal
 See LinearSystemInterfaceTypes.
 
- Public Types inherited from codi::EigenLinearSystem< T_Type, T_Matrix, T_Vector >
using Index = typename Matrix::Index
 Index of an Eigen matrix.
 
using InterfaceTypes = EigenLinearSystemTypes<T_Type, T_Matrix, T_Vector>
 See LinearSystemInterface.
 
using Matrix = typename InterfaceTypes::Matrix
 See LinearSystemInterfaceTypes.
 
using MatrixIdentifier = typename InterfaceTypes::MatrixIdentifier
 See LinearSystemInterfaceTypes.
 
using MatrixReal = typename InterfaceTypes::MatrixReal
 See LinearSystemInterfaceTypes.
 
using Type = typename InterfaceTypes::Type
 See LinearSystemInterfaceTypes.
 
using Vector = typename InterfaceTypes::Vector
 See LinearSystemInterfaceTypes.
 
using VectorIdentifier = typename InterfaceTypes::VectorIdentifier
 See LinearSystemInterfaceTypes.
 
using VectorReal = typename InterfaceTypes::VectorReal
 See LinearSystemInterfaceTypes.
 
- Public Types inherited from codi::LinearSystemInterface< EigenLinearSystemTypes< T_Type, T_Matrix, T_Vector > >
using InterfaceTypes
 See LinearSystemInterface.
 
using Matrix
 See LinearSystemInterfaceTypes.
 
using MatrixIdentifier
 See LinearSystemInterfaceTypes.
 
using MatrixReal
 See LinearSystemInterfaceTypes.
 
using Type
 See LinearSystemInterfaceTypes.
 
using Vector
 See LinearSystemInterfaceTypes.
 
using VectorIdentifier
 See LinearSystemInterfaceTypes.
 
using VectorReal
 See LinearSystemInterfaceTypes.
 

Public Member Functions

Mandatory: Implementations for matrix and vector creation and deletion.
template<typename M >
MatrixRealcreateMatrixReal (M *mat)
 
template<typename M >
MatrixIdentifiercreateMatrixIdentifier (M *mat)
 
Mandatory: Implementations for matrix and vector iterations.
template<typename Func , typename MatrixA , typename MatrixB >
void iterateMatrix (Func func, MatrixA *matA, MatrixB *matB)
 Iterate over all elements in the matrices at the same time.
 
template<typename Func , typename MatrixA , typename MatrixB , typename MatrixC >
void iterateMatrix (Func func, MatrixA *matA, MatrixB *matB, MatrixC *matC)
 Iterate over all elements in the matrices at the same time.
 
Implementation for reverse mode AD.
template<typename Func >
void iterateDyadic (Func func, MatrixIdentifier *mat_id, VectorReal *x_v, VectorReal *b_b)
 
- Public Member Functions inherited from codi::EigenLinearSystem< T_Type, T_Matrix, T_Vector >
template<typename M >
MatrixRealcreateMatrixReal (M *mat)
 
template<typename M >
MatrixIdentifiercreateMatrixIdentifier (M *mat)
 
template<typename V >
VectorRealcreateVectorReal (V *vec)
 
template<typename V >
VectorIdentifiercreateVectorIdentifier (V *vec)
 
void deleteMatrixReal (MatrixReal *A_v)
 Delete a real matrix.
 
void deleteMatrixIdentifier (MatrixIdentifier *A_id)
 Delete an identifier matrix.
 
void deleteVectorReal (VectorReal *vec_v)
 Delete a real Vector.
 
void deleteVectorIdentifier (VectorIdentifier *vec_id)
 Delete an identifier vector.
 
template<typename Func , typename MatrixA , typename MatrixB >
void iterateMatrix (Func func, MatrixA *matA, MatrixB *matB)
 Iterate over all elements in the matrices at the same time.
 
template<typename Func , typename MatrixA , typename MatrixB , typename MatrixC >
void iterateMatrix (Func func, MatrixA *matA, MatrixB *matB, MatrixC *matC)
 Iterate over all elements in the matrices at the same time.
 
template<typename Func , typename VectorA , typename VectorB >
void iterateVector (Func func, VectorA *vecA, VectorB *vecB)
 Iterate over all elements in the vectors at the same time.
 
template<typename Func , typename VectorA , typename VectorB , typename VectorC >
void iterateVector (Func func, VectorA *vecA, VectorB *vecB, VectorC *vecC)
 Iterate over all elements in the vectors at the same time.
 
template<typename Func , typename VectorA , typename VectorB , typename VectorC , typename VectorD >
void iterateVector (Func func, VectorA *vecA, VectorB *vecB, VectorC *vecC, VectorD *vecD)
 Iterate over all elements in the vectors at the same time.
 
void solveSystem (MatrixReal const *A, VectorReal const *b, VectorReal *x)
 
Needs to be implemented by the user.
 
MatrixRealtransposeMatrix (MatrixReal *A_v)
 Create a transposed matrix.
 
template<typename Func >
void iterateDyadic (Func func, MatrixIdentifier *mat_id, VectorReal *x_v, VectorReal *b_b)
 
void subtractMultiply (VectorReal *t, VectorReal const *b_d, MatrixReal const *A_d, VectorReal const *x)
 Computes t = b_d - A_d * x.
 
- Public Member Functions inherited from codi::LinearSystemInterface< EigenLinearSystemTypes< T_Type, T_Matrix, T_Vector > >
MatrixRealcreateMatrixReal (M *mat)
 
MatrixIdentifiercreateMatrixIdentifier (M *mat)
 
VectorRealcreateVectorReal (V *vec)
 
VectorIdentifiercreateVectorIdentifier (V *vec)
 
void deleteMatrixReal (MatrixReal *A_v)
 Delete a real matrix.
 
void deleteMatrixIdentifier (MatrixIdentifier *A_id)
 Delete an identifier matrix.
 
void deleteVectorReal (VectorReal *vec_v)
 Delete a real Vector.
 
void deleteVectorIdentifier (VectorIdentifier *vec_id)
 Delete an identifier vector.
 
void iterateMatrix (Func func, MatrixA *matA, MatrixB *matB)
 Iterate over all elements in the matrices at the same time.
 
void iterateMatrix (Func func, MatrixA *matA, MatrixB *matB, MatrixC *matC)
 Iterate over all elements in the matrices at the same time.
 
void iterateVector (Func func, VectorA *vecA, VectorB *vecB)
 Iterate over all elements in the vectors at the same time.
 
void iterateVector (Func func, VectorA *vecA, VectorB *vecB, VectorC *vecC)
 Iterate over all elements in the vectors at the same time.
 
void iterateVector (Func func, VectorA *vecA, VectorB *vecB, VectorC *vecC, VectorD *vecD)
 Iterate over all elements in the vectors at the same time.
 
void solveSystem (MatrixReal const *A, VectorReal const *b, VectorReal *x)
 
void iterateDyadic (Func func, MatrixIdentifier *mat_id, VectorReal *x_v, VectorReal *b_b)
 
MatrixRealtransposeMatrix (MatrixReal *A_v)
 Create a transposed matrix.
 
void subtractMultiply (VectorReal *t, VectorReal const *b_d, MatrixReal const *A_d, VectorReal const *x)
 Computes t = b_d - A_d * x.
 
void solveSystemPrimal (MatrixReal const *A, VectorReal const *b, VectorReal *x)
 

Detailed Description

template<typename T_Type, template< typename > class T_Matrix, template< typename > class T_Vector>
struct codi::SparseEigenLinearSystem< T_Type, T_Matrix, T_Vector >

Eigen implementation of LinearSystemInterface for sparse matrices. The only methods missing are solveSystem and solveSystemPrimal (optional). TODO: Link example

Member Function Documentation

◆ createMatrixIdentifier()

template<typename T_Type , template< typename > class T_Matrix, template< typename > class T_Vector>
template<typename M >
MatrixIdentifier * codi::SparseEigenLinearSystem< T_Type, T_Matrix, T_Vector >::createMatrixIdentifier ( M * mat)
inline

Create an identifier matrix from an existing one. Values do not need to be copied.

Template Parameters
MM is either Matrix or MatrixIdentifier.

◆ createMatrixReal()

template<typename T_Type , template< typename > class T_Matrix, template< typename > class T_Vector>
template<typename M >
MatrixReal * codi::SparseEigenLinearSystem< T_Type, T_Matrix, T_Vector >::createMatrixReal ( M * mat)
inline

Create a real matrix from an existing one. Values do not need to be copied.

Template Parameters
MM is either Matrix or MatrixIdentifier.

◆ iterateDyadic()

template<typename T_Type , template< typename > class T_Matrix, template< typename > class T_Vector>
template<typename Func >
void codi::SparseEigenLinearSystem< T_Type, T_Matrix, T_Vector >::iterateDyadic ( Func func,
MatrixIdentifier * mat_id,
VectorReal * x_v,
VectorReal * b_b )
inline

Iterate over all elements in mat_id and provide the elements in b_b and x_v . For element (i,j) func needs to be called with func(mat_id(i,j), b_b(i), x_v(j)) . For sparse matrices, only the elements of the sparsity pattern need to be considered. Used for e.g. the computation of the dyadic product $A=x_v*b_b^T$.

◆ iterateMatrix() [1/2]

template<typename T_Type , template< typename > class T_Matrix, template< typename > class T_Vector>
template<typename Func , typename MatrixA , typename MatrixB >
void codi::SparseEigenLinearSystem< T_Type, T_Matrix, T_Vector >::iterateMatrix ( Func func,
MatrixA * matA,
MatrixB * matB )
inline

Iterate over all elements in the matrices at the same time.

◆ iterateMatrix() [2/2]

template<typename T_Type , template< typename > class T_Matrix, template< typename > class T_Vector>
template<typename Func , typename MatrixA , typename MatrixB , typename MatrixC >
void codi::SparseEigenLinearSystem< T_Type, T_Matrix, T_Vector >::iterateMatrix ( Func func,
MatrixA * matA,
MatrixB * matB,
MatrixC * matC )
inline

Iterate over all elements in the matrices at the same time.


The documentation for this struct was generated from the following file: