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

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

#include <MatrixProxy.hpp>

+ Inheritance diagram for CDPL::Math::MatrixColumn< 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. 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< MatrixColumn< M > >
typedef MatrixColumn< 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

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

Additional Inherited Members

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

Detailed Description

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

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

Template Parameters
MThe wrapped matrix type.

Member Typedef Documentation

◆ MatrixType

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

The wrapped matrix type.

◆ SizeType

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

The size type used by the wrapped matrix.

◆ DifferenceType

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

The signed difference type used by the wrapped matrix.

◆ ValueType

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

The element value type of the wrapped matrix.

◆ ConstReference

template<typename M >
typedef M::ConstReference CDPL::Math::MatrixColumn< 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::MatrixColumn< 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::MatrixColumn< M >::MatrixClosureType

Closure type used to store the wrapped matrix internally.

◆ ConstClosureType

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

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

◆ ClosureType

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

Closure type used when this proxy appears inside another expression.

Constructor & Destructor Documentation

◆ MatrixColumn()

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

Constructs the column proxy viewing column i of m.

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

Member Function Documentation

◆ operator()() [1/2]

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

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

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

◆ operator()() [2/2]

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

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

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

◆ operator[]() [1/2]

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

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

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

◆ operator[]() [2/2]

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

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

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

◆ getIndex()

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

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

Returns
The zero-based column index.

◆ getSize()

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

Returns the size of the column (number of rows of the wrapped matrix).

Returns
The number of rows.

◆ isEmpty()

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

Tells whether the column is empty (the wrapped matrix has zero rows).

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

◆ getData() [1/2]

template<typename M >
MatrixClosureType& CDPL::Math::MatrixColumn< 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::MatrixColumn< 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 >
MatrixColumn& CDPL::Math::MatrixColumn< M >::operator= ( const MatrixColumn< M > &  c)
inline

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

Parameters
cThe source column.
Returns
A reference to itself.

◆ operator=() [2/2]

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

Assigns the elements of the vector expression e to this column (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 >
MatrixColumn& CDPL::Math::MatrixColumn< M >::operator+= ( const VectorExpression< E > &  e)
inline

Adds the elements of the vector expression e to this column (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 >
MatrixColumn& CDPL::Math::MatrixColumn< M >::operator-= ( const VectorExpression< E > &  e)
inline

Subtracts the elements of the vector expression e from this column (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, MatrixColumn>::type& CDPL::Math::MatrixColumn< M >::operator*= ( const T &  t)
inline

Multiplies every element of this column 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, MatrixColumn>::type& CDPL::Math::MatrixColumn< M >::operator/= ( const T &  t)
inline

Divides every element of this column 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 >
MatrixColumn& CDPL::Math::MatrixColumn< M >::assign ( const VectorExpression< E > &  e)
inline

Assigns the elements of the vector expression e to this column 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 >
MatrixColumn& CDPL::Math::MatrixColumn< M >::plusAssign ( const VectorExpression< E > &  e)
inline

Adds the elements of the vector expression e to this column 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 >
MatrixColumn& CDPL::Math::MatrixColumn< M >::minusAssign ( const VectorExpression< E > &  e)
inline

Subtracts the elements of the vector expression e from this column 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::MatrixColumn< M >::swap ( MatrixColumn< M > &  c)
inline

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

Parameters
cThe column to swap with.

Friends And Related Function Documentation

◆ swap

template<typename M >
void swap ( MatrixColumn< M > &  c1,
MatrixColumn< M > &  c2 
)
friend

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

Parameters
c1The first column.
c2The second column.

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