PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
Loading...
Searching...
No Matches
pbat::math::LinearOperator< TLinearOperators > Class Template Reference

Zero-overhead composite type satisfying the CLinearOperator concept. More...

#include <LinearOperator.h>

Inheritance diagram for pbat::math::LinearOperator< TLinearOperators >:

Public Types

enum  {
  ColsAtCompileTime = Eigen::Dynamic , MaxColsAtCompileTime = Eigen::Dynamic , RowsAtCompileTime = Eigen::Dynamic , MaxRowsAtCompileTime = Eigen::Dynamic ,
  IsRowMajor = false
}
 
using SelfType = LinearOperator<TLinearOperators...>
 Instance type.
 
using BaseType = Eigen::EigenBase<SelfType>
 EigenBase type.
 
using Scalar = pbat::Scalar
 Eigen typedef.
 
using RealScalar = pbat::Scalar
 Eigen typedef.
 
using StorageIndex = typename CSCMatrix::StorageIndex
 Eigen typedef.
 
using NestedExpression = SelfType
 Eigen typedef.
 

Public Member Functions

 LinearOperator (TLinearOperators const &... inOps)
 Construct a new Linear Operator object from a list of linear operators.
 
SelfTypeoperator= (SelfType const &)=delete
 
template<class TDerivedIn, class TDerivedOut>
void Apply (Eigen::MatrixBase< TDerivedIn > const &x, Eigen::DenseBase< TDerivedOut > &y) const
 Applies all linear operators on x, adding result to y.
 
CSCMatrix ToMatrix () const
 Construct the matrix of all underlying matrices obtained by Lops.
 
pbat::Index OutputDimensions () const
 Number of rows.
 
pbat::Index InputDimensions () const
 Number of columns.
 
BaseType::Index rows () const
 Number of rows (Eigen compatibility)
 
BaseType::Index cols () const
 Number of columns (Eigen compatibility)
 
template<class Rhs>
Eigen::Product< SelfType, Rhs, Eigen::AliasFreeProduct > operator* (Eigen::MatrixBase< Rhs > const &x) const
 Lazily left-multiply x by this linear operator.
 

Detailed Description

template<CLinearOperator... TLinearOperators>
class pbat::math::LinearOperator< TLinearOperators >

Zero-overhead composite type satisfying the CLinearOperator concept.

Provides interoperability with the Eigen API, i.e. can be used in product expression, and is usable in any IterativeLinearSolver (with suitable preconditioner, i.e. the preconditioner should not be constructible by analyzing matrix coefficients, since LinearOperator does not require storing any matrix).

Refer to LinearOperator.cpp for usage examples.

Template Parameters
...TLinearOperatorsList of linear operators to be composed ordered from left to right.

Constructor & Destructor Documentation

◆ LinearOperator()

template<CLinearOperator... TLinearOperators>
pbat::math::LinearOperator< TLinearOperators >::LinearOperator ( TLinearOperators const &... inOps)
inline

Construct a new Linear Operator object from a list of linear operators.

Parameters
inOpsList of linear operators to be composed ordered from left to right.
Note
Given linear operators' lifetimes must exceed the lifetime of this LinearOperator object.

Member Function Documentation

◆ Apply()

template<CLinearOperator... TLinearOperators>
template<class TDerivedIn, class TDerivedOut>
void pbat::math::LinearOperator< TLinearOperators >::Apply ( Eigen::MatrixBase< TDerivedIn > const & x,
Eigen::DenseBase< TDerivedOut > & y ) const
inline

Applies all linear operators on x, adding result to y.

Template Parameters
TDerivedInEigen matrix expression.
TDerivedOutWriteable Eigen matrix expression.
Parameters
xInput vector or matrix.
yOutput vector or matrix.
Precondition
x.rows() == InputDimensions() and y.rows() == OutputDimensions()

◆ cols()

template<CLinearOperator... TLinearOperators>
BaseType::Index pbat::math::LinearOperator< TLinearOperators >::cols ( ) const
inline

Number of columns (Eigen compatibility)

Returns
Number of columns

◆ InputDimensions()

template<CLinearOperator... TLinearOperators>
Index pbat::math::LinearOperator< TLinearOperators >::InputDimensions ( ) const
inline

Number of columns.

Returns
Number of columns

◆ operator*()

template<CLinearOperator... TLinearOperators>
template<class Rhs>
Eigen::Product< SelfType, Rhs, Eigen::AliasFreeProduct > pbat::math::LinearOperator< TLinearOperators >::operator* ( Eigen::MatrixBase< Rhs > const & x) const
inline

Lazily left-multiply x by this linear operator.

Template Parameters
RhsRight-hand side matrix or vector expression
Parameters
xRight-hand side matrix or vector
Returns
Eigen expression of the product of this linear operator and x.

◆ OutputDimensions()

template<CLinearOperator... TLinearOperators>
Index pbat::math::LinearOperator< TLinearOperators >::OutputDimensions ( ) const
inline

Number of rows.

Returns
Number of rows

◆ rows()

template<CLinearOperator... TLinearOperators>
BaseType::Index pbat::math::LinearOperator< TLinearOperators >::rows ( ) const
inline

Number of rows (Eigen compatibility)

Returns
Number of rows

◆ ToMatrix()

template<CLinearOperator... TLinearOperators>
CSCMatrix pbat::math::LinearOperator< TLinearOperators >::ToMatrix ( ) const
inline

Construct the matrix of all underlying matrices obtained by Lops.

Returns
The compressed sparse column matrix representation of the linear operator.

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