Chemical Data Processing Library C++ API - Version 1.4.0
Public Types | Public Member Functions | Friends | List of all members
CDPL::Math::TriangularAdapter< M, Tri > Class Template Reference

Matrix expression that exposes only the triangular part of an underlying matrix M selected by the policy Tri (Math::Lower, Math::UnitLower, Math::Upper or Math::UnitUpper). More...

#include <MatrixAdapter.hpp>

+ Inheritance diagram for CDPL::Math::TriangularAdapter< M, Tri >:

Public Types

typedef M MatrixType
 The wrapped matrix type. More...
 
typedef Tri TriangularType
 The triangular-view selection policy. More...
 
typedef M::SizeType SizeType
 The size type used by the underlying matrix. More...
 
typedef M::DifferenceType DifferenceType
 The signed difference type used by the underlying matrix. More...
 
typedef M::ValueType ValueType
 The element value type of the underlying matrix. More...
 
typedef M::ConstReference ConstReference
 Constant reference type to an element of the underlying matrix. More...
 
typedef std::conditional< std::is_const< M >::value, typename M::ConstReference, typename M::Reference >::type Reference
 Mutable reference type (degrades to ConstReference when the wrapped matrix is const). More...
 
typedef std::conditional< std::is_const< M >::value, typename M::ConstClosureType, typename M::ClosureType >::type MatrixClosureType
 Closure type used to store the wrapped matrix internally (mutable or const flavor). More...
 
typedef const SelfType ConstClosureType
 Constant closure type used when this adapter appears inside another expression. More...
 
typedef SelfType ClosureType
 Closure type used when this adapter appears inside another expression. More...
 
typedef Range< SizeTypeRangeType
 The Math::Range type used to address sub-ranges. More...
 
- Public Types inherited from CDPL::Math::MatrixExpression< TriangularAdapter< M, Tri > >
typedef TriangularAdapter< M, Tri > ExpressionType
 The derived matrix expression type. More...
 
- Public Types inherited from CDPL::Math::Expression< E >
typedef E ExpressionType
 The derived expression type (made available to expression-template machinery). More...
 

Public Member Functions

 TriangularAdapter (MatrixType &m)
 Constructs the adapter wrapping m. More...
 
ConstReference operator() (SizeType i, SizeType j) const
 Returns the value of element (i, j) as seen through the triangular policy (off-policy entries return the appropriate fill value: zero or one). More...
 
SizeType getSize1 () const
 Returns the number of rows of the wrapped matrix. More...
 
SizeType getSize2 () const
 Returns the number of columns of the wrapped matrix. More...
 
MatrixClosureTypegetData ()
 Returns a reference to the wrapped matrix (via its stored closure). More...
 
const MatrixClosureTypegetData () const
 Returns a const reference to the wrapped matrix (via its stored closure). More...
 
bool isEmpty () const
 Tells whether the wrapped matrix is empty (zero rows or zero columns). More...
 
- Public Member Functions inherited from CDPL::Math::MatrixExpression< TriangularAdapter< M, Tri > >
const ExpressionTypeoperator() () const
 Returns a const reference to the derived matrix expression. More...
 
ExpressionTypeoperator() ()
 Returns a reference to the derived matrix expression. More...
 

Friends

struct Lower
 
struct UnitLower
 
struct Upper
 
struct UnitUpper
 

Additional Inherited Members

- Protected Member Functions inherited from CDPL::Math::MatrixExpression< TriangularAdapter< M, Tri > >
 MatrixExpression ()
 
 ~MatrixExpression ()
 
- Protected Member Functions inherited from CDPL::Math::Expression< E >
 Expression ()
 
 ~Expression ()
 

Detailed Description

template<typename M, typename Tri>
class CDPL::Math::TriangularAdapter< M, Tri >

Matrix expression that exposes only the triangular part of an underlying matrix M selected by the policy Tri (Math::Lower, Math::UnitLower, Math::Upper or Math::UnitUpper).

Template Parameters
MThe wrapped matrix type.
TriThe triangular-view selection policy.

Member Typedef Documentation

◆ MatrixType

template<typename M , typename Tri >
typedef M CDPL::Math::TriangularAdapter< M, Tri >::MatrixType

The wrapped matrix type.

◆ TriangularType

template<typename M , typename Tri >
typedef Tri CDPL::Math::TriangularAdapter< M, Tri >::TriangularType

The triangular-view selection policy.

◆ SizeType

template<typename M , typename Tri >
typedef M::SizeType CDPL::Math::TriangularAdapter< M, Tri >::SizeType

The size type used by the underlying matrix.

◆ DifferenceType

template<typename M , typename Tri >
typedef M::DifferenceType CDPL::Math::TriangularAdapter< M, Tri >::DifferenceType

The signed difference type used by the underlying matrix.

◆ ValueType

template<typename M , typename Tri >
typedef M::ValueType CDPL::Math::TriangularAdapter< M, Tri >::ValueType

The element value type of the underlying matrix.

◆ ConstReference

template<typename M , typename Tri >
typedef M::ConstReference CDPL::Math::TriangularAdapter< M, Tri >::ConstReference

Constant reference type to an element of the underlying matrix.

◆ Reference

template<typename M , typename Tri >
typedef std::conditional<std::is_const<M>::value, typename M::ConstReference, typename M::Reference>::type CDPL::Math::TriangularAdapter< M, Tri >::Reference

Mutable reference type (degrades to ConstReference when the wrapped matrix is const).

◆ MatrixClosureType

template<typename M , typename Tri >
typedef std::conditional<std::is_const<M>::value, typename M::ConstClosureType, typename M::ClosureType>::type CDPL::Math::TriangularAdapter< M, Tri >::MatrixClosureType

Closure type used to store the wrapped matrix internally (mutable or const flavor).

◆ ConstClosureType

template<typename M , typename Tri >
typedef const SelfType CDPL::Math::TriangularAdapter< M, Tri >::ConstClosureType

Constant closure type used when this adapter appears inside another expression.

◆ ClosureType

template<typename M , typename Tri >
typedef SelfType CDPL::Math::TriangularAdapter< M, Tri >::ClosureType

Closure type used when this adapter appears inside another expression.

◆ RangeType

template<typename M , typename Tri >
typedef Range<SizeType> CDPL::Math::TriangularAdapter< M, Tri >::RangeType

The Math::Range type used to address sub-ranges.

Constructor & Destructor Documentation

◆ TriangularAdapter()

template<typename M , typename Tri >
CDPL::Math::TriangularAdapter< M, Tri >::TriangularAdapter ( MatrixType m)
inlineexplicit

Constructs the adapter wrapping m.

Parameters
mThe matrix to be viewed through the triangular policy.

Member Function Documentation

◆ operator()()

template<typename M , typename Tri >
ConstReference CDPL::Math::TriangularAdapter< M, Tri >::operator() ( SizeType  i,
SizeType  j 
) const
inline

Returns the value of element (i, j) as seen through the triangular policy (off-policy entries return the appropriate fill value: zero or one).

Parameters
iThe zero-based row index.
jThe zero-based column index.
Returns
The element value as defined by the triangular-view policy.

◆ getSize1()

template<typename M , typename Tri >
SizeType CDPL::Math::TriangularAdapter< M, Tri >::getSize1 ( ) const
inline

Returns the number of rows of the wrapped matrix.

Returns
The row count.

◆ getSize2()

template<typename M , typename Tri >
SizeType CDPL::Math::TriangularAdapter< M, Tri >::getSize2 ( ) const
inline

Returns the number of columns of the wrapped matrix.

Returns
The column count.

◆ getData() [1/2]

template<typename M , typename Tri >
MatrixClosureType& CDPL::Math::TriangularAdapter< M, Tri >::getData ( )
inline

Returns a reference to the wrapped matrix (via its stored closure).

Returns
A reference to the wrapped matrix closure.

◆ getData() [2/2]

template<typename M , typename Tri >
const MatrixClosureType& CDPL::Math::TriangularAdapter< M, Tri >::getData ( ) const
inline

Returns a const reference to the wrapped matrix (via its stored closure).

Returns
A const reference to the wrapped matrix closure.

◆ isEmpty()

template<typename M , typename Tri >
bool CDPL::Math::TriangularAdapter< M, Tri >::isEmpty ( ) const
inline

Tells whether the wrapped matrix is empty (zero rows or zero columns).

Returns
true if the wrapped matrix is empty, and false otherwise.

Friends And Related Function Documentation

◆ Lower

template<typename M , typename Tri >
friend struct Lower
friend

◆ UnitLower

template<typename M , typename Tri >
friend struct UnitLower
friend

◆ Upper

template<typename M , typename Tri >
friend struct Upper
friend

◆ UnitUpper

template<typename M , typename Tri >
friend struct UnitUpper
friend

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