Chemical Data Processing Library C++ API - Version 1.4.0
Public Types | Public Member Functions | List of all members
CDPL::Math::InitListMatrix< T > Class Template Reference

Lightweight matrix container that wraps a nested std::initializer_list of T values. More...

#include <Matrix.hpp>

+ Inheritance diagram for CDPL::Math::InitListMatrix< T >:

Public Types

typedef InitListMatrix SelfType
 Convenience alias for this instantiation. More...
 
typedef std::initializer_list< std::initializer_list< T > > InitializerListType
 The nested std::initializer_list type wrapped by this matrix. More...
 
typedef InitializerListType::value_type::value_type ValueType
 The scalar value type. More...
 
typedef InitializerListType::value_type::const_reference ConstReference
 Constant reference type to an element. More...
 
typedef InitializerListType::value_type::reference Reference
 Mutable reference type to an element. More...
 
typedef InitializerListType::size_type SizeType
 The unsigned size type. More...
 
typedef std::ptrdiff_t DifferenceType
 The signed difference type. More...
 
typedef SelfType ClosureType
 Closure type used when this matrix appears inside another expression. More...
 
typedef const SelfType ConstClosureType
 Constant closure type used when this matrix appears inside another expression. More...
 
typedef Matrix< T, std::vector< T > > MatrixTemporaryType
 Concrete temporary matrix type used by expression-template machinery. More...
 
typedef Vector< T, std::vector< T > > VectorTemporaryType
 Concrete temporary vector type used by expression-template machinery. More...
 
- Public Types inherited from CDPL::Math::MatrixContainer< InitListMatrix< T > >
typedef InitListMatrix< T > ContainerType
 The derived matrix container type. More...
 
- Public Types inherited from CDPL::Math::MatrixExpression< E >
typedef E 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

 InitListMatrix (InitializerListType l)
 Constructs an InitListMatrix wrapping the nested initializer list l. More...
 
Reference operator() (SizeType i, SizeType j)
 Returns a mutable reference to the element at row i and column j. More...
 
ConstReference operator() (SizeType i, SizeType j) const
 Returns a const reference to the element at row i and column j. More...
 
SizeType getSize1 () const
 Returns the number of rows. More...
 
SizeType getSize2 () const
 Returns the number of columns (the longest row length). More...
 
bool isEmpty () const
 Tells whether the matrix is empty (zero rows or zero columns). More...
 
- Public Member Functions inherited from CDPL::Math::MatrixContainer< InitListMatrix< T > >
const ContainerTypeoperator() () const
 Returns a const reference to the derived matrix container. More...
 
ContainerTypeoperator() ()
 Returns a reference to the derived matrix container. More...
 
- Public Member Functions inherited from CDPL::Math::MatrixExpression< E >
const ExpressionTypeoperator() () const
 Returns a const reference to the derived matrix expression. More...
 
ExpressionTypeoperator() ()
 Returns a reference to the derived matrix expression. More...
 

Additional Inherited Members

- Protected Member Functions inherited from CDPL::Math::MatrixContainer< InitListMatrix< T > >
 MatrixContainer ()
 
 ~MatrixContainer ()
 
- Protected Member Functions inherited from CDPL::Math::MatrixExpression< E >
 MatrixExpression ()
 
 ~MatrixExpression ()
 
- Protected Member Functions inherited from CDPL::Math::Expression< E >
 Expression ()
 
 ~Expression ()
 

Detailed Description

template<typename T>
class CDPL::Math::InitListMatrix< T >

Lightweight matrix container that wraps a nested std::initializer_list of T values.

Template Parameters
TThe scalar value type.

Member Typedef Documentation

◆ SelfType

template<typename T >
typedef InitListMatrix CDPL::Math::InitListMatrix< T >::SelfType

Convenience alias for this instantiation.

◆ InitializerListType

template<typename T >
typedef std::initializer_list<std::initializer_list<T> > CDPL::Math::InitListMatrix< T >::InitializerListType

The nested std::initializer_list type wrapped by this matrix.

◆ ValueType

template<typename T >
typedef InitializerListType::value_type::value_type CDPL::Math::InitListMatrix< T >::ValueType

The scalar value type.

◆ ConstReference

template<typename T >
typedef InitializerListType::value_type::const_reference CDPL::Math::InitListMatrix< T >::ConstReference

Constant reference type to an element.

◆ Reference

template<typename T >
typedef InitializerListType::value_type::reference CDPL::Math::InitListMatrix< T >::Reference

Mutable reference type to an element.

◆ SizeType

template<typename T >
typedef InitializerListType::size_type CDPL::Math::InitListMatrix< T >::SizeType

The unsigned size type.

◆ DifferenceType

template<typename T >
typedef std::ptrdiff_t CDPL::Math::InitListMatrix< T >::DifferenceType

The signed difference type.

◆ ClosureType

template<typename T >
typedef SelfType CDPL::Math::InitListMatrix< T >::ClosureType

Closure type used when this matrix appears inside another expression.

◆ ConstClosureType

template<typename T >
typedef const SelfType CDPL::Math::InitListMatrix< T >::ConstClosureType

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

◆ MatrixTemporaryType

template<typename T >
typedef Matrix<T, std::vector<T> > CDPL::Math::InitListMatrix< T >::MatrixTemporaryType

Concrete temporary matrix type used by expression-template machinery.

◆ VectorTemporaryType

template<typename T >
typedef Vector<T, std::vector<T> > CDPL::Math::InitListMatrix< T >::VectorTemporaryType

Concrete temporary vector type used by expression-template machinery.

Constructor & Destructor Documentation

◆ InitListMatrix()

template<typename T >
CDPL::Math::InitListMatrix< T >::InitListMatrix ( InitializerListType  l)
inline

Constructs an InitListMatrix wrapping the nested initializer list l.

The second-dimension size is the longest inner list's length; shorter rows are zero-padded on access.

Parameters
lThe nested initializer list.

Member Function Documentation

◆ operator()() [1/2]

template<typename T >
Reference CDPL::Math::InitListMatrix< T >::operator() ( SizeType  i,
SizeType  j 
)
inline

Returns a mutable reference to the element at row i and column j.

Parameters
iThe zero-based row index.
jThe zero-based column index.
Returns
A mutable reference to the element (or to a zero element if j is past the row's length).
Exceptions
Base::IndexErrorif i or j is out of range.

◆ operator()() [2/2]

template<typename T >
ConstReference CDPL::Math::InitListMatrix< T >::operator() ( SizeType  i,
SizeType  j 
) const
inline

Returns a const reference to the element at row i and column j.

Parameters
iThe zero-based row index.
jThe zero-based column index.
Returns
A const reference to the element (or to a zero element if j is past the row's length).
Exceptions
Base::IndexErrorif i or j is out of range.

◆ getSize1()

template<typename T >
SizeType CDPL::Math::InitListMatrix< T >::getSize1 ( ) const
inline

Returns the number of rows.

Returns
The first-dimension size.

◆ getSize2()

template<typename T >
SizeType CDPL::Math::InitListMatrix< T >::getSize2 ( ) const
inline

Returns the number of columns (the longest row length).

Returns
The second-dimension size.

◆ isEmpty()

template<typename T >
bool CDPL::Math::InitListMatrix< T >::isEmpty ( ) const
inline

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

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

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