Linear
Linear::Matrix< T, M, N, Flags > Class Template Reference

Class for matrices. More...

#include <Matrix.h>

Public Member Functions

 Matrix (T x=T(0))
 Constructor. More...
 
 Matrix (Complex< T > z)
 Constructor. More...
 
 Matrix (size_t size, T x)
 Constructor. More...
 
 Matrix (size_t size, Complex< T > z)
 Constructor. More...
 
 Matrix (size_t nrows, size_t ncols, T x)
 Constructor. More...
 
 Matrix (size_t nrows, size_t ncols, Complex< T > z)
 Constructor. More...
 
 Matrix (std::initializer_list< T > list)
 Constructor. More...
 
 Matrix (std::initializer_list< Complex< T >> list)
 Constructor. More...
 
 Matrix (std::initializer_list< std::initializer_list< T >> list)
 Constructor. More...
 
 Matrix (std::initializer_list< std::initializer_list< Complex< T >>> list)
 Constructor. More...
 
 Matrix (const Matrix< T, M, N, Flags > &copy)
 Constructor. More...
 
template<typename U , size_t P, size_t Q, unsigned int Flags2>
 Matrix (const Matrix< U, P, Q, Flags2 > &other)
 Constructor. More...
 
void Resize (size_t newSize)
 Resizes a dynamic matrix. More...
 
void Resize (size_t newM, size_t newN)
 Resizes a dynamic matrix. More...
 
size_t NumRows () const
 
size_t NumColumns () const
 
size_t NumEntries () const
 
Matrix< T, 1, 2 > Size () const
 
size_t Length () const
 For vectors, this returns the length of the vector. More...
 
Complex< T > * Data ()
 
Matrix< T, 1, N > GetRow (size_t r) const
 Takes row r of the matrix and returns it. More...
 
Matrix< T, M, 1 > GetColumn (size_t c) const
 Takes column c of the matrix and returns it. More...
 
template<size_t P, size_t Q>
std::enable_if<(P==1||P==Dynamic)&&(Q==N||Q==Dynamic||N==Dynamic), void >::type SetRow (size_t r, const Matrix< T, P, Q > &row)
 Sets row r of the matrix to row. More...
 
template<size_t P, size_t Q>
std::enable_if<(P==M||P==Dynamic||M==Dynamic)&&(Q==1||Q==Dynamic), void >::type SetColumn (size_t c, const Matrix< T, P, Q > &column)
 Sets column c of the matrix to row. More...
 
void SwapRows (size_t r1, size_t r2)
 Swaps rows r1 and r2. More...
 
void ScaleRow (size_t r, Complex< T > s)
 Scales row r by s, i.e., \(a_{ri}=sa_{ri}\) for \(0\le i<N\). More...
 
void AddRows (size_t r1, size_t r2, Complex< T > s)
 Scales row r2 by s then adds it to r1, i.e., \(a_{r1,i}=a_{r1,i}+sa_{r2,i}\) for \(0\le i<N\). More...
 
Complex< T > operator[] (size_t i) const
 Operators. More...
 
Complex< T > & operator[] (size_t i)
 
Complex< T > operator() (size_t r, size_t c) const
 Returns the the data located in row r and column c. More...
 
Complex< T > & operator() (size_t r, size_t c)
 
template<typename U , typename std::enable_if< std::is_convertible< T, U >::value >::type * = nullptr>
 operator Matrix< U, M, N, Flags > ()
 
template<size_t P, size_t Q, unsigned int Flags2>
Matrix< T, M, N, Flags > & operator= (const Matrix< T, P, Q, Flags2 > &other)
 Set the matrix to other. More...
 
template<size_t P, size_t Q, unsigned int Flags2>
Matrix< T, M, N, Flags > & operator+= (const Matrix< T, P, Q, Flags2 > &other)
 
template<size_t P, size_t Q, unsigned int Flags2>
Matrix< T, M, N, Flags > & operator-= (const Matrix< T, P, Q, Flags2 > &other)
 
template<size_t P, size_t Q, unsigned int Flags2>
Matrix< T, M, N, Flags > & operator*= (const Matrix< T, P, Q, Flags2 > &other)
 
Matrix< T, M, N, Flags > & operator*= (Complex< T > other)
 
Matrix< T, M, N, Flags > & operator/= (Complex< T > other)
 
Matrix< T, M, N, Flags > operator- ()
 

Friends

template<size_t P, size_t Q, unsigned int Flags2>
Matrix< T, M, N, Flags > operator+ (Matrix< T, M, N, Flags > A, const Matrix< T, P, Q, Flags2 > &B)
 Computes the MxN matrix \(C=A+B\) defined by \(c_{ij}=a_{ij}+b_{ij}\). More...
 
template<size_t P, size_t Q, unsigned int Flags2>
Matrix< T, M, N, Flags > operator- (Matrix< T, M, N, Flags > A, const Matrix< T, P, Q, Flags2 > &B)
 Computes the MxN matrix \(C=A-B\) defined by \(c_{ij}=a_{ij}-b_{ij}\). More...
 
Matrix< T, M, N, Flags > operator* (Matrix< T, M, N, Flags > A, const Complex< T > &s)
 Computes the MxN matrix \(B=sA\) defined by \(b_{ij}=sa_{ij}\). More...
 
Matrix< T, M, N, Flags > operator* (const Complex< T > &s, Matrix< T, M, N, Flags > A)
 Computes the MxN matrix \(B=sA\) defined by \(b_{ij}=sa_{ij}\). More...
 
Matrix< T, M, N, Flags > operator/ (Matrix< T, M, N, Flags > A, const Complex< T > &s)
 Computes the MxN matrix \(B=A/s\) defined by \(b_{ij}=a_{ij}/s\). More...
 
template<size_t P, size_t Q, unsigned int Flags2>
Matrix< T, M, Q, Flags > operator* (const Matrix< T, M, N, Flags > &A, const Matrix< T, P, Q, Flags2 > &B)
 Computes the MxQ matrix \(C=AB\) defined by \(c_{ij}=\sum_{k=0}^{N-1}a_{ik}b_{kj}\). More...
 
std::ostream & operator<< (std::ostream &out, const Matrix< T, M, N, Flags > &m)
 Takes a matrix and writes to out in a formatted manner. More...
 
template<size_t P, size_t Q, unsigned int Flags2>
bool operator== (const Matrix< T, M, N, Flags > &a, const Matrix< T, P, Q, Flags2 > &b)
 Compares two matrices entrywise. More...
 
template<size_t P, size_t Q, unsigned int Flags2>
bool operator!= (const Matrix< T, M, N, Flags > &a, const Matrix< T, P, Q, Flags2 > &b)
 Compares two matrices entrywise. More...
 

Detailed Description

template<typename T, size_t M, size_t N, unsigned int Flags = 0>
class Linear::Matrix< T, M, N, Flags >

Class for matrices.

Parameters
TType to store the real and imaginary part of each entry as.
MNumber of rows. Use Dynamic to allow this value to change over time.
NNumber of column. Use Dynamic to allow this value to change over time.
FlagsWhether to use row major storage or column major storage. (default = row major).

Constructor & Destructor Documentation

◆ Matrix() [1/12]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Linear::Matrix< T, M, N, Flags >::Matrix ( x = T(0))
inline

Constructor.

Creates the M-by-N matrix \(A\) where \(a_{ij}=x\) for all \(i,j\). If M or N are set to Dynamic, a 0x0 matrix will be created.

Parameters
xReal number (default = 0)

◆ Matrix() [2/12]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Linear::Matrix< T, M, N, Flags >::Matrix ( Complex< T >  z)
inline

Constructor.

Creates the M-by-N matrix \(A\) where \(a_{ij}=z\) for all \(i,j\). If M or N are set to Dynamic, a 0x0 matrix will be created.

Parameters
valComplex number

◆ Matrix() [3/12]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Linear::Matrix< T, M, N, Flags >::Matrix ( size_t  size,
x 
)
inline

Constructor.

Creates the M-by-N matrix \(A\) where \(a_{ij}=x\) for all \(i,j\). If M or N are set to Dynamic, they will be set to size. Otherwise, the size parameter is ignored.

Parameters
sizeSize to set M or N if they are set to Dynamic.
xReal number (default = 0)

◆ Matrix() [4/12]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Linear::Matrix< T, M, N, Flags >::Matrix ( size_t  size,
Complex< T >  z 
)
inline

Constructor.

Creates the M-by-N matrix \(A\) where \(a_{ij}=z\) for all \(i,j\). If M or N are set to Dynamic, they will be set to size. Otherwise, the size parameter is ignored.

Parameters
sizeSize to set M or N if they are set to Dynamic.
zComplex number

◆ Matrix() [5/12]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Linear::Matrix< T, M, N, Flags >::Matrix ( size_t  nrows,
size_t  ncols,
x 
)
inline

Constructor.

Creates the M-by-N matrix \(A\) where \(a_{ij}=x\) for all \(i,j\). If M is set to Dynamic, it will be set to nrows. If N is set to Dynamic, it will be set to ncols. Otherwise, the nrows and ncols parameters are ignored.

Parameters
nrowsSize to set M if it is set to Dynamic.
ncolsSize to set N if it is set to Dynamic.
xReal number (default = 0)

◆ Matrix() [6/12]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Linear::Matrix< T, M, N, Flags >::Matrix ( size_t  nrows,
size_t  ncols,
Complex< T >  z 
)
inline

Constructor.

Creates the M-by-N matrix \(A\) where \(a_{ij}=z\) for all \(i,j\). If M is set to Dynamic, it will be set to nrows. If N is set to Dynamic, it will be set to ncols. Otherwise, the nrows and ncols parameters are ignored.

Parameters
nrowsSize to set M if it is set to Dynamic.
ncolsSize to set N if it is set to Dynamic.
zComplex number

◆ Matrix() [7/12]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Linear::Matrix< T, M, N, Flags >::Matrix ( std::initializer_list< T >  list)
inline

Constructor.

Creates the M-by-N matrix \(A\) by filling in entries from list. The order they are filled in depend on Flags. If the list is longer than M*N, then the remaining entries are ignored. If the list is shorter than M*N, then the remaining entries are set to zero.

If both M and N is set to Dynamic, it will set M to the list's size and N to 1. If just M is Dynamic or just N is Dynamic, it will set the Dynamic size to the list's size divided the non-Dynamic size. However, if the list's size is less than the non-Dynamic size, it will set the Dynamic size to 1.

Parameters
listInitializer list of real numbers

◆ Matrix() [8/12]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Linear::Matrix< T, M, N, Flags >::Matrix ( std::initializer_list< Complex< T >>  list)
inline

Constructor.

Creates the M-by-N matrix \(A\) by filling in entries from list. The order they are filled in depend on Flags. If the list is longer than M*N, then the remaining entries are ignored. If the list is shorter than M*N, then the remaining entries are set to zero.

If both M and N is set to Dynamic, it will set M to the list's size and N to 1. If just M is Dynamic or just N is Dynamic, it will set the Dynamic size to the list's size divided the non-Dynamic size. However, if the list's size is less than the non-Dynamic size, it will set the Dynamic size to 1.

Parameters
listInitializer list of Complex numbers

◆ Matrix() [9/12]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Linear::Matrix< T, M, N, Flags >::Matrix ( std::initializer_list< std::initializer_list< T >>  list)
inline

Constructor.

Creates the M-by-N matrix \(A\) by filling in entries from list. Each initializer list in list represents a row of A. If that row is longer than N, than the remaining elements of that row are ignored. If that row is shorter than N, the remaining elements are zero to zero.

If M is set to Dynamic, it will set M to the number of rows in the list. If N is set to Dynamic, it will set N to the longest row on the list.

Parameters
listInitializer list of initializer lists of real numbers.

◆ Matrix() [10/12]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Linear::Matrix< T, M, N, Flags >::Matrix ( std::initializer_list< std::initializer_list< Complex< T >>>  list)
inline

Constructor.

Creates the M-by-N matrix \(A\) by filling in entries from list. Each initializer list in list represents a row of A. If that row is longer than N, than the remaining elements of that row are ignored. If that row is shorter than N, the remaining elements are zero to zero.

If M is set to Dynamic, it will set M to the number of rows in the list. If N is set to Dynamic, it will set N to the longest row on the list.

Parameters
listInitializer list of initializer lists of complex numbers.

◆ Matrix() [11/12]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Linear::Matrix< T, M, N, Flags >::Matrix ( const Matrix< T, M, N, Flags > &  copy)
inline

Constructor.

Copies the MxN matrix other.

Parameters
otherMxN Matrix

◆ Matrix() [12/12]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
template<typename U , size_t P, size_t Q, unsigned int Flags2>
Linear::Matrix< T, M, N, Flags >::Matrix ( const Matrix< U, P, Q, Flags2 > &  other)
inline

Constructor.

Creates the M-by-N matrix \(A\) by copying the matrix given by other. If Q < N, the remaining N-Q elements of each row will be set to zero. If Q > N, the remaining Q-N elements of other is ignored. If P < M, the remaining M-P rows will be set to zero. If P > M, the remaining P-M rows of other is ignored.

If M is set to Dynamic, it will set M to P. If N is set to Dynamic, it will set N to Q.

Parameters
otherPxQ Matrix

Member Function Documentation

◆ AddRows()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
void Linear::Matrix< T, M, N, Flags >::AddRows ( size_t  r1,
size_t  r2,
Complex< T >  s 
)
inline

Scales row r2 by s then adds it to r1, i.e., \(a_{r1,i}=a_{r1,i}+sa_{r2,i}\) for \(0\le i<N\).

If \(r1\ge M\) or \(r2\ge M\) an exception is thrown.

Parameters
r1Row 1 index
r2Row 2 index
sComplex number

◆ Data()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Complex<T>* Linear::Matrix< T, M, N, Flags >::Data ( )
inline
Returns
Pointer to matrix data.

◆ GetColumn()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Matrix<T,M,1> Linear::Matrix< T, M, N, Flags >::GetColumn ( size_t  c) const
inline

Takes column c of the matrix and returns it.

If \(c\ge N\), an exception is thrown.

Parameters
cColumn index
Returns
Mx1 Matrix

◆ GetRow()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Matrix<T,1,N> Linear::Matrix< T, M, N, Flags >::GetRow ( size_t  r) const
inline

Takes row r of the matrix and returns it.

If \(r\ge M\), an exception is thrown.

Parameters
rRow index
Returns
1xN Matrix

◆ Length()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
size_t Linear::Matrix< T, M, N, Flags >::Length ( ) const
inline

For vectors, this returns the length of the vector.

For matrices, returns either M or N depending on what's larger. If empty, 0 is returned.

Returns
When non-empty, MAX(NumRows(),NumColumns()). Otherwise 0.

◆ NumColumns()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
size_t Linear::Matrix< T, M, N, Flags >::NumColumns ( ) const
inline
Returns
Number of columns

◆ NumEntries()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
size_t Linear::Matrix< T, M, N, Flags >::NumEntries ( ) const
inline
Returns
Number of entries (Identical to NumRows()*NumColumns())

◆ NumRows()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
size_t Linear::Matrix< T, M, N, Flags >::NumRows ( ) const
inline
Returns
Number of rows

◆ operator Matrix< U, M, N, Flags >()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
template<typename U , typename std::enable_if< std::is_convertible< T, U >::value >::type * = nullptr>
Linear::Matrix< T, M, N, Flags >::operator Matrix< U, M, N, Flags > ( )
inline

◆ operator()() [1/2]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Complex<T>& Linear::Matrix< T, M, N, Flags >::operator() ( size_t  r,
size_t  c 
)
inline

◆ operator()() [2/2]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Complex<T> Linear::Matrix< T, M, N, Flags >::operator() ( size_t  r,
size_t  c 
) const
inline

Returns the the data located in row r and column c.

If the matrix is column major, r still represents the row and c still represents the column.

Parameters
rRow index
cColumn index
Returns
Complex number

◆ operator*=() [1/2]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Matrix<T,M,N,Flags>& Linear::Matrix< T, M, N, Flags >::operator*= ( Complex< T >  other)
inline

◆ operator*=() [2/2]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
template<size_t P, size_t Q, unsigned int Flags2>
Matrix<T,M,N,Flags>& Linear::Matrix< T, M, N, Flags >::operator*= ( const Matrix< T, P, Q, Flags2 > &  other)
inline

◆ operator+=()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
template<size_t P, size_t Q, unsigned int Flags2>
Matrix<T,M,N,Flags>& Linear::Matrix< T, M, N, Flags >::operator+= ( const Matrix< T, P, Q, Flags2 > &  other)
inline

◆ operator-()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Matrix<T,M,N,Flags> Linear::Matrix< T, M, N, Flags >::operator- ( )
inline

◆ operator-=()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
template<size_t P, size_t Q, unsigned int Flags2>
Matrix<T,M,N,Flags>& Linear::Matrix< T, M, N, Flags >::operator-= ( const Matrix< T, P, Q, Flags2 > &  other)
inline

◆ operator/=()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Matrix<T,M,N,Flags>& Linear::Matrix< T, M, N, Flags >::operator/= ( Complex< T >  other)
inline

◆ operator=()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
template<size_t P, size_t Q, unsigned int Flags2>
Matrix<T,M,N,Flags>& Linear::Matrix< T, M, N, Flags >::operator= ( const Matrix< T, P, Q, Flags2 > &  other)
inline

Set the matrix to other.

If M or N are Dynamic, they are set to P and Q respectively. Otherwise, if \(M\ne P\) or \(N\ne Q\) an exception is raised.

Parameters
otherPxQ Matrix
Returns
PxQ Matrix

◆ operator[]() [1/2]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Complex<T>& Linear::Matrix< T, M, N, Flags >::operator[] ( size_t  i)
inline

◆ operator[]() [2/2]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Complex<T> Linear::Matrix< T, M, N, Flags >::operator[] ( size_t  i) const
inline

Operators.

Returns the ith entry of the data. This accesses the data directly, the result will depend on if the matrix is row major or column major.

Parameters
iIndex
Returns
Complex number

◆ Resize() [1/2]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
void Linear::Matrix< T, M, N, Flags >::Resize ( size_t  newM,
size_t  newN 
)
inline

Resizes a dynamic matrix.

If M or N are dynamic, this function becomes available. If both M and N are dynamic, it resizes the matrix to newMxnewN. Otherwise it resizes the matrix to newMxN or MxnewN depending if M or N is dynamic. If neither M nor N are dynamic, this function throws an exception.

Parameters
newMNew number of rows. Ignored if M is not dynamic
newNNew number of columns. Ignored if N is not dynamic

◆ Resize() [2/2]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
void Linear::Matrix< T, M, N, Flags >::Resize ( size_t  newSize)
inline

Resizes a dynamic matrix.

If M or N is dynamic, this function becomes available. It resizes the matrix to newSizexN or MxnewSize depending on if N or M is dynamic. If both M and N are dynamic, it becomes an newSizexnewSize matrix. If neither M nor N are dynamic, this function throws an exception.

Parameters
newSizeNew number of rows/columns

◆ ScaleRow()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
void Linear::Matrix< T, M, N, Flags >::ScaleRow ( size_t  r,
Complex< T >  s 
)
inline

Scales row r by s, i.e., \(a_{ri}=sa_{ri}\) for \(0\le i<N\).

If \(r\ge M\) an exception is thrown.

Parameters
rRow index
sComplex number

◆ SetColumn()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
template<size_t P, size_t Q>
std::enable_if<(P==M||P==Dynamic||M==Dynamic)&&(Q==1||Q==Dynamic),void>::type Linear::Matrix< T, M, N, Flags >::SetColumn ( size_t  c,
const Matrix< T, P, Q > &  column 
)
inline

Sets column c of the matrix to row.

If \(c\ge N\), an exception is thrown. If \(P\ne M\) or \(Q\ne 1\), an exception is thrown.

Parameters
cColumn index
columnPxQ Matrix

◆ SetRow()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
template<size_t P, size_t Q>
std::enable_if<(P==1||P==Dynamic)&&(Q==N||Q==Dynamic||N==Dynamic),void>::type Linear::Matrix< T, M, N, Flags >::SetRow ( size_t  r,
const Matrix< T, P, Q > &  row 
)
inline

Sets row r of the matrix to row.

If \(r\ge M\), an exception is thrown. If \(P\ne 1\) or \(Q\ne N\), an exception is thrown.

Parameters
rRow index
rowPxQ Matrix

◆ Size()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Matrix<T,1,2> Linear::Matrix< T, M, N, Flags >::Size ( ) const
inline
Returns
Size of matrix as a row vector.

◆ SwapRows()

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
void Linear::Matrix< T, M, N, Flags >::SwapRows ( size_t  r1,
size_t  r2 
)
inline

Swaps rows r1 and r2.

If \(r1\ge M\) or \(r2\ge M\) an exception is thrown.

Parameters
r1Row 1 index
r2Row 2 index

Friends And Related Function Documentation

◆ operator!=

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
template<size_t P, size_t Q, unsigned int Flags2>
bool operator!= ( const Matrix< T, M, N, Flags > &  a,
const Matrix< T, P, Q, Flags2 > &  b 
)
friend

Compares two matrices entrywise.

Parameters
aMxN Matrix
bPxQ Matrix
Returns
If \(M\ne P\) or \(N\ne Q\) it will return true. It returns false if and only if each entry is equal.

◆ operator* [1/3]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Matrix<T,M,N,Flags> operator* ( const Complex< T > &  s,
Matrix< T, M, N, Flags >  A 
)
friend

Computes the MxN matrix \(B=sA\) defined by \(b_{ij}=sa_{ij}\).

Parameters
sComplex number
AMxN Matrix
Returns
MxN Matrix

◆ operator* [2/3]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
template<size_t P, size_t Q, unsigned int Flags2>
Matrix<T,M,Q,Flags> operator* ( const Matrix< T, M, N, Flags > &  A,
const Matrix< T, P, Q, Flags2 > &  B 
)
friend

Computes the MxQ matrix \(C=AB\) defined by \(c_{ij}=\sum_{k=0}^{N-1}a_{ik}b_{kj}\).

If \(N\ne P\) an exception is raised.

Parameters
AMxN Matrix
BPxQ Matrix
Returns
MxQ Matrix

◆ operator* [3/3]

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Matrix<T,M,N,Flags> operator* ( Matrix< T, M, N, Flags >  A,
const Complex< T > &  s 
)
friend

Computes the MxN matrix \(B=sA\) defined by \(b_{ij}=sa_{ij}\).

Parameters
AMxN Matrix
sComplex number
Returns
MxN Matrix

◆ operator+

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
template<size_t P, size_t Q, unsigned int Flags2>
Matrix<T,M,N,Flags> operator+ ( Matrix< T, M, N, Flags >  A,
const Matrix< T, P, Q, Flags2 > &  B 
)
friend

Computes the MxN matrix \(C=A+B\) defined by \(c_{ij}=a_{ij}+b_{ij}\).

If \(M\ne P\) or \(N\ne Q\) an exception is raised.

Parameters
AMxN Matrix
BPxQ Matrix
Returns
MxN Matrix

◆ operator-

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
template<size_t P, size_t Q, unsigned int Flags2>
Matrix<T,M,N,Flags> operator- ( Matrix< T, M, N, Flags >  A,
const Matrix< T, P, Q, Flags2 > &  B 
)
friend

Computes the MxN matrix \(C=A-B\) defined by \(c_{ij}=a_{ij}-b_{ij}\).

If \(M\ne P\) or \(N\ne Q\) an exception is raised.

Parameters
AMxN Matrix
BPxQ Matrix
Returns
MxN Matrix

◆ operator/

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
Matrix<T,M,N,Flags> operator/ ( Matrix< T, M, N, Flags >  A,
const Complex< T > &  s 
)
friend

Computes the MxN matrix \(B=A/s\) defined by \(b_{ij}=a_{ij}/s\).

Parameters
AMxN Matrix
sComplex number
Returns
MxN Matrix

◆ operator<<

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
std::ostream& operator<< ( std::ostream &  out,
const Matrix< T, M, N, Flags > &  m 
)
friend

Takes a matrix and writes to out in a formatted manner.

Parameters
outReference to std::ostream.
mMxN Matrix.

◆ operator==

template<typename T , size_t M, size_t N, unsigned int Flags = 0>
template<size_t P, size_t Q, unsigned int Flags2>
bool operator== ( const Matrix< T, M, N, Flags > &  a,
const Matrix< T, P, Q, Flags2 > &  b 
)
friend

Compares two matrices entrywise.

Parameters
aMxN Matrix
bPxQ Matrix
Returns
If \(M\ne P\) or \(N\ne Q\) it will return false. It returns true if and only if each entry is equal.

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