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

Variable-size matrix with fixed upper capacities M \( \times \) N stored in a stack-allocated array. More...

#include <Matrix.hpp>

+ Inheritance diagram for CDPL::Math::BoundedMatrix< T, M, N >:

Public Types

typedef T ValueType
 The scalar value type. More...
 
typedef T & Reference
 Mutable reference type to an element. More...
 
typedef const T & ConstReference
 Constant reference type to an element. More...
 
typedef std::size_t SizeType
 The unsigned size type. More...
 
typedef std::ptrdiff_t DifferenceType
 The signed difference type. More...
 
typedef ValueType ArrayType[M][N]
 The fixed-capacity 2D C-array type used for in-memory storage. More...
 
typedef T(* ArrayPointer)[N]
 Pointer-to-row type for raw access to the element array. More...
 
typedef const T(* ConstArrayPointer)[N]
 Constant pointer-to-row type for raw access to the element array. More...
 
typedef T * Pointer
 Pointer type to a single element. More...
 
typedef const T * ConstPointer
 Constant pointer type to a single element. More...
 
typedef MatrixReference< SelfTypeClosureType
 Closure type used when this matrix appears inside another expression. More...
 
typedef const MatrixReference< const SelfTypeConstClosureType
 Constant closure type used when this matrix appears inside another expression. More...
 
typedef SelfType MatrixTemporaryType
 Concrete temporary matrix type used by expression-template machinery. More...
 
typedef BoundedVector< T, M *N > VectorTemporaryType
 Concrete temporary vector type used when assembling vectors from this matrix (a bounded vector of capacity M * N). More...
 
typedef std::shared_ptr< SelfTypeSharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated BoundedMatrix instances. More...
 
typedef std::initializer_list< std::initializer_list< T > > InitializerListType
 The initializer-list-of-rows type accepted by constructors and assignment. More...
 
- Public Types inherited from CDPL::Math::MatrixContainer< BoundedMatrix< T, M, N > >
typedef BoundedMatrix< T, M, N > 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

 BoundedMatrix ()
 Constructs an empty bounded matrix (zero rows, zero columns). More...
 
 BoundedMatrix (SizeType m, SizeType n)
 Constructs a bounded matrix of size \( m \times n \) with value-initialized elements. More...
 
 BoundedMatrix (SizeType m, SizeType n, const ValueType &v)
 Constructs a bounded matrix of size \( m \times n \) with every element initialized to v. More...
 
 BoundedMatrix (const BoundedMatrix &m)
 Constructs a copy of the bounded matrix m. More...
 
 BoundedMatrix (InitializerListType l)
 Constructs a bounded matrix from the initializer list of rows l. More...
 
template<typename E >
 BoundedMatrix (const MatrixExpression< E > &e)
 Constructs a bounded matrix from the matrix expression e. More...
 
Reference operator() (SizeType i, SizeType j)
 Returns a mutable reference to the element at (i, j). More...
 
ConstReference operator() (SizeType i, SizeType j) const
 Returns a const reference to the element at (i, j). More...
 
bool isEmpty () const
 Tells whether the matrix is empty. More...
 
SizeType getSize1 () const
 Returns the current row count. More...
 
SizeType getSize2 () const
 Returns the current column count. More...
 
SizeType getMaxSize1 () const
 Returns the compile-time maximum row count M. More...
 
SizeType getMaxSize2 () const
 Returns the compile-time maximum column count N. More...
 
ArrayPointer getData ()
 Returns a mutable pointer-to-row to the contiguous 2D element array. More...
 
ConstArrayPointer getData () const
 Returns a const pointer-to-row to the contiguous 2D element array. More...
 
BoundedMatrixoperator= (const BoundedMatrix &m)
 Copy-assigns the elements of m to this bounded matrix. More...
 
template<typename C >
BoundedMatrixoperator= (const MatrixContainer< C > &c)
 Assigns the contents of the matrix container c to this bounded matrix (no alias check needed). More...
 
BoundedMatrixoperator= (InitializerListType l)
 Assigns the rows in l to this bounded matrix (resizes to match, respecting the bounds). More...
 
template<typename E >
BoundedMatrixoperator= (const MatrixExpression< E > &e)
 Assigns the matrix expression e to this bounded matrix (via a temporary to handle aliasing). More...
 
template<typename C >
BoundedMatrixoperator+= (const MatrixContainer< C > &c)
 Adds the contents of the matrix container c element-wise to this bounded matrix (no alias check needed). More...
 
BoundedMatrixoperator+= (InitializerListType l)
 Adds the rows in l element-wise to this bounded matrix. More...
 
template<typename E >
BoundedMatrixoperator+= (const MatrixExpression< E > &e)
 Adds the matrix expression e element-wise to this bounded matrix (via a temporary to handle aliasing). More...
 
template<typename C >
BoundedMatrixoperator-= (const MatrixContainer< C > &c)
 Subtracts the contents of the matrix container c element-wise from this bounded matrix (no alias check needed). More...
 
BoundedMatrixoperator-= (InitializerListType l)
 Subtracts the rows in l element-wise from this bounded matrix. More...
 
template<typename E >
BoundedMatrixoperator-= (const MatrixExpression< E > &e)
 Subtracts the matrix expression e element-wise from this bounded matrix (via a temporary to handle aliasing). More...
 
template<typename T1 >
std::enable_if< IsScalar< T1 >::value, BoundedMatrix >::type & operator*= (const T1 &v)
 Multiplies every element by the scalar v. More...
 
template<typename T1 >
std::enable_if< IsScalar< T1 >::value, BoundedMatrix >::type & operator/= (const T1 &v)
 Divides every element by the scalar v. More...
 
template<typename E >
BoundedMatrixassign (const MatrixExpression< E > &e)
 Resizes this matrix to match e and assigns its elements without intermediate temporary. More...
 
BoundedMatrixassign (InitializerListType l)
 Resizes this matrix to match l and assigns its elements. More...
 
template<typename E >
BoundedMatrixplusAssign (const MatrixExpression< E > &e)
 Adds the elements of the matrix expression e to this matrix without intermediate temporary. More...
 
BoundedMatrixplusAssign (InitializerListType l)
 Adds the rows in l element-wise to this matrix without intermediate temporary. More...
 
template<typename E >
BoundedMatrixminusAssign (const MatrixExpression< E > &e)
 Subtracts the elements of the matrix expression e from this matrix without intermediate temporary. More...
 
BoundedMatrixminusAssign (InitializerListType l)
 Subtracts the rows in l element-wise from this matrix without intermediate temporary. More...
 
void swap (BoundedMatrix &m)
 Swaps the contents of this bounded matrix with those of m. More...
 
void clear (const ValueType &v=ValueType())
 Sets every element of the matrix to the value v (dimensions unchanged). More...
 
void resize (SizeType m, SizeType n)
 Resizes the matrix to \( m \times n \) elements (new elements are left value-uninitialized). More...
 
void resize (SizeType m, SizeType n, const ValueType &v)
 Resizes the matrix to \( m \times n \) elements; newly added cells are set to v. More...
 
- Public Member Functions inherited from CDPL::Math::MatrixContainer< BoundedMatrix< T, M, N > >
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...
 

Static Public Attributes

static const SizeType MaxSize1 = M
 The compile-time maximum number of rows M. More...
 
static const SizeType MaxSize2 = N
 The compile-time maximum number of columns N. More...
 

Friends

void swap (BoundedMatrix &m1, BoundedMatrix &m2)
 ADL-enabled free-function form of swap(). More...
 

Additional Inherited Members

- Protected Member Functions inherited from CDPL::Math::MatrixContainer< BoundedMatrix< T, M, N > >
 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, std::size_t M, std::size_t N>
class CDPL::Math::BoundedMatrix< T, M, N >

Variable-size matrix with fixed upper capacities M \( \times \) N stored in a stack-allocated array.

Template Parameters
TThe scalar value type.
MThe maximum number of rows.
NThe maximum number of columns.

Member Typedef Documentation

◆ ValueType

template<typename T , std::size_t M, std::size_t N>
typedef T CDPL::Math::BoundedMatrix< T, M, N >::ValueType

The scalar value type.

◆ Reference

template<typename T , std::size_t M, std::size_t N>
typedef T& CDPL::Math::BoundedMatrix< T, M, N >::Reference

Mutable reference type to an element.

◆ ConstReference

template<typename T , std::size_t M, std::size_t N>
typedef const T& CDPL::Math::BoundedMatrix< T, M, N >::ConstReference

Constant reference type to an element.

◆ SizeType

template<typename T , std::size_t M, std::size_t N>
typedef std::size_t CDPL::Math::BoundedMatrix< T, M, N >::SizeType

The unsigned size type.

◆ DifferenceType

template<typename T , std::size_t M, std::size_t N>
typedef std::ptrdiff_t CDPL::Math::BoundedMatrix< T, M, N >::DifferenceType

The signed difference type.

◆ ArrayType

template<typename T , std::size_t M, std::size_t N>
typedef ValueType CDPL::Math::BoundedMatrix< T, M, N >::ArrayType[M][N]

The fixed-capacity 2D C-array type used for in-memory storage.

◆ ArrayPointer

template<typename T , std::size_t M, std::size_t N>
typedef T(* CDPL::Math::BoundedMatrix< T, M, N >::ArrayPointer)[N]

Pointer-to-row type for raw access to the element array.

◆ ConstArrayPointer

template<typename T , std::size_t M, std::size_t N>
typedef const T(* CDPL::Math::BoundedMatrix< T, M, N >::ConstArrayPointer)[N]

Constant pointer-to-row type for raw access to the element array.

◆ Pointer

template<typename T , std::size_t M, std::size_t N>
typedef T* CDPL::Math::BoundedMatrix< T, M, N >::Pointer

Pointer type to a single element.

◆ ConstPointer

template<typename T , std::size_t M, std::size_t N>
typedef const T* CDPL::Math::BoundedMatrix< T, M, N >::ConstPointer

Constant pointer type to a single element.

◆ ClosureType

template<typename T , std::size_t M, std::size_t N>
typedef MatrixReference<SelfType> CDPL::Math::BoundedMatrix< T, M, N >::ClosureType

Closure type used when this matrix appears inside another expression.

◆ ConstClosureType

template<typename T , std::size_t M, std::size_t N>
typedef const MatrixReference<const SelfType> CDPL::Math::BoundedMatrix< T, M, N >::ConstClosureType

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

◆ MatrixTemporaryType

template<typename T , std::size_t M, std::size_t N>
typedef SelfType CDPL::Math::BoundedMatrix< T, M, N >::MatrixTemporaryType

Concrete temporary matrix type used by expression-template machinery.

◆ VectorTemporaryType

template<typename T , std::size_t M, std::size_t N>
typedef BoundedVector<T, M * N> CDPL::Math::BoundedMatrix< T, M, N >::VectorTemporaryType

Concrete temporary vector type used when assembling vectors from this matrix (a bounded vector of capacity M * N).

◆ SharedPointer

template<typename T , std::size_t M, std::size_t N>
typedef std::shared_ptr<SelfType> CDPL::Math::BoundedMatrix< T, M, N >::SharedPointer

A reference-counted smart pointer [SHPTR] for dynamically allocated BoundedMatrix instances.

◆ InitializerListType

template<typename T , std::size_t M, std::size_t N>
typedef std::initializer_list<std::initializer_list<T> > CDPL::Math::BoundedMatrix< T, M, N >::InitializerListType

The initializer-list-of-rows type accepted by constructors and assignment.

Constructor & Destructor Documentation

◆ BoundedMatrix() [1/6]

template<typename T , std::size_t M, std::size_t N>
CDPL::Math::BoundedMatrix< T, M, N >::BoundedMatrix ( )
inline

Constructs an empty bounded matrix (zero rows, zero columns).

◆ BoundedMatrix() [2/6]

template<typename T , std::size_t M, std::size_t N>
CDPL::Math::BoundedMatrix< T, M, N >::BoundedMatrix ( SizeType  m,
SizeType  n 
)
inline

Constructs a bounded matrix of size \( m \times n \) with value-initialized elements.

Parameters
mThe initial row count.
nThe initial column count.
Exceptions
Base::SizeErrorif m exceeds the bound M or n exceeds N.

◆ BoundedMatrix() [3/6]

template<typename T , std::size_t M, std::size_t N>
CDPL::Math::BoundedMatrix< T, M, N >::BoundedMatrix ( SizeType  m,
SizeType  n,
const ValueType v 
)
inline

Constructs a bounded matrix of size \( m \times n \) with every element initialized to v.

Parameters
mThe initial row count.
nThe initial column count.
vThe initial element value.
Exceptions
Base::SizeErrorif m exceeds the bound M or n exceeds N.

◆ BoundedMatrix() [4/6]

template<typename T , std::size_t M, std::size_t N>
CDPL::Math::BoundedMatrix< T, M, N >::BoundedMatrix ( const BoundedMatrix< T, M, N > &  m)
inline

Constructs a copy of the bounded matrix m.

Parameters
mThe bounded matrix to copy.

◆ BoundedMatrix() [5/6]

template<typename T , std::size_t M, std::size_t N>
CDPL::Math::BoundedMatrix< T, M, N >::BoundedMatrix ( InitializerListType  l)
inline

Constructs a bounded matrix from the initializer list of rows l.

Parameters
lThe initializer list of rows.
Exceptions
Base::SizeErrorif the dimensions of l exceed the bounds M, N.

◆ BoundedMatrix() [6/6]

template<typename T , std::size_t M, std::size_t N>
template<typename E >
CDPL::Math::BoundedMatrix< T, M, N >::BoundedMatrix ( const MatrixExpression< E > &  e)
inline

Constructs a bounded matrix from the matrix expression e.

Template Parameters
EThe source matrix expression type.
Parameters
eThe source matrix expression.
Exceptions
Base::SizeErrorif the dimensions of e exceed the bounds M, N.

Member Function Documentation

◆ operator()() [1/2]

template<typename T , std::size_t M, std::size_t N>
Reference CDPL::Math::BoundedMatrix< T, M, N >::operator() ( SizeType  i,
SizeType  j 
)
inline

Returns a mutable reference to the element at (i, j).

Parameters
iThe zero-based row index.
jThe zero-based column index.
Returns
A mutable reference to the element.
Exceptions
Base::IndexErrorif either index is out of range.

◆ operator()() [2/2]

template<typename T , std::size_t M, std::size_t N>
ConstReference CDPL::Math::BoundedMatrix< T, M, N >::operator() ( SizeType  i,
SizeType  j 
) const
inline

Returns a const reference to the element at (i, j).

Parameters
iThe zero-based row index.
jThe zero-based column index.
Returns
A const reference to the element.
Exceptions
Base::IndexErrorif either index is out of range.

◆ isEmpty()

template<typename T , std::size_t M, std::size_t N>
bool CDPL::Math::BoundedMatrix< T, M, N >::isEmpty ( ) const
inline

Tells whether the matrix is empty.

Returns
true if either dimension is zero, and false otherwise.

◆ getSize1()

template<typename T , std::size_t M, std::size_t N>
SizeType CDPL::Math::BoundedMatrix< T, M, N >::getSize1 ( ) const
inline

Returns the current row count.

Returns
The number of rows.

◆ getSize2()

template<typename T , std::size_t M, std::size_t N>
SizeType CDPL::Math::BoundedMatrix< T, M, N >::getSize2 ( ) const
inline

Returns the current column count.

Returns
The number of columns.

◆ getMaxSize1()

template<typename T , std::size_t M, std::size_t N>
SizeType CDPL::Math::BoundedMatrix< T, M, N >::getMaxSize1 ( ) const
inline

Returns the compile-time maximum row count M.

Returns
The maximum number of rows.

◆ getMaxSize2()

template<typename T , std::size_t M, std::size_t N>
SizeType CDPL::Math::BoundedMatrix< T, M, N >::getMaxSize2 ( ) const
inline

Returns the compile-time maximum column count N.

Returns
The maximum number of columns.

◆ getData() [1/2]

template<typename T , std::size_t M, std::size_t N>
ArrayPointer CDPL::Math::BoundedMatrix< T, M, N >::getData ( )
inline

Returns a mutable pointer-to-row to the contiguous 2D element array.

Returns
A mutable array pointer.

◆ getData() [2/2]

template<typename T , std::size_t M, std::size_t N>
ConstArrayPointer CDPL::Math::BoundedMatrix< T, M, N >::getData ( ) const
inline

Returns a const pointer-to-row to the contiguous 2D element array.

Returns
A const array pointer.

◆ operator=() [1/4]

template<typename T , std::size_t M, std::size_t N>
BoundedMatrix& CDPL::Math::BoundedMatrix< T, M, N >::operator= ( const BoundedMatrix< T, M, N > &  m)
inline

Copy-assigns the elements of m to this bounded matrix.

Parameters
mThe source bounded matrix.
Returns
A reference to itself.

◆ operator=() [2/4]

template<typename T , std::size_t M, std::size_t N>
template<typename C >
BoundedMatrix& CDPL::Math::BoundedMatrix< T, M, N >::operator= ( const MatrixContainer< C > &  c)
inline

Assigns the contents of the matrix container c to this bounded matrix (no alias check needed).

Template Parameters
CThe source matrix container type.
Parameters
cThe source matrix container.
Returns
A reference to itself.

◆ operator=() [3/4]

template<typename T , std::size_t M, std::size_t N>
BoundedMatrix& CDPL::Math::BoundedMatrix< T, M, N >::operator= ( InitializerListType  l)
inline

Assigns the rows in l to this bounded matrix (resizes to match, respecting the bounds).

Parameters
lThe initializer list of rows.
Returns
A reference to itself.
Exceptions
Base::SizeErrorif the dimensions of l exceed the bounds M, N.

◆ operator=() [4/4]

template<typename T , std::size_t M, std::size_t N>
template<typename E >
BoundedMatrix& CDPL::Math::BoundedMatrix< T, M, N >::operator= ( const MatrixExpression< E > &  e)
inline

Assigns the matrix expression e to this bounded matrix (via a temporary to handle aliasing).

Template Parameters
EThe source matrix expression type.
Parameters
eThe source matrix expression.
Returns
A reference to itself.
Exceptions
Base::SizeErrorif the dimensions of e exceed the bounds M, N.

◆ operator+=() [1/3]

template<typename T , std::size_t M, std::size_t N>
template<typename C >
BoundedMatrix& CDPL::Math::BoundedMatrix< T, M, N >::operator+= ( const MatrixContainer< C > &  c)
inline

Adds the contents of the matrix container c element-wise to this bounded matrix (no alias check needed).

Template Parameters
CThe source matrix container type.
Parameters
cThe source matrix container.
Returns
A reference to itself.

◆ operator+=() [2/3]

template<typename T , std::size_t M, std::size_t N>
BoundedMatrix& CDPL::Math::BoundedMatrix< T, M, N >::operator+= ( InitializerListType  l)
inline

Adds the rows in l element-wise to this bounded matrix.

Parameters
lThe initializer list of rows providing the addends.
Returns
A reference to itself.

◆ operator+=() [3/3]

template<typename T , std::size_t M, std::size_t N>
template<typename E >
BoundedMatrix& CDPL::Math::BoundedMatrix< T, M, N >::operator+= ( const MatrixExpression< E > &  e)
inline

Adds the matrix expression e element-wise to this bounded matrix (via a temporary to handle aliasing).

Template Parameters
EThe source matrix expression type.
Parameters
eThe source matrix expression.
Returns
A reference to itself.

◆ operator-=() [1/3]

template<typename T , std::size_t M, std::size_t N>
template<typename C >
BoundedMatrix& CDPL::Math::BoundedMatrix< T, M, N >::operator-= ( const MatrixContainer< C > &  c)
inline

Subtracts the contents of the matrix container c element-wise from this bounded matrix (no alias check needed).

Template Parameters
CThe source matrix container type.
Parameters
cThe source matrix container.
Returns
A reference to itself.

◆ operator-=() [2/3]

template<typename T , std::size_t M, std::size_t N>
BoundedMatrix& CDPL::Math::BoundedMatrix< T, M, N >::operator-= ( InitializerListType  l)
inline

Subtracts the rows in l element-wise from this bounded matrix.

Parameters
lThe initializer list of rows providing the subtrahends.
Returns
A reference to itself.

◆ operator-=() [3/3]

template<typename T , std::size_t M, std::size_t N>
template<typename E >
BoundedMatrix& CDPL::Math::BoundedMatrix< T, M, N >::operator-= ( const MatrixExpression< E > &  e)
inline

Subtracts the matrix expression e element-wise from this bounded matrix (via a temporary to handle aliasing).

Template Parameters
EThe source matrix expression type.
Parameters
eThe source matrix expression.
Returns
A reference to itself.

◆ operator*=()

template<typename T , std::size_t M, std::size_t N>
template<typename T1 >
std::enable_if<IsScalar<T1>::value, BoundedMatrix>::type& CDPL::Math::BoundedMatrix< T, M, N >::operator*= ( const T1 &  v)
inline

Multiplies every element by the scalar v.

Template Parameters
T1The scalar type.
Parameters
vThe scalar multiplier.
Returns
A reference to itself.

◆ operator/=()

template<typename T , std::size_t M, std::size_t N>
template<typename T1 >
std::enable_if<IsScalar<T1>::value, BoundedMatrix>::type& CDPL::Math::BoundedMatrix< T, M, N >::operator/= ( const T1 &  v)
inline

Divides every element by the scalar v.

Template Parameters
T1The scalar type.
Parameters
vThe scalar divisor.
Returns
A reference to itself.

◆ assign() [1/2]

template<typename T , std::size_t M, std::size_t N>
template<typename E >
BoundedMatrix& CDPL::Math::BoundedMatrix< T, M, N >::assign ( const MatrixExpression< E > &  e)
inline

Resizes this matrix to match e and assigns its elements without intermediate temporary.

Template Parameters
EThe source matrix expression type.
Parameters
eThe source matrix expression.
Returns
A reference to itself.
Exceptions
Base::SizeErrorif the dimensions of e exceed the bounds M, N.

◆ assign() [2/2]

template<typename T , std::size_t M, std::size_t N>
BoundedMatrix& CDPL::Math::BoundedMatrix< T, M, N >::assign ( InitializerListType  l)
inline

Resizes this matrix to match l and assigns its elements.

Parameters
lThe initializer list of rows providing the new elements.
Returns
A reference to itself.
Exceptions
Base::SizeErrorif the dimensions of l exceed the bounds M, N.

◆ plusAssign() [1/2]

template<typename T , std::size_t M, std::size_t N>
template<typename E >
BoundedMatrix& CDPL::Math::BoundedMatrix< T, M, N >::plusAssign ( const MatrixExpression< E > &  e)
inline

Adds the elements of the matrix expression e to this matrix without intermediate temporary.

Template Parameters
EThe source matrix expression type.
Parameters
eThe source matrix expression.
Returns
A reference to itself.

◆ plusAssign() [2/2]

template<typename T , std::size_t M, std::size_t N>
BoundedMatrix& CDPL::Math::BoundedMatrix< T, M, N >::plusAssign ( InitializerListType  l)
inline

Adds the rows in l element-wise to this matrix without intermediate temporary.

Parameters
lThe initializer list of rows providing the addends.
Returns
A reference to itself.

◆ minusAssign() [1/2]

template<typename T , std::size_t M, std::size_t N>
template<typename E >
BoundedMatrix& CDPL::Math::BoundedMatrix< T, M, N >::minusAssign ( const MatrixExpression< E > &  e)
inline

Subtracts the elements of the matrix expression e from this matrix without intermediate temporary.

Template Parameters
EThe source matrix expression type.
Parameters
eThe source matrix expression.
Returns
A reference to itself.

◆ minusAssign() [2/2]

template<typename T , std::size_t M, std::size_t N>
BoundedMatrix& CDPL::Math::BoundedMatrix< T, M, N >::minusAssign ( InitializerListType  l)
inline

Subtracts the rows in l element-wise from this matrix without intermediate temporary.

Parameters
lThe initializer list of rows providing the subtrahends.
Returns
A reference to itself.

◆ swap()

template<typename T , std::size_t M, std::size_t N>
void CDPL::Math::BoundedMatrix< T, M, N >::swap ( BoundedMatrix< T, M, N > &  m)
inline

Swaps the contents of this bounded matrix with those of m.

Parameters
mThe bounded matrix to swap with.

◆ clear()

template<typename T , std::size_t M, std::size_t N>
void CDPL::Math::BoundedMatrix< T, M, N >::clear ( const ValueType v = ValueType())
inline

Sets every element of the matrix to the value v (dimensions unchanged).

Parameters
vThe fill value.

◆ resize() [1/2]

template<typename T , std::size_t M, std::size_t N>
void CDPL::Math::BoundedMatrix< T, M, N >::resize ( SizeType  m,
SizeType  n 
)
inline

Resizes the matrix to \( m \times n \) elements (new elements are left value-uninitialized).

Parameters
mThe new row count.
nThe new column count.
Exceptions
Base::SizeErrorif m exceeds M or n exceeds N.

◆ resize() [2/2]

template<typename T , std::size_t M, std::size_t N>
void CDPL::Math::BoundedMatrix< T, M, N >::resize ( SizeType  m,
SizeType  n,
const ValueType v 
)
inline

Resizes the matrix to \( m \times n \) elements; newly added cells are set to v.

Parameters
mThe new row count.
nThe new column count.
vThe fill value for newly added cells.
Exceptions
Base::SizeErrorif m exceeds M or n exceeds N.

Friends And Related Function Documentation

◆ swap

template<typename T , std::size_t M, std::size_t N>
void swap ( BoundedMatrix< T, M, N > &  m1,
BoundedMatrix< T, M, N > &  m2 
)
friend

ADL-enabled free-function form of swap().

Parameters
m1The first bounded matrix.
m2The second bounded matrix.

Member Data Documentation

◆ MaxSize1

template<typename T , std::size_t M, std::size_t N>
const BoundedMatrix< T, M, N >::SizeType CDPL::Math::BoundedMatrix< T, M, N >::MaxSize1 = M
static

The compile-time maximum number of rows M.

◆ MaxSize2

template<typename T , std::size_t M, std::size_t N>
const BoundedMatrix< T, M, N >::SizeType CDPL::Math::BoundedMatrix< T, M, N >::MaxSize2 = N
static

The compile-time maximum number of columns N.


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