concepts::Mapping< F, DimY, DimX > Class Template Reference

Basic class for a 2D or 3D map. More...

#include <vectorsMatrices.hh>

Public Member Functions

Mapping< F, DimY, DimX > adjugate () const
 Returns the adjugate of the matrix (only valid for square matrices) [f \mbox{adj}(M) = M^{-1}\det(M) \f]. More...
 
Point< F, DimY > column (const uint i) const
 Returns a column of the matrix. More...
 
determinant () const
 Returns the determinant of the matrix (only valid for square matrices) More...
 
std::ostream & info (std::ostream &os) const
 
Mapping< F, DimX, DimY > inverse () const
 Returns the inverse of the matrix. More...
 
 Mapping ()
 Default constructor. More...
 
 Mapping (const Mapping< F, DimY, DimX > &m)
 Copy constructor. More...
 
template<class H >
 Mapping (const Mapping< H, DimY, DimX > &m)
 Constructor. More...
 
 Mapping (const Point< F, DimY > first)
 Constructor for a 1D. More...
 
 Mapping (const Point< F, DimY > first, const Point< F, DimY > second)
 Constructor for a 2D mapping. More...
 
 Mapping (const Point< F, DimY > first, const Point< F, DimY > second, const Point< F, DimY > third)
 Constructor for a 3D mapping. More...
 
 Mapping (const UnitNd< DimY > &n)
 Constructor for rotation. More...
 
template<class... FieldTs>
 Mapping (FieldTs... data)
 Constructor with variadic templates. More...
 
template<class G >
 Mapping (G x)
 Constructor. More...
 
template<class H >
Point< H, DimY > mapPoint (const Point< H, DimX > &b) const
 
template<class H >
void mapTranspose (const Point< H, DimY > &y, Point< H, DimX > &x) const
 Computes x = AT y. More...
 
template<class H , class J , uint dimy, uint dimx>
void operator() (const Point< H, dimy > &y, Point< J, dimx > &x) const
 Application operator. More...
 
F & operator() (uint i, uint j)
 Returns an entry of the matrix (for read / write access) More...
 
const F & operator() (uint i, uint j) const
 Returns an entry of the matrix. More...
 
template<class G >
Mapping< typename Combtype< G, F >::type, DimY, DimX > operator* (const G n) const
 Scaling operator. More...
 
template<class G , uint DimZ>
Mapping< typename Combtype< G, F >::type, DimY, DimZ > operator* (const Mapping< G, DimX, DimZ > &m) const
 Multiplication operator. More...
 
template<class H >
Point< typename Combtype< F, H >::type, DimY > operator* (const Point< H, DimX > &p) const
 Returns a mapped Point. More...
 
Mapping< F, DimY, DimX > & operator*= (const F n)
 Scaling operator. More...
 
Mapping< F, DimY, DimX > & operator*= (const Mapping< F, DimY, DimX > &m)
 Multiplication operator ( *this = operator()(*this, m); ) More...
 
Mapping< F, DimY, DimX > & operator+= (const Mapping< F, DimY, DimX > &M)
 Addition operator. More...
 
Mapping< F, DimY, DimY > prodTranspose () const
 Returns the product with the transpose of the matrix. More...
 
void rank1Product (const Point< F, DimX > x, const Point< F, DimY > y)
 Computes x yT and adds the result to the matrix. More...
 
Mapping< F, DimY, DimX > & scaleCols (const Point< F, DimX > &s)
 Scales the columns with the respective entries in s. More...
 
Mapping< F, DimY, DimX > & scaleRows (const Point< F, DimY > &s)
 Scales the rows with the respective entries in s. More...
 
Mapping< F, DimY-1, DimX-1 > subMatrix (uint i, uint j) const
 Returns the submatrix where the ith and jth column are erased. More...
 
trace () const
 Returns the trace (only valid for square matrices) More...
 
Mapping< F, DimX, DimY > transpose () const
 Returns the transpose of the matrix. More...
 
void zeros ()
 Fills the matrix with zeros. More...
 

Private Member Functions

const uint lin_ (uint i, uint j) const
 index in stack array of entry (i,j) of row-based matrix
More...
 

Private Attributes

data_ [DimX *DimY]
 entries of the matrix More...
 

Detailed Description

template<class F, uint DimY, uint DimX = DimY>
class concepts::Mapping< F, DimY, DimX >

Basic class for a 2D or 3D map.

The template parameters make it possible to use this class for real or complex values. The main use is to represent linear maps in 2D or 3D.

Test:
test::MappingTest
Author
Philipp Frauenfelder, 2001

Definition at line 313 of file vectorsMatrices.hh.

Constructor & Destructor Documentation

◆ Mapping() [1/9]

template<class F , uint DimY, uint DimX = DimY>
concepts::Mapping< F, DimY, DimX >::Mapping ( )
inline

Default constructor.

The elements of the matrix are left uninitialized.

Definition at line 318 of file vectorsMatrices.hh.

◆ Mapping() [2/9]

template<class F , uint DimY, uint DimX = DimY>
concepts::Mapping< F, DimY, DimX >::Mapping ( const Mapping< F, DimY, DimX > &  m)
inline

Copy constructor.

Definition at line 321 of file vectorsMatrices.hh.

◆ Mapping() [3/9]

template<class F , uint DimY, uint DimX = DimY>
template<class H >
concepts::Mapping< F, DimY, DimX >::Mapping ( const Mapping< H, DimY, DimX > &  m)
inline

Constructor.

Useful to generate a Mapping<Cmplx,DimX,DimY> out of a Mapping<Real,DimX,DimY>.

Precondition
F has a function F.operator=(H)

Definition at line 331 of file vectorsMatrices.hh.

◆ Mapping() [4/9]

template<class F , uint DimY, uint DimX = DimY>
template<class G >
concepts::Mapping< F, DimY, DimX >::Mapping ( x)
inline

Constructor.

All elements are initialized to x.

Definition at line 344 of file vectorsMatrices.hh.

◆ Mapping() [5/9]

template<class F , uint DimY, uint DimX = DimY>
template<class... FieldTs>
concepts::Mapping< F, DimY, DimX >::Mapping ( FieldTs...  data)
inline

Constructor with variadic templates.

Can be sed to construct matrices of any size by giving the entries as parameters, e.g. Mapping<Real,2,2>(1.,2.,3.,4.) creates a 2x2 matrix, while Mapping<Real,2,2>(1.,2.,3.) will produce an assertion as the number of entries (i.e. 3) mismatches the dimension 2x2.

Note
The flag MappingConstructorHack has to be set to 1 considering Py++ with C++11 standard

Definition at line 359 of file vectorsMatrices.hh.

◆ Mapping() [6/9]

template<class F , uint DimY, uint DimX = DimY>
concepts::Mapping< F, DimY, DimX >::Mapping ( const Point< F, DimY >  first)

Constructor for a 1D.

Parameters
firstFirst column of the matrix

◆ Mapping() [7/9]

template<class F , uint DimY, uint DimX = DimY>
concepts::Mapping< F, DimY, DimX >::Mapping ( const Point< F, DimY >  first,
const Point< F, DimY >  second 
)

Constructor for a 2D mapping.

Parameters
firstFirst column of the matrix
secondSecond column of the matrix

◆ Mapping() [8/9]

template<class F , uint DimY, uint DimX = DimY>
concepts::Mapping< F, DimY, DimX >::Mapping ( const Point< F, DimY >  first,
const Point< F, DimY >  second,
const Point< F, DimY >  third 
)

Constructor for a 3D mapping.

Parameters
firstFirst column of the matrix
secondSecond column of the matrix
thirdThird column of the matrix

◆ Mapping() [9/9]

template<class F , uint DimY, uint DimX = DimY>
concepts::Mapping< F, DimY, DimX >::Mapping ( const UnitNd< DimY > &  n)

Constructor for rotation.

Parameters
nNormal vector of the rotation

Member Function Documentation

◆ adjugate()

template<class F , uint DimY, uint DimX = DimY>
Mapping<F, DimY, DimX> concepts::Mapping< F, DimY, DimX >::adjugate ( ) const

Returns the adjugate of the matrix (only valid for square matrices) [f \mbox{adj}(M) = M^{-1}\det(M) \f].

◆ column()

template<class F , uint DimY, uint DimX = DimY>
Point<F, DimY> concepts::Mapping< F, DimY, DimX >::column ( const uint  i) const

Returns a column of the matrix.

◆ determinant()

template<class F , uint DimY, uint DimX = DimY>
F concepts::Mapping< F, DimY, DimX >::determinant ( ) const

Returns the determinant of the matrix (only valid for square matrices)

◆ info()

template<class F , uint DimY, uint DimX = DimY>
std::ostream& concepts::Mapping< F, DimY, DimX >::info ( std::ostream &  os) const

◆ inverse()

template<class F , uint DimY, uint DimX = DimY>
Mapping<F, DimX, DimY> concepts::Mapping< F, DimY, DimX >::inverse ( ) const

Returns the inverse of the matrix.

◆ lin_()

template<class F , uint DimY, uint DimX = DimY>
const uint concepts::Mapping< F, DimY, DimX >::lin_ ( uint  i,
uint  j 
) const
inlineprivate

index in stack array of entry (i,j) of row-based matrix

Definition at line 524 of file vectorsMatrices.hh.

◆ mapPoint()

template<class F , uint DimY, uint DimX = DimY>
template<class H >
Point<H, DimY> concepts::Mapping< F, DimY, DimX >::mapPoint ( const Point< H, DimX > &  b) const
inline

Definition at line 459 of file vectorsMatrices.hh.

◆ mapTranspose()

template<class F , uint DimY, uint DimX>
template<class H >
void concepts::Mapping< F, DimY, DimX >::mapTranspose ( const Point< H, DimY > &  y,
Point< H, DimX > &  x 
) const
inline

Computes x = AT y.

Parameters
Hcan be F or any more general class that can operate on instances of F.

Definition at line 540 of file vectorsMatrices.hh.

◆ operator()() [1/3]

template<class F , uint DimY, uint DimX>
template<class H , class J , uint dimy, uint dimx>
void concepts::Mapping< F, DimY, DimX >::operator() ( const Point< H, dimy > &  y,
Point< J, dimx > &  x 
) const

Application operator.

Computes x = A y where A is the matrix. If the dimensions do not match the matrix A is extended by the identity matrix.

Definition at line 557 of file vectorsMatrices.hh.

◆ operator()() [2/3]

template<class F , uint DimY, uint DimX = DimY>
F& concepts::Mapping< F, DimY, DimX >::operator() ( uint  i,
uint  j 
)
inline

Returns an entry of the matrix (for read / write access)

Definition at line 446 of file vectorsMatrices.hh.

◆ operator()() [3/3]

template<class F , uint DimY, uint DimX = DimY>
const F& concepts::Mapping< F, DimY, DimX >::operator() ( uint  i,
uint  j 
) const
inline

Returns an entry of the matrix.

Definition at line 437 of file vectorsMatrices.hh.

◆ operator*() [1/3]

template<class F , uint DimY, uint DimX = DimY>
template<class G >
Mapping<typename Combtype<G,F>::type, DimY, DimX> concepts::Mapping< F, DimY, DimX >::operator* ( const G  n) const

Scaling operator.

◆ operator*() [2/3]

template<class F , uint DimY, uint DimX = DimY>
template<class G , uint DimZ>
Mapping<typename Combtype<G,F>::type, DimY, DimZ> concepts::Mapping< F, DimY, DimX >::operator* ( const Mapping< G, DimX, DimZ > &  m) const

Multiplication operator.

◆ operator*() [3/3]

template<class F , uint DimY, uint DimX>
template<class H >
Point< typename Combtype< F, H >::type, DimY > concepts::Mapping< F, DimY, DimX >::operator* ( const Point< H, DimX > &  p) const

Returns a mapped Point.

Definition at line 531 of file vectorsMatrices.hh.

◆ operator*=() [1/2]

template<class F , uint DimY, uint DimX = DimY>
Mapping<F, DimY, DimX>& concepts::Mapping< F, DimY, DimX >::operator*= ( const F  n)

Scaling operator.

◆ operator*=() [2/2]

template<class F , uint DimY, uint DimX = DimY>
Mapping<F, DimY, DimX>& concepts::Mapping< F, DimY, DimX >::operator*= ( const Mapping< F, DimY, DimX > &  m)

Multiplication operator ( *this = operator()(*this, m); )

◆ operator+=()

template<class F , uint DimY, uint DimX = DimY>
Mapping<F, DimY, DimX>& concepts::Mapping< F, DimY, DimX >::operator+= ( const Mapping< F, DimY, DimX > &  M)

Addition operator.

◆ prodTranspose()

template<class F , uint DimY, uint DimX = DimY>
Mapping<F, DimY, DimY> concepts::Mapping< F, DimY, DimX >::prodTranspose ( ) const

Returns the product with the transpose of the matrix.

◆ rank1Product()

template<class F , uint DimY, uint DimX = DimY>
void concepts::Mapping< F, DimY, DimX >::rank1Product ( const Point< F, DimX >  x,
const Point< F, DimY >  y 
)

Computes x yT and adds the result to the matrix.

◆ scaleCols()

template<class F , uint DimY, uint DimX = DimY>
Mapping<F, DimY, DimX>& concepts::Mapping< F, DimY, DimX >::scaleCols ( const Point< F, DimX > &  s)

Scales the columns with the respective entries in s.

◆ scaleRows()

template<class F , uint DimY, uint DimX = DimY>
Mapping<F, DimY, DimX>& concepts::Mapping< F, DimY, DimX >::scaleRows ( const Point< F, DimY > &  s)

Scales the rows with the respective entries in s.

◆ subMatrix()

template<class F , uint DimY, uint DimX = DimY>
Mapping<F, DimY-1, DimX-1> concepts::Mapping< F, DimY, DimX >::subMatrix ( uint  i,
uint  j 
) const

Returns the submatrix where the ith and jth column are erased.

◆ trace()

template<class F , uint DimY, uint DimX = DimY>
F concepts::Mapping< F, DimY, DimX >::trace ( ) const

Returns the trace (only valid for square matrices)

◆ transpose()

template<class F , uint DimY, uint DimX = DimY>
Mapping<F, DimX, DimY> concepts::Mapping< F, DimY, DimX >::transpose ( ) const

Returns the transpose of the matrix.

◆ zeros()

template<class F , uint DimY, uint DimX = DimY>
void concepts::Mapping< F, DimY, DimX >::zeros ( )
inline

Fills the matrix with zeros.

Definition at line 497 of file vectorsMatrices.hh.

Member Data Documentation

◆ data_

template<class F , uint DimY, uint DimX = DimY>
F concepts::Mapping< F, DimY, DimX >::data_[DimX *DimY]
private

entries of the matrix

Definition at line 521 of file vectorsMatrices.hh.


The documentation for this class was generated from the following file:
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich