PIP 5.6.1
Platform-Independent Primitives
Classes | Macros | Typedefs | Functions
pimathmatrix.h File Reference

Math matrix. More...

#include "pimathcomplex.h"
#include "pimathvector.h"

Classes

class  PIMathMatrixT< Rows, Cols, Type >
 Fixed-size math matrix. Stores matrix data inline and performs dimension checks at compile time where possible. More...
 
class  PIMathMatrix< Type >
 Dynamic-size math matrix. Uses PIVector2D as storage and keeps the matrix interface aligned with PIMathMatrixT. More...
 

Macros

#define PIMM_FOR
 Matrix templated. More...
 
#define PIMM_FOR
 Matrix templated. More...
 

Typedefs

typedef PIMathMatrixT< 2u, 2u, int > PIMathMatrixT22i
 2 x 2 fixed-size matrix of int.
 
typedef PIMathMatrixT< 3u, 3u, int > PIMathMatrixT33i
 3 x 3 fixed-size matrix of int.
 
typedef PIMathMatrixT< 4u, 4u, int > PIMathMatrixT44i
 4 x 4 fixed-size matrix of int.
 
typedef PIMathMatrixT< 2u, 2u, double > PIMathMatrixT22d
 2 x 2 fixed-size matrix of double.
 
typedef PIMathMatrixT< 3u, 3u, double > PIMathMatrixT33d
 3 x 3 fixed-size matrix of double.
 
typedef PIMathMatrixT< 4u, 4u, double > PIMathMatrixT44d
 4 x 4 fixed-size matrix of double.
 
typedef PIMathMatrix< int > PIMathMatrixi
 Dynamic matrix of int.
 
typedef PIMathMatrix< double > PIMathMatrixd
 Dynamic matrix of double.
 

Functions

template<uint Rows, uint Cols, typename Type >
PICout operator<< (PICout s, const PIMathMatrixT< Rows, Cols, Type > &m)
 Inline operator for outputting the matrix to the console. More...
 
template<uint CR, uint Rows0, uint Cols1, typename Type >
PIMathMatrixT< Rows0, Cols1, Type > operator* (const PIMathMatrixT< Rows0, CR, Type > &fm, const PIMathMatrixT< CR, Cols1, Type > &sm)
 Multiplying matrices by each other. More...
 
template<uint Cols, uint Rows, typename Type >
PIMathVectorT< Rows, Type > operator* (const PIMathMatrixT< Rows, Cols, Type > &fm, const PIMathVectorT< Cols, Type > &sv)
 Multiplying a matrix by a vector. More...
 
template<uint Cols, uint Rows, typename Type >
PIMathVectorT< Cols, Type > operator* (const PIMathVectorT< Rows, Type > &sv, const PIMathMatrixT< Rows, Cols, Type > &fm)
 Multiplying a vector by a matrix. More...
 
template<uint Cols, uint Rows, typename Type >
PIMathMatrixT< Rows, Cols, Type > operator* (const Type &x, const PIMathMatrixT< Rows, Cols, Type > &v)
 Multiplying a value of type Type by a matrix. More...
 
template<typename Type >
PICout operator<< (PICout s, const PIMathMatrix< Type > &m)
 Inline operator for outputting the matrix to the console. More...
 
template<typename P , typename T >
PIBinaryStream< P > & operator<< (PIBinaryStream< P > &s, const PIMathMatrix< T > &v)
 Inline operator for serializing a matrix into a PIBinaryStream. More...
 
template<typename P , typename T >
PIBinaryStream< P > & operator>> (PIBinaryStream< P > &s, PIMathMatrix< T > &v)
 Inline operator to deserialize matrix from PIByteArray. More...
 
template<typename Type >
PIMathMatrix< Type > operator* (const PIMathMatrix< Type > &fm, const PIMathMatrix< Type > &sm)
 Multiplying matrices by each other. More...
 
template<typename Type >
PIMathVector< Type > operator* (const PIMathMatrix< Type > &fm, const PIMathVector< Type > &sv)
 Multiplying a matrix by a vector. More...
 
template<typename Type >
PIMathVector< Type > operator* (const PIMathVector< Type > &sv, const PIMathMatrix< Type > &fm)
 Multiplying a vector by a matrix. More...
 
template<typename Type >
PIMathMatrix< Type > operator* (const Type &x, const PIMathMatrix< Type > &v)
 Multiplying a value of type Type by a matrix. More...
 
template<typename T >
PIMathMatrix< complex< T > > hermitian (const PIMathMatrix< complex< T > > &m)
 Returns the Hermitian form of complex matrix m.
 

Detailed Description

Math matrix.

Macro Definition Documentation

◆ PIMM_FOR [1/2]

#define PIMM_FOR
Value:
for (uint r = 0; r < Rows; ++r) \
for (uint c = 0; c < Cols; ++c)

Matrix templated.

Matrix.

◆ PIMM_FOR [2/2]

#define PIMM_FOR
Value:
for (uint r = 0; r < _V2D::rows_; ++r) \
for (uint c = 0; c < _V2D::cols_; ++c)

Matrix templated.

Matrix.

Function Documentation

◆ operator<<() [1/3]

template<uint Rows, uint Cols, typename Type >
PICout operator<< ( PICout  s,
const PIMathMatrixT< Rows, Cols, Type > &  m 
)
inline

Inline operator for outputting the matrix to the console.

Parameters
sPICout type.
thematrix type PIMathMatrix that we print to the console.
Returns
PIMathMatrix printed to the console.

◆ operator*() [1/8]

template<uint CR, uint Rows0, uint Cols1, typename Type >
PIMathMatrixT< Rows0, Cols1, Type > operator* ( const PIMathMatrixT< Rows0, CR, Type > &  fm,
const PIMathMatrixT< CR, Cols1, Type > &  sm 
)
inline

Multiplying matrices by each other.

Parameters
fmfirst matrix multiplier.
smsecond matrix multiplier.
Returns
matrix that is the result of multiplication.

◆ operator*() [2/8]

template<uint Cols, uint Rows, typename Type >
PIMathVectorT< Rows, Type > operator* ( const PIMathMatrixT< Rows, Cols, Type > &  fm,
const PIMathVectorT< Cols, Type > &  sv 
)
inline

Multiplying a matrix by a vector.

Parameters
fmfirst matrix multiplier
svsecond vector multiplier
Returns
vector that is the result of multiplication

◆ operator*() [3/8]

template<uint Cols, uint Rows, typename Type >
PIMathVectorT< Cols, Type > operator* ( const PIMathVectorT< Rows, Type > &  sv,
const PIMathMatrixT< Rows, Cols, Type > &  fm 
)
inline

Multiplying a vector by a matrix.

Parameters
svfirst vector multiplier
fmsecond matrix multiplier
Returns
vector that is the result of multiplication

◆ operator*() [4/8]

template<uint Cols, uint Rows, typename Type >
PIMathMatrixT< Rows, Cols, Type > operator* ( const Type &  x,
const PIMathMatrixT< Rows, Cols, Type > &  v 
)
inline

Multiplying a value of type Type by a matrix.

Parameters
xfirst multiplier of type Type.
vsecond matrix multiplier.
Returns
matrix that is the result of multiplication.

◆ operator<<() [2/3]

template<typename Type >
PICout operator<< ( PICout  s,
const PIMathMatrix< Type > &  m 
)
inline

Inline operator for outputting the matrix to the console.

Parameters
sPICout type.
thematrix type PIMathMatrix that we print to the console.
Returns
PIMathMatrix printed to the console.

◆ operator<<() [3/3]

template<typename P , typename T >
PIBinaryStream< P > & operator<< ( PIBinaryStream< P > &  s,
const PIMathMatrix< T > &  v 
)
inline

Inline operator for serializing a matrix into a PIBinaryStream.

Parameters
sPIBinaryStream type.
vPIMathMatrix type.

◆ operator>>()

template<typename P , typename T >
PIBinaryStream< P > & operator>> ( PIBinaryStream< P > &  s,
PIMathMatrix< T > &  v 
)
inline

Inline operator to deserialize matrix from PIByteArray.

Parameters
sPIBinaryStream type.
vPIMathMatrix type.

◆ operator*() [5/8]

template<typename Type >
PIMathMatrix< Type > operator* ( const PIMathMatrix< Type > &  fm,
const PIMathMatrix< Type > &  sm 
)
inline

Multiplying matrices by each other.

If you enter an index out of the border of the matrix there will be "undefined behavior".

Parameters
fmfirst matrix multiplier.
smsecond matrix multiplier.
Returns
matrix that is the result of multiplication.

◆ operator*() [6/8]

template<typename Type >
PIMathVector< Type > operator* ( const PIMathMatrix< Type > &  fm,
const PIMathVector< Type > &  sv 
)
inline

Multiplying a matrix by a vector.

If you enter an index out of the border of the matrix there will be "undefined behavior".

Parameters
fmfirst matrix multiplier
svsecond vector multiplier
Returns
vector that is the result of multiplication

◆ operator*() [7/8]

template<typename Type >
PIMathVector< Type > operator* ( const PIMathVector< Type > &  sv,
const PIMathMatrix< Type > &  fm 
)
inline

Multiplying a vector by a matrix.

If you enter an index out of the border of the matrix there will be "undefined behavior".

Parameters
svfirst vector multiplier
fmsecond matrix multiplier
Returns
vector that is the result of multiplication

◆ operator*() [8/8]

template<typename Type >
PIMathMatrix< Type > operator* ( const Type &  x,
const PIMathMatrix< Type > &  v 
)
inline

Multiplying a value of type Type by a matrix.

Parameters
xfirst multiplier of type Type.
vsecond matrix multiplier.
Returns
matrix that is the result of multiplication.