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

N×N diagonal scaling matrix. More...

#include <AffineTransform.hpp>

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

Public Types

typedef T ValueType
 The scalar value type. More...
 
typedef const T Reference
 Element reference type (always a const reference — elements are computed). More...
 
typedef const T ConstReference
 Constant element reference type. 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, std::vector< 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< ScalingMatrix< T > >
typedef ScalingMatrix< 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. More...
 

Public Member Functions

 ScalingMatrix (SizeType n, const ValueType &sx=ValueType(1), const ValueType &sy=ValueType(1), const ValueType &sz=ValueType(1))
 Constructs an N×N scaling matrix with the supplied per-axis scale factors. More...
 
 ScalingMatrix (const ScalingMatrix &m)
 Constructs a copy of the scaling matrix m. More...
 
void set (const ValueType &sx=ValueType(1), const ValueType &sy=ValueType(1), const ValueType &sz=ValueType(1))
 Sets the per-axis scale factors. More...
 
ConstReference operator() (SizeType i, SizeType j) const
 Returns the scaling matrix element at (i, j). More...
 
bool isEmpty () const
 Tells whether the matrix is empty (size zero). More...
 
SizeType getSize1 () const
 Returns the dimension N (the row count). More...
 
SizeType getSize2 () const
 Returns the dimension N (the column count). More...
 
SizeType getMaxSize1 () const
 Returns the maximum representable row count. More...
 
SizeType getMaxSize2 () const
 Returns the maximum representable column count. More...
 
ScalingMatrixoperator= (const ScalingMatrix &m)
 Copy-assigns the dimension and the per-axis scale factors from m. More...
 
void swap (ScalingMatrix &m)
 Swaps the dimension and the per-axis scale factors with m. More...
 
void resize (SizeType n)
 Resizes the matrix dimension to n (the scale factors are left unchanged). More...
 
- Public Member Functions inherited from CDPL::Math::MatrixContainer< ScalingMatrix< T > >
const ContainerTypeoperator() () const
 Returns a const reference to the derived matrix container class instance. More...
 
ContainerTypeoperator() ()
 Returns a reference to the derived matrix container class instance. More...
 
- Public Member Functions inherited from CDPL::Math::MatrixExpression< E >
const ExpressionTypeoperator() () const
 Returns a const reference to the derived matrix expression class instance. More...
 
ExpressionTypeoperator() ()
 Returns a reference to the derived matrix expression class instance. More...
 

Friends

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

Additional Inherited Members

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

N×N diagonal scaling matrix.

The diagonal entries hold the per-axis scale factors; all off-diagonal entries are 0. The size \( N \) is configurable so the matrix can be combined with homogeneous coordinates.

Template Parameters
TThe scalar value type.

Member Typedef Documentation

◆ ValueType

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

The scalar value type.

◆ Reference

template<typename T >
typedef const T CDPL::Math::ScalingMatrix< T >::Reference

Element reference type (always a const reference — elements are computed).

◆ ConstReference

template<typename T >
typedef const T CDPL::Math::ScalingMatrix< T >::ConstReference

Constant element reference type.

◆ SizeType

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

The unsigned size type.

◆ DifferenceType

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

The signed difference type.

◆ ClosureType

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

Closure type used when this matrix appears inside another expression.

◆ ConstClosureType

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

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

◆ MatrixTemporaryType

template<typename T >
typedef Matrix<T, std::vector<T> > CDPL::Math::ScalingMatrix< T >::MatrixTemporaryType

Concrete temporary matrix type used by expression template machinery.

◆ VectorTemporaryType

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

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

Constructor & Destructor Documentation

◆ ScalingMatrix() [1/2]

template<typename T >
CDPL::Math::ScalingMatrix< T >::ScalingMatrix ( SizeType  n,
const ValueType sx = ValueType(1),
const ValueType sy = ValueType(1),
const ValueType sz = ValueType(1) 
)
inlineexplicit

Constructs an N×N scaling matrix with the supplied per-axis scale factors.

Parameters
nThe matrix dimension N.
sxThe x-axis scale factor (default: 1).
syThe y-axis scale factor (default: 1).
szThe z-axis scale factor (default: 1).

◆ ScalingMatrix() [2/2]

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

Constructs a copy of the scaling matrix m.

Parameters
mThe scaling matrix to copy.

Member Function Documentation

◆ set()

template<typename T >
void CDPL::Math::ScalingMatrix< T >::set ( const ValueType sx = ValueType(1),
const ValueType sy = ValueType(1),
const ValueType sz = ValueType(1) 
)
inline

Sets the per-axis scale factors.

Parameters
sxThe x-axis scale factor (default: 1).
syThe y-axis scale factor (default: 1).
szThe z-axis scale factor (default: 1).

◆ operator()()

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

Returns the scaling matrix element at (i, j).

Parameters
iThe zero-based row index.
jThe zero-based column index.
Returns
The corresponding axis scaling factor on a diagonal position and 0 off the diagonal.
Exceptions
Base::IndexErrorif either index is out of range.

◆ isEmpty()

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

Tells whether the matrix is empty (size zero).

Returns
true if N is zero, and false otherwise.

◆ getSize1()

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

Returns the dimension N (the row count).

Returns
N.

◆ getSize2()

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

Returns the dimension N (the column count).

Returns
N.

◆ getMaxSize1()

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

Returns the maximum representable row count.

Returns
The maximum row count.

◆ getMaxSize2()

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

Returns the maximum representable column count.

Returns
The maximum column count.

◆ operator=()

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

Copy-assigns the dimension and the per-axis scale factors from m.

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

◆ swap()

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

Swaps the dimension and the per-axis scale factors with m.

Parameters
mThe scaling matrix to swap with.

◆ resize()

template<typename T >
void CDPL::Math::ScalingMatrix< T >::resize ( SizeType  n)
inline

Resizes the matrix dimension to n (the scale factors are left unchanged).

Parameters
nThe new dimension.

Friends And Related Function Documentation

◆ swap

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

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

Parameters
m1The first scaling matrix.
m2The second scaling matrix.

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