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

Vector-expression proxy that views a single row of an underlying matrix. More...

#include <MatrixProxy.hpp>

+ Inheritance diagram for CDPL::Math::MatrixRow< M >:

Public Types

typedef M MatrixType
 The wrapped matrix type. More...
 
typedef M::SizeType SizeType
 The size type used by the wrapped matrix. More...
 
typedef M::DifferenceType DifferenceType
 The signed difference type used by the wrapped matrix. More...
 
typedef M::ValueType ValueType
 The element value type of the wrapped matrix. More...
 
typedef M::ConstReference ConstReference
 Constant reference type to an element. 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 proxy appears inside another expression. More...
 
typedef SelfType ClosureType
 Closure type used when this proxy appears inside another expression. More...
 
- Public Types inherited from CDPL::Math::VectorExpression< MatrixRow< M > >
typedef MatrixRow< M > ExpressionType
 The derived vector 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

 MatrixRow (MatrixType &m, SizeType i)
 Constructs the row proxy viewing row i of m. More...
 
Reference operator() (SizeType i)
 Returns a mutable reference to the element at column i of the row. More...
 
ConstReference operator() (SizeType i) const
 Returns a const reference to the element at column i of the row. More...
 
Reference operator[] (SizeType i)
 Returns a mutable reference to the element at column i of the row (alias for operator()). More...
 
ConstReference operator[] (SizeType i) const
 Returns a const reference to the element at column i of the row (alias for operator()). More...
 
SizeType getIndex () const
 Returns the row index this proxy refers to within the wrapped matrix. More...
 
SizeType getSize () const
 Returns the size of the row (number of columns of the wrapped matrix). More...
 
bool isEmpty () const
 Tells whether the row is empty (the wrapped matrix has zero columns). 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...
 
MatrixRowoperator= (const MatrixRow &r)
 Copy-assigns the contents of r to this row (via a temporary to handle aliasing). More...
 
template<typename E >
MatrixRowoperator= (const VectorExpression< E > &e)
 Assigns the elements of the vector expression e to this row (via a temporary to handle aliasing). More...
 
template<typename E >
MatrixRowoperator+= (const VectorExpression< E > &e)
 Adds the elements of the vector expression e to this row (via a temporary to handle aliasing). More...
 
template<typename E >
MatrixRowoperator-= (const VectorExpression< E > &e)
 Subtracts the elements of the vector expression e from this row (via a temporary to handle aliasing). More...
 
template<typename T >
std::enable_if< IsScalar< T >::value, MatrixRow >::type & operator*= (const T &t)
 Multiplies every element of this row by the scalar t. More...
 
template<typename T >
std::enable_if< IsScalar< T >::value, MatrixRow >::type & operator/= (const T &t)
 Divides every element of this row by the scalar t. More...
 
template<typename E >
MatrixRowassign (const VectorExpression< E > &e)
 Assigns the elements of the vector expression e to this row without intermediate temporary. More...
 
template<typename E >
MatrixRowplusAssign (const VectorExpression< E > &e)
 Adds the elements of the vector expression e to this row without intermediate temporary. More...
 
template<typename E >
MatrixRowminusAssign (const VectorExpression< E > &e)
 Subtracts the elements of the vector expression e from this row without intermediate temporary. More...
 
void swap (MatrixRow &r)
 Swaps the contents of this row with those of r (via element-wise swap of the underlying matrix elements). More...
 
- Public Member Functions inherited from CDPL::Math::VectorExpression< MatrixRow< M > >
const ExpressionTypeoperator() () const
 Returns a const reference to the derived vector expression. More...
 
ExpressionTypeoperator() ()
 Returns a reference to the derived vector expression. More...
 

Friends

void swap (MatrixRow &r1, MatrixRow &r2)
 ADL-enabled free-function form of swap(). More...
 

Additional Inherited Members

- Protected Member Functions inherited from CDPL::Math::VectorExpression< MatrixRow< M > >
 VectorExpression ()
 
 ~VectorExpression ()
 
- Protected Member Functions inherited from CDPL::Math::Expression< E >
 Expression ()
 
 ~Expression ()
 

Detailed Description

template<typename M>
class CDPL::Math::MatrixRow< M >

Vector-expression proxy that views a single row of an underlying matrix.

Template Parameters
MThe wrapped matrix type.

Member Typedef Documentation

◆ MatrixType

template<typename M >
typedef M CDPL::Math::MatrixRow< M >::MatrixType

The wrapped matrix type.

◆ SizeType

template<typename M >
typedef M::SizeType CDPL::Math::MatrixRow< M >::SizeType

The size type used by the wrapped matrix.

◆ DifferenceType

template<typename M >
typedef M::DifferenceType CDPL::Math::MatrixRow< M >::DifferenceType

The signed difference type used by the wrapped matrix.

◆ ValueType

template<typename M >
typedef M::ValueType CDPL::Math::MatrixRow< M >::ValueType

The element value type of the wrapped matrix.

◆ ConstReference

template<typename M >
typedef M::ConstReference CDPL::Math::MatrixRow< M >::ConstReference

Constant reference type to an element.

◆ Reference

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

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

◆ MatrixClosureType

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

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

◆ ConstClosureType

template<typename M >
typedef const SelfType CDPL::Math::MatrixRow< M >::ConstClosureType

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

◆ ClosureType

template<typename M >
typedef SelfType CDPL::Math::MatrixRow< M >::ClosureType

Closure type used when this proxy appears inside another expression.

Constructor & Destructor Documentation

◆ MatrixRow()

template<typename M >
CDPL::Math::MatrixRow< M >::MatrixRow ( MatrixType m,
SizeType  i 
)
inline

Constructs the row proxy viewing row i of m.

Parameters
mThe wrapped matrix.
iThe zero-based row index to view.

Member Function Documentation

◆ operator()() [1/2]

template<typename M >
Reference CDPL::Math::MatrixRow< M >::operator() ( SizeType  i)
inline

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

Parameters
iThe zero-based column index.
Returns
A mutable reference to the underlying element m(index, i).

◆ operator()() [2/2]

template<typename M >
ConstReference CDPL::Math::MatrixRow< M >::operator() ( SizeType  i) const
inline

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

Parameters
iThe zero-based column index.
Returns
A const reference to the underlying element m(index, i).

◆ operator[]() [1/2]

template<typename M >
Reference CDPL::Math::MatrixRow< M >::operator[] ( SizeType  i)
inline

Returns a mutable reference to the element at column i of the row (alias for operator()).

Parameters
iThe zero-based column index.
Returns
A mutable reference to the underlying element.

◆ operator[]() [2/2]

template<typename M >
ConstReference CDPL::Math::MatrixRow< M >::operator[] ( SizeType  i) const
inline

Returns a const reference to the element at column i of the row (alias for operator()).

Parameters
iThe zero-based column index.
Returns
A const reference to the underlying element.

◆ getIndex()

template<typename M >
SizeType CDPL::Math::MatrixRow< M >::getIndex ( ) const
inline

Returns the row index this proxy refers to within the wrapped matrix.

Returns
The zero-based row index.

◆ getSize()

template<typename M >
SizeType CDPL::Math::MatrixRow< M >::getSize ( ) const
inline

Returns the size of the row (number of columns of the wrapped matrix).

Returns
The number of columns.

◆ isEmpty()

template<typename M >
bool CDPL::Math::MatrixRow< M >::isEmpty ( ) const
inline

Tells whether the row is empty (the wrapped matrix has zero columns).

Returns
true if the wrapped matrix has zero columns, and false otherwise.

◆ getData() [1/2]

template<typename M >
MatrixClosureType& CDPL::Math::MatrixRow< M >::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 >
const MatrixClosureType& CDPL::Math::MatrixRow< M >::getData ( ) const
inline

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

Returns
A const reference to the wrapped matrix closure.

◆ operator=() [1/2]

template<typename M >
MatrixRow& CDPL::Math::MatrixRow< M >::operator= ( const MatrixRow< M > &  r)
inline

Copy-assigns the contents of r to this row (via a temporary to handle aliasing).

Parameters
rThe source row.
Returns
A reference to itself.

◆ operator=() [2/2]

template<typename M >
template<typename E >
MatrixRow& CDPL::Math::MatrixRow< M >::operator= ( const VectorExpression< E > &  e)
inline

Assigns the elements of the vector expression e to this row (via a temporary to handle aliasing).

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

◆ operator+=()

template<typename M >
template<typename E >
MatrixRow& CDPL::Math::MatrixRow< M >::operator+= ( const VectorExpression< E > &  e)
inline

Adds the elements of the vector expression e to this row (via a temporary to handle aliasing).

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

◆ operator-=()

template<typename M >
template<typename E >
MatrixRow& CDPL::Math::MatrixRow< M >::operator-= ( const VectorExpression< E > &  e)
inline

Subtracts the elements of the vector expression e from this row (via a temporary to handle aliasing).

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

◆ operator*=()

template<typename M >
template<typename T >
std::enable_if<IsScalar<T>::value, MatrixRow>::type& CDPL::Math::MatrixRow< M >::operator*= ( const T &  t)
inline

Multiplies every element of this row by the scalar t.

Template Parameters
TThe scalar type.
Parameters
tThe scalar multiplier.
Returns
A reference to itself.

◆ operator/=()

template<typename M >
template<typename T >
std::enable_if<IsScalar<T>::value, MatrixRow>::type& CDPL::Math::MatrixRow< M >::operator/= ( const T &  t)
inline

Divides every element of this row by the scalar t.

Template Parameters
TThe scalar type.
Parameters
tThe scalar divisor.
Returns
A reference to itself.

◆ assign()

template<typename M >
template<typename E >
MatrixRow& CDPL::Math::MatrixRow< M >::assign ( const VectorExpression< E > &  e)
inline

Assigns the elements of the vector expression e to this row without intermediate temporary.

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

◆ plusAssign()

template<typename M >
template<typename E >
MatrixRow& CDPL::Math::MatrixRow< M >::plusAssign ( const VectorExpression< E > &  e)
inline

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

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

◆ minusAssign()

template<typename M >
template<typename E >
MatrixRow& CDPL::Math::MatrixRow< M >::minusAssign ( const VectorExpression< E > &  e)
inline

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

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

◆ swap()

template<typename M >
void CDPL::Math::MatrixRow< M >::swap ( MatrixRow< M > &  r)
inline

Swaps the contents of this row with those of r (via element-wise swap of the underlying matrix elements).

Parameters
rThe row to swap with.

Friends And Related Function Documentation

◆ swap

template<typename M >
void swap ( MatrixRow< M > &  r1,
MatrixRow< M > &  r2 
)
friend

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

Parameters
r1The first row.
r2The second row.

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