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

#include <eigenLinearSystem.hpp>

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

Public Types

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)
 
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.
 
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.
 
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.
 
Mandatory: Implementations for the linear system solve.
void solveSystem (MatrixReal const *A, VectorReal const *b, VectorReal *x)
 
Needs to be implemented by the user.
 
Implementation for reverse mode AD.
MatrixRealtransposeMatrix (MatrixReal *A_v)
 Create a transposed matrix.
 
template<typename Func >
void iterateDyadic (Func func, MatrixIdentifier *mat_id, VectorReal *x_v, VectorReal *b_b)
 
Implementation for forward mode AD.
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::EigenLinearSystem< T_Type, T_Matrix, T_Vector >

Eigen implementation of LinearSystemInterface. 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::EigenLinearSystem< 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::EigenLinearSystem< 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.

◆ createVectorIdentifier()

template<typename T_Type , template< typename > class T_Matrix, template< typename > class T_Vector>
template<typename V >
VectorIdentifier * codi::EigenLinearSystem< T_Type, T_Matrix, T_Vector >::createVectorIdentifier ( V * vec)
inline

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

Template Parameters
VV is either Vector or VectorIdentifier.

◆ createVectorReal()

template<typename T_Type , template< typename > class T_Matrix, template< typename > class T_Vector>
template<typename V >
VectorReal * codi::EigenLinearSystem< T_Type, T_Matrix, T_Vector >::createVectorReal ( V * vec)
inline

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

Template Parameters
VV is either Vector or VectorIdentifier.

◆ deleteMatrixIdentifier()

template<typename T_Type , template< typename > class T_Matrix, template< typename > class T_Vector>
void codi::EigenLinearSystem< T_Type, T_Matrix, T_Vector >::deleteMatrixIdentifier ( MatrixIdentifier * A_id)
inline

Delete an identifier matrix.

◆ deleteMatrixReal()

template<typename T_Type , template< typename > class T_Matrix, template< typename > class T_Vector>
void codi::EigenLinearSystem< T_Type, T_Matrix, T_Vector >::deleteMatrixReal ( MatrixReal * A_v)
inline

Delete a real matrix.

◆ deleteVectorIdentifier()

template<typename T_Type , template< typename > class T_Matrix, template< typename > class T_Vector>
void codi::EigenLinearSystem< T_Type, T_Matrix, T_Vector >::deleteVectorIdentifier ( VectorIdentifier * vec_id)
inline

Delete an identifier vector.

◆ deleteVectorReal()

template<typename T_Type , template< typename > class T_Matrix, template< typename > class T_Vector>
void codi::EigenLinearSystem< T_Type, T_Matrix, T_Vector >::deleteVectorReal ( VectorReal * vec_v)
inline

Delete a real Vector.

◆ iterateDyadic()

template<typename T_Type , template< typename > class T_Matrix, template< typename > class T_Vector>
template<typename Func >
void codi::EigenLinearSystem< 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::EigenLinearSystem< 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::EigenLinearSystem< 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.

◆ iterateVector() [1/3]

template<typename T_Type , template< typename > class T_Matrix, template< typename > class T_Vector>
template<typename Func , typename VectorA , typename VectorB >
void codi::EigenLinearSystem< T_Type, T_Matrix, T_Vector >::iterateVector ( Func func,
VectorA * vecA,
VectorB * vecB )
inline

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

◆ iterateVector() [2/3]

template<typename T_Type , template< typename > class T_Matrix, template< typename > class T_Vector>
template<typename Func , typename VectorA , typename VectorB , typename VectorC >
void codi::EigenLinearSystem< T_Type, T_Matrix, T_Vector >::iterateVector ( Func func,
VectorA * vecA,
VectorB * vecB,
VectorC * vecC )
inline

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

◆ iterateVector() [3/3]

template<typename T_Type , template< typename > class T_Matrix, template< typename > class T_Vector>
template<typename Func , typename VectorA , typename VectorB , typename VectorC , typename VectorD >
void codi::EigenLinearSystem< T_Type, T_Matrix, T_Vector >::iterateVector ( Func func,
VectorA * vecA,
VectorB * vecB,
VectorC * vecC,
VectorD * vecD )
inline

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

◆ solveSystem()

template<typename T_Type , template< typename > class T_Matrix, template< typename > class T_Vector>
void codi::EigenLinearSystem< T_Type, T_Matrix, T_Vector >::solveSystem ( MatrixReal const * A,
VectorReal const * b,
VectorReal * x )


Needs to be implemented by the user.

Solve the linear system with the real valued matrices and vectors. Solves Ax = b for x.
Needs to be implemented by the user.

◆ subtractMultiply()

template<typename T_Type , template< typename > class T_Matrix, template< typename > class T_Vector>
void codi::EigenLinearSystem< T_Type, T_Matrix, T_Vector >::subtractMultiply ( VectorReal * t,
VectorReal const * b_d,
MatrixReal const * A_d,
VectorReal const * x )
inline

Computes t = b_d - A_d * x.

◆ transposeMatrix()

template<typename T_Type , template< typename > class T_Matrix, template< typename > class T_Vector>
MatrixReal * codi::EigenLinearSystem< T_Type, T_Matrix, T_Vector >::transposeMatrix ( MatrixReal * A_v)
inline

Create a transposed matrix.


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