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

Constant matrix expression in which every entry equals the same scalar value. More...

#include <Matrix.hpp>

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

Public Types

typedef T ValueType
 The scalar value type. More...
 
typedef const T & Reference
 Reference type (always a const reference — elements are immutable). More...
 
typedef const T & ConstReference
 Constant reference type to the common value. More...
 
typedef std::size_t SizeType
 The unsigned size type. More...
 
typedef std::ptrdiff_t DifferenceType
 The signed difference type. 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 Matrix< T > MatrixTemporaryType
 Concrete temporary matrix type used by expression-template machinery. More...
 
typedef Vector< T, std::vector< T > > VectorTemporaryType
 Concrete temporary vector type used when assembling vectors from this matrix. More...
 
- Public Types inherited from CDPL::Math::MatrixContainer< ScalarMatrix< T > >
typedef ScalarMatrix< 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

 ScalarMatrix ()
 Constructs an empty scalar matrix. More...
 
 ScalarMatrix (SizeType m, SizeType n, const ValueType &v=ValueType())
 Constructs a scalar matrix of size \( m \times n \) in which every entry equals v. More...
 
 ScalarMatrix (const ScalarMatrix &m)
 Constructs a copy of the scalar matrix m. More...
 
ConstReference operator() (SizeType i, SizeType j) const
 Returns a const reference to the common entry value. More...
 
bool isEmpty () const
 Tells whether the matrix is empty. More...
 
SizeType getSize1 () const
 Returns the logical number of rows. More...
 
SizeType getSize2 () const
 Returns the logical number of columns. More...
 
SizeType getMaxSize1 () const
 Returns the maximum representable row count. More...
 
SizeType getMaxSize2 () const
 Returns the maximum representable column count. More...
 
ScalarMatrixoperator= (const ScalarMatrix &m)
 Copy-assigns the dimensions and common value from m. More...
 
void swap (ScalarMatrix &m)
 Swaps the dimensions and common value with m. More...
 
void resize (SizeType m, SizeType n)
 Resizes the dimensions to \( m \times n \). More...
 
- Public Member Functions inherited from CDPL::Math::MatrixContainer< ScalarMatrix< 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...
 

Friends

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

Additional Inherited Members

- Protected Member Functions inherited from CDPL::Math::MatrixContainer< ScalarMatrix< 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::ScalarMatrix< T >

Constant matrix expression in which every entry equals the same scalar value.

Template Parameters
TThe scalar value type.

Member Typedef Documentation

◆ ValueType

template<typename T >
typedef T CDPL::Math::ScalarMatrix< T >::ValueType

The scalar value type.

◆ Reference

template<typename T >
typedef const T& CDPL::Math::ScalarMatrix< T >::Reference

Reference type (always a const reference — elements are immutable).

◆ ConstReference

template<typename T >
typedef const T& CDPL::Math::ScalarMatrix< T >::ConstReference

Constant reference type to the common value.

◆ SizeType

template<typename T >
typedef std::size_t CDPL::Math::ScalarMatrix< T >::SizeType

The unsigned size type.

◆ DifferenceType

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

The signed difference type.

◆ ClosureType

template<typename T >
typedef MatrixReference<SelfType> CDPL::Math::ScalarMatrix< T >::ClosureType

Closure type used when this matrix appears inside another expression.

◆ ConstClosureType

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

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

◆ MatrixTemporaryType

template<typename T >
typedef Matrix<T> CDPL::Math::ScalarMatrix< T >::MatrixTemporaryType

Concrete temporary matrix type used by expression-template machinery.

◆ VectorTemporaryType

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

Concrete temporary vector type used when assembling vectors from this matrix.

Constructor & Destructor Documentation

◆ ScalarMatrix() [1/3]

template<typename T >
CDPL::Math::ScalarMatrix< T >::ScalarMatrix ( )
inline

Constructs an empty scalar matrix.

◆ ScalarMatrix() [2/3]

template<typename T >
CDPL::Math::ScalarMatrix< T >::ScalarMatrix ( SizeType  m,
SizeType  n,
const ValueType v = ValueType() 
)
inline

Constructs a scalar matrix of size \( m \times n \) in which every entry equals v.

Parameters
mThe number of rows.
nThe number of columns.
vThe common entry value.

◆ ScalarMatrix() [3/3]

template<typename T >
CDPL::Math::ScalarMatrix< T >::ScalarMatrix ( const ScalarMatrix< T > &  m)
inline

Constructs a copy of the scalar matrix m.

Parameters
mThe scalar matrix to copy.

Member Function Documentation

◆ operator()()

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

Returns a const reference to the common entry value.

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

◆ isEmpty()

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

Tells whether the matrix is empty.

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

◆ getSize1()

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

Returns the logical number of rows.

Returns
The number of rows.

◆ getSize2()

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

Returns the logical number of columns.

Returns
The number of columns.

◆ getMaxSize1()

template<typename T >
SizeType CDPL::Math::ScalarMatrix< T >::getMaxSize1 ( ) const
inline

Returns the maximum representable row count.

Returns
The maximum number of rows.

◆ getMaxSize2()

template<typename T >
SizeType CDPL::Math::ScalarMatrix< T >::getMaxSize2 ( ) const
inline

Returns the maximum representable column count.

Returns
The maximum number of columns.

◆ operator=()

template<typename T >
ScalarMatrix& CDPL::Math::ScalarMatrix< T >::operator= ( const ScalarMatrix< T > &  m)
inline

Copy-assigns the dimensions and common value from m.

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

◆ swap()

template<typename T >
void CDPL::Math::ScalarMatrix< T >::swap ( ScalarMatrix< T > &  m)
inline

Swaps the dimensions and common value with m.

Parameters
mThe scalar matrix to swap with.

◆ resize()

template<typename T >
void CDPL::Math::ScalarMatrix< T >::resize ( SizeType  m,
SizeType  n 
)
inline

Resizes the dimensions to \( m \times n \).

Parameters
mThe new row count.
nThe new column count.

Friends And Related Function Documentation

◆ swap

template<typename T >
void swap ( ScalarMatrix< T > &  m1,
ScalarMatrix< T > &  m2 
)
friend

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

Parameters
m1The first scalar matrix.
m2The second scalar matrix.

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