All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | List of all members
SurgSim::Math::LinearSolveAndInverseTriDiagonalBlockMatrix< BlockSize > Class Template Reference

Derivation for tri-diagonal block matrix type. More...

#include <SurgSim/Math/LinearSolveAndInverse.h>

Inheritance diagram for SurgSim::Math::LinearSolveAndInverseTriDiagonalBlockMatrix< BlockSize >:
Inheritance graph
[legend]
Collaboration diagram for SurgSim::Math::LinearSolveAndInverseTriDiagonalBlockMatrix< BlockSize >:
Collaboration graph
[legend]

Public Member Functions

virtual void operator() (const Matrix &A, const Vector &b, Vector *x=nullptr, Matrix *Ainv=nullptr) override
 Solve a linear system A.x=b and compute the matrix A^-1. More...
 
- Public Member Functions inherited from SurgSim::Math::LinearSolveAndInverse
virtual ~LinearSolveAndInverse ()
 

Protected Member Functions

void inverseTriDiagonalBlock (const SurgSim::Math::Matrix &A, SurgSim::Math::Matrix *inv, bool isSymmetric=false)
 Computes the inverse matrix. More...
 

Protected Attributes

Matrix m_inverse
 Member variable to hold the inverse matrix in case only the solving is requested. More...
 

Private Types

typedef Eigen::Matrix
< Matrix::Scalar, BlockSize,
BlockSize, Matrix::Options > 
Block
 

Private Member Functions

const Eigen::Block< const
Matrix, BlockSize, BlockSize > 
minusAi (const SurgSim::Math::Matrix &A, size_t i) const
 Gets a lower-diagonal block element (named -Ai in the algorithm) More...
 
const Eigen::Block< const
Matrix, BlockSize, BlockSize > 
Bi (const SurgSim::Math::Matrix &A, size_t i) const
 Gets a diagonal block element (named Bi in the algorithm) More...
 
const Eigen::Block< const
Matrix, BlockSize, BlockSize > 
minusCi (const SurgSim::Math::Matrix &A, size_t i) const
 Gets a upper-diagonal block element (named -Ci in the algorithm) More...
 

Private Attributes

std::vector< Blockm_Di
 
std::vector< Blockm_Ei
 
std::vector< Blockm_Bi_AiDiminus1_inv
 

Detailed Description

template<int BlockSize>
class SurgSim::Math::LinearSolveAndInverseTriDiagonalBlockMatrix< BlockSize >

Derivation for tri-diagonal block matrix type.

Template Parameters
BlockSizeDefine the block size of the tri-diagonal block matrix

Member Typedef Documentation

template<int BlockSize>
typedef Eigen::Matrix<Matrix::Scalar, BlockSize, BlockSize, Matrix::Options> SurgSim::Math::LinearSolveAndInverseTriDiagonalBlockMatrix< BlockSize >::Block
private

Member Function Documentation

template<int BlockSize>
const Eigen::Block< const Matrix, BlockSize, BlockSize > SurgSim::Math::LinearSolveAndInverseTriDiagonalBlockMatrix< BlockSize >::Bi ( const SurgSim::Math::Matrix A,
size_t  i 
) const
private

Gets a diagonal block element (named Bi in the algorithm)

Parameters
AThe matrix on which to retrieve the diagonal block element
iThe line index on which to retrieve the diagonal block element
Returns
The diagonal block element requested (i.e. block (i, i))
template<int BlockSize>
void SurgSim::Math::LinearSolveAndInverseTriDiagonalBlockMatrix< BlockSize >::inverseTriDiagonalBlock ( const SurgSim::Math::Matrix A,
SurgSim::Math::Matrix inv,
bool  isSymmetric = false 
)
protected

Computes the inverse matrix.

Parameters
AThe matrix to inverse
[out]invThe inverse matrix
isSymmetricTrue if the matrix is symmetric, False otherwise
Note
isSymmetric is only indicative and helps optimizing the computation when the matrix is symmetric.
On the other side, if the flag is true and the matrix is not symmetric, the result will be wrong.
Assert on inverse matrix pointer (inv), on the matrix being square and on
proper size matching between the matrix size and the blockSize
template<int BlockSize>
const Eigen::Block< const Matrix, BlockSize, BlockSize > SurgSim::Math::LinearSolveAndInverseTriDiagonalBlockMatrix< BlockSize >::minusAi ( const SurgSim::Math::Matrix A,
size_t  i 
) const
private

Gets a lower-diagonal block element (named -Ai in the algorithm)

Parameters
AThe matrix on which to retrieve the lower-diagonal block element
iThe line index on which to retrieve the lower-diagonal block element
Returns
The lower-diagonal block element requested (i.e. block (i, i-1))
template<int BlockSize>
const Eigen::Block< const Matrix, BlockSize, BlockSize > SurgSim::Math::LinearSolveAndInverseTriDiagonalBlockMatrix< BlockSize >::minusCi ( const SurgSim::Math::Matrix A,
size_t  i 
) const
private

Gets a upper-diagonal block element (named -Ci in the algorithm)

Parameters
AThe matrix on which to retrieve the upper-diagonal block element
iThe line index on which to retrieve the upper-diagonal block element
Returns
The upper-diagonal block element requested (i.e. block (i, i+1))
template<int BlockSize>
void SurgSim::Math::LinearSolveAndInverseTriDiagonalBlockMatrix< BlockSize >::operator() ( const Matrix A,
const Vector b,
Vector x = nullptr,
Matrix Ainv = nullptr 
)
overridevirtual

Solve a linear system A.x=b and compute the matrix A^-1.

Parameters
ALinear system matrix
bLinear system right-hand-side
[out]xLinear system unknown (if requested)
[out]AinvLinear system matrix inverse = A^-1 (if requested)

Implements SurgSim::Math::LinearSolveAndInverse.

Reimplemented in SurgSim::Math::LinearSolveAndInverseSymmetricTriDiagonalBlockMatrix< BlockSize >.

Member Data Documentation

template<int BlockSize>
std::vector<Block> SurgSim::Math::LinearSolveAndInverseTriDiagonalBlockMatrix< BlockSize >::m_Bi_AiDiminus1_inv
private

Intermediate block matrices, helpful to construct the inverse matrix

template<int BlockSize>
std::vector<Block> SurgSim::Math::LinearSolveAndInverseTriDiagonalBlockMatrix< BlockSize >::m_Di
private

Intermediate block matrices, helpful to construct the inverse matrix

template<int BlockSize>
std::vector<Block> SurgSim::Math::LinearSolveAndInverseTriDiagonalBlockMatrix< BlockSize >::m_Ei
private

Intermediate block matrices, helpful to construct the inverse matrix

template<int BlockSize>
Matrix SurgSim::Math::LinearSolveAndInverseTriDiagonalBlockMatrix< BlockSize >::m_inverse
protected

Member variable to hold the inverse matrix in case only the solving is requested.


The documentation for this class was generated from the following files: