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

Mutable view adapter that exposes the transpose of a matrix M as a matrix expression ( \( (i, j) \to M(j, i) \)). More...

#include <MatrixExpression.hpp>

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

 MatrixTranspose (MatrixType &m)
 Constructs the transpose view proxy referring to m. More...
 
Reference operator() (SizeType i, SizeType j)
 Returns a mutable reference to the wrapped matrix's element at (j, i). More...
 
ConstReference operator() (SizeType i, SizeType j) const
 Returns a const reference to the wrapped matrix's element at (j, i). More...
 
SizeType getSize1 () const
 Returns the number of rows of the transpose view (= number of columns of the wrapped matrix). More...
 
SizeType getSize2 () const
 Returns the number of columns of the transpose view (= number of rows of the wrapped matrix). More...
 
SizeType getMaxSize () const
 Returns the maximum number of elements the wrapped matrix can hold. More...
 
bool isEmpty () const
 Tells whether the view is empty (the wrapped matrix has zero rows or 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...
 
MatrixTransposeoperator= (const MatrixTranspose &mt)
 Copy-assigns the wrapped matrix from the contents of mt's wrapped matrix. More...
 
template<typename M1 >
MatrixTransposeoperator= (const MatrixTranspose< M1 > &mt)
 Assigns the wrapped matrix from mt's wrapped matrix (possibly differing types). More...
 
template<typename E >
MatrixTransposeoperator= (const MatrixExpression< E > &e)
 Assigns the matrix expression e to this transpose view (writes the transpose into the wrapped matrix). More...
 
template<typename E >
MatrixTransposeoperator+= (const MatrixExpression< E > &e)
 Adds the matrix expression e to this transpose view. More...
 
template<typename E >
MatrixTransposeoperator-= (const MatrixExpression< E > &e)
 Subtracts the matrix expression e from this transpose view. More...
 
template<typename T >
std::enable_if< IsScalar< T >::value, MatrixTranspose >::type & operator*= (const T &t)
 Multiplies every element of the wrapped matrix by the scalar t. More...
 
template<typename T >
std::enable_if< IsScalar< T >::value, MatrixTranspose >::type & operator/= (const T &t)
 Divides every element of the wrapped matrix by the scalar t. More...
 
template<typename E >
MatrixTransposeassign (const MatrixExpression< E > &e)
 Assigns the matrix expression e to this transpose view without intermediate temporary. More...
 
template<typename E >
MatrixTransposeplusAssign (const MatrixExpression< E > &e)
 Adds the matrix expression e to this transpose view without intermediate temporary. More...
 
template<typename E >
MatrixTransposeminusAssign (const MatrixExpression< E > &e)
 Subtracts the matrix expression e from this transpose view without intermediate temporary. More...
 
void swap (MatrixTranspose &mt)
 Swaps the underlying matrices of the two transpose views. More...
 
- Public Member Functions inherited from CDPL::Math::MatrixExpression< MatrixTranspose< M > >
const ExpressionTypeoperator() () const
 Returns a const reference to the derived matrix expression. More...
 
ExpressionTypeoperator() ()
 Returns a reference to the derived matrix expression. More...
 

Friends

void swap (MatrixTranspose &mt1, MatrixTranspose &mt2)
 ADL-enabled free-function form of swap(). More...
 

Additional Inherited Members

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

Detailed Description

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

Mutable view adapter that exposes the transpose of a matrix M as a matrix expression ( \( (i, j) \to M(j, i) \)).

Template Parameters
MThe wrapped matrix type.

Member Typedef Documentation

◆ MatrixType

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

The wrapped matrix type.

◆ SizeType

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

The size type used by the wrapped matrix.

◆ DifferenceType

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

The signed difference type used by the wrapped matrix.

◆ ValueType

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

The element value type of the wrapped matrix.

◆ ConstReference

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

Closure type used to store the wrapped matrix internally.

◆ ConstClosureType

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

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

◆ ClosureType

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

Closure type used when this proxy appears inside another expression.

Constructor & Destructor Documentation

◆ MatrixTranspose()

template<typename M >
CDPL::Math::MatrixTranspose< M >::MatrixTranspose ( MatrixType m)
inlineexplicit

Constructs the transpose view proxy referring to m.

Parameters
mThe wrapped matrix.

Member Function Documentation

◆ operator()() [1/2]

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

Returns a mutable reference to the wrapped matrix's element at (j, i).

Parameters
iThe zero-based row index in the transposed view.
jThe zero-based column index in the transposed view.
Returns
A mutable reference to m(j, i).

◆ operator()() [2/2]

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

Returns a const reference to the wrapped matrix's element at (j, i).

Parameters
iThe zero-based row index in the transposed view.
jThe zero-based column index in the transposed view.
Returns
A const reference to m(j, i).

◆ getSize1()

template<typename M >
SizeType CDPL::Math::MatrixTranspose< M >::getSize1 ( ) const
inline

Returns the number of rows of the transpose view (= number of columns of the wrapped matrix).

Returns
The number of rows.

◆ getSize2()

template<typename M >
SizeType CDPL::Math::MatrixTranspose< M >::getSize2 ( ) const
inline

Returns the number of columns of the transpose view (= number of rows of the wrapped matrix).

Returns
The number of columns.

◆ getMaxSize()

template<typename M >
SizeType CDPL::Math::MatrixTranspose< M >::getMaxSize ( ) const
inline

Returns the maximum number of elements the wrapped matrix can hold.

Returns
The maximum element count.

◆ isEmpty()

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

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

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

◆ getData() [1/2]

template<typename M >
MatrixClosureType& CDPL::Math::MatrixTranspose< 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::MatrixTranspose< 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/3]

template<typename M >
MatrixTranspose& CDPL::Math::MatrixTranspose< M >::operator= ( const MatrixTranspose< M > &  mt)
inline

Copy-assigns the wrapped matrix from the contents of mt's wrapped matrix.

Parameters
mtThe source transpose view.
Returns
A reference to itself.

◆ operator=() [2/3]

template<typename M >
template<typename M1 >
MatrixTranspose& CDPL::Math::MatrixTranspose< M >::operator= ( const MatrixTranspose< M1 > &  mt)
inline

Assigns the wrapped matrix from mt's wrapped matrix (possibly differing types).

Template Parameters
M1The source wrapped matrix type.
Parameters
mtThe source transpose view.
Returns
A reference to itself.

◆ operator=() [3/3]

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

Assigns the matrix expression e to this transpose view (writes the transpose into the wrapped matrix).

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

◆ operator+=()

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

Adds the matrix expression e to this transpose view.

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

◆ operator-=()

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

Subtracts the matrix expression e from this transpose view.

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

◆ operator*=()

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

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

Divides every element of the wrapped matrix 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 >
MatrixTranspose& CDPL::Math::MatrixTranspose< M >::assign ( const MatrixExpression< E > &  e)
inline

Assigns the matrix expression e to this transpose view without intermediate temporary.

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

◆ plusAssign()

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

Adds the matrix expression e to this transpose view without intermediate temporary.

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

◆ minusAssign()

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

Subtracts the matrix expression e from this transpose view without intermediate temporary.

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

◆ swap()

template<typename M >
void CDPL::Math::MatrixTranspose< M >::swap ( MatrixTranspose< M > &  mt)
inline

Swaps the underlying matrices of the two transpose views.

Parameters
mtThe transpose view to swap with.

Friends And Related Function Documentation

◆ swap

template<typename M >
void swap ( MatrixTranspose< M > &  mt1,
MatrixTranspose< M > &  mt2 
)
friend

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

Parameters
mt1The first transpose view.
mt2The second transpose view.

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