Jet  v1.3.3
Public Types | Public Member Functions | Static Public Member Functions | List of all members
jet::MatrixMxN< T > Class Template Referencefinal

M x N matrix class. More...

#include <jet/matrix_mxn.h>

Inheritance diagram for jet::MatrixMxN< T >:
jet::MatrixExpression< T, MatrixMxN< T > >

Public Types

typedef Array2< T > ContainerType
 
typedef ContainerType::Iterator Iterator
 
typedef ContainerType::ConstIterator ConstIterator
 

Public Member Functions

 MatrixMxN ()
 Constructs an empty matrix. More...
 
 MatrixMxN (size_t m, size_t n, const T &s=T(0))
 Constructs m x n constant value matrix. More...
 
 MatrixMxN (const std::initializer_list< std::initializer_list< T >> &lst)
 Constructs a matrix with given initializer list lst. More...
 
template<typename E >
 MatrixMxN (const MatrixExpression< T, E > &other)
 Constructs a matrix with expression template. More...
 
 MatrixMxN (size_t m, size_t n, const T *arr)
 
 MatrixMxN (const MatrixMxN &other)
 Copy constructor. More...
 
 MatrixMxN (MatrixMxN &&other)
 Move constructor. More...
 
void resize (size_t m, size_t n, const T &s=T(0))
 Resizes to m x n matrix with initial value s. More...
 
void set (const T &s)
 Sets whole matrix with input scalar. More...
 
void set (const std::initializer_list< std::initializer_list< T >> &lst)
 Sets a matrix with given initializer list lst. More...
 
template<typename E >
void set (const MatrixExpression< T, E > &other)
 Copies from input matrix expression. More...
 
void set (size_t m, size_t n, const T *arr)
 
void setDiagonal (const T &s)
 Sets diagonal elements with input scalar. More...
 
void setOffDiagonal (const T &s)
 Sets off-diagonal elements with input scalar. More...
 
template<typename E >
void setRow (size_t i, const VectorExpression< T, E > &row)
 Sets i-th row with input vector. More...
 
template<typename E >
void setColumn (size_t j, const VectorExpression< T, E > &col)
 Sets j-th column with input vector. More...
 
template<typename E >
bool isEqual (const MatrixExpression< T, E > &other) const
 
template<typename E >
bool isSimilar (const MatrixExpression< T, E > &other, double tol=std::numeric_limits< double >::epsilon()) const
 
bool isSquare () const
 Returns true if this matrix is a square matrix. More...
 
Size2 size () const
 Returns the size of this matrix. More...
 
size_t rows () const
 Returns number of rows of this matrix. More...
 
size_t cols () const
 Returns number of columns of this matrix. More...
 
T * data ()
 Returns data pointer of this matrix. More...
 
const T *const data () const
 Returns constant pointer of this matrix. More...
 
Iterator begin ()
 Returns the begin iterator of the matrix. More...
 
ConstIterator begin () const
 Returns the begin const iterator of the matrix. More...
 
Iterator end ()
 Returns the end iterator of the matrix. More...
 
ConstIterator end () const
 Returns the end const iterator of the matrix. More...
 
MatrixScalarAdd< T, MatrixMxNadd (const T &s) const
 Returns this matrix + input scalar. More...
 
template<typename E >
MatrixAdd< T, MatrixMxN, E > add (const E &m) const
 Returns this matrix + input matrix (element-wise). More...
 
MatrixScalarSub< T, MatrixMxNsub (const T &s) const
 Returns this matrix - input scalar. More...
 
template<typename E >
MatrixSub< T, MatrixMxN, E > sub (const E &m) const
 Returns this matrix - input matrix (element-wise). More...
 
MatrixScalarMul< T, MatrixMxNmul (const T &s) const
 Returns this matrix * input scalar. More...
 
template<typename VE >
MatrixVectorMul< T, MatrixMxN, VE > mul (const VectorExpression< T, VE > &v) const
 Returns this matrix * input vector. More...
 
template<typename E >
MatrixMul< T, MatrixMxN, E > mul (const E &m) const
 Returns this matrix * input matrix. More...
 
MatrixScalarDiv< T, MatrixMxNdiv (const T &s) const
 Returns this matrix / input scalar. More...
 
MatrixScalarAdd< T, MatrixMxNradd (const T &s) const
 Returns input scalar + this matrix. More...
 
template<typename E >
MatrixAdd< T, MatrixMxN, E > radd (const E &m) const
 Returns input matrix + this matrix (element-wise). More...
 
MatrixScalarRSub< T, MatrixMxNrsub (const T &s) const
 Returns input scalar - this matrix. More...
 
template<typename E >
MatrixSub< T, MatrixMxN, E > rsub (const E &m) const
 Returns input matrix - this matrix (element-wise). More...
 
MatrixScalarMul< T, MatrixMxNrmul (const T &s) const
 Returns input scalar * this matrix. More...
 
template<typename E >
MatrixMul< T, E, MatrixMxNrmul (const E &m) const
 Returns input matrix * this matrix. More...
 
MatrixScalarRDiv< T, MatrixMxNrdiv (const T &s) const
 Returns input matrix / this scalar. More...
 
void iadd (const T &s)
 Adds input scalar to this matrix. More...
 
template<typename E >
void iadd (const E &m)
 Adds input matrix to this matrix (element-wise). More...
 
void isub (const T &s)
 Subtracts input scalar from this matrix. More...
 
template<typename E >
void isub (const E &m)
 Subtracts input matrix from this matrix (element-wise). More...
 
void imul (const T &s)
 Multiplies input scalar to this matrix. More...
 
template<typename E >
void imul (const E &m)
 Multiplies input matrix to this matrix. More...
 
void idiv (const T &s)
 Divides this matrix with input scalar. More...
 
void transpose ()
 Transposes this matrix. More...
 
void invert ()
 Inverts this matrix. More...
 
sum () const
 Returns sum of all elements. More...
 
avg () const
 Returns average of all elements. More...
 
min () const
 Returns minimum among all elements. More...
 
max () const
 Returns maximum among all elements. More...
 
absmin () const
 Returns absolute minimum among all elements. More...
 
absmax () const
 Returns absolute maximum among all elements. More...
 
trace () const
 
determinant () const
 Returns determinant of this matrix. More...
 
MatrixDiagonal< T, MatrixMxNdiagonal () const
 Returns diagonal part of this matrix. More...
 
MatrixDiagonal< T, MatrixMxNoffDiagonal () const
 Returns off-diagonal part of this matrix. More...
 
MatrixTriangular< T, MatrixMxNstrictLowerTri () const
 Returns strictly lower triangle part of this matrix. More...
 
MatrixTriangular< T, MatrixMxNstrictUpperTri () const
 Returns strictly upper triangle part of this matrix. More...
 
MatrixTriangular< T, MatrixMxNlowerTri () const
 Returns lower triangle part of this matrix (including the diagonal). More...
 
MatrixTriangular< T, MatrixMxNupperTri () const
 Returns upper triangle part of this matrix (including the diagonal). More...
 
MatrixMxN transposed () const
 Returns transposed matrix. More...
 
MatrixMxN inverse () const
 Returns inverse matrix. More...
 
template<typename U >
MatrixTypeCast< U, MatrixMxN, T > castTo () const
 Type-casts to different value-typed matrix. More...
 
template<typename E >
MatrixMxNoperator= (const E &m)
 Assigns input matrix. More...
 
MatrixMxNoperator= (const MatrixMxN &other)
 Copies to this matrix. More...
 
MatrixMxNoperator= (MatrixMxN &&other)
 Moves to this matrix. More...
 
MatrixMxNoperator+= (const T &s)
 Addition assignment with input scalar. More...
 
template<typename E >
MatrixMxNoperator+= (const E &m)
 Addition assignment with input matrix (element-wise). More...
 
MatrixMxNoperator-= (const T &s)
 Subtraction assignment with input scalar. More...
 
template<typename E >
MatrixMxNoperator-= (const E &m)
 Subtraction assignment with input matrix (element-wise). More...
 
MatrixMxNoperator*= (const T &s)
 Multiplication assignment with input scalar. More...
 
template<typename E >
MatrixMxNoperator*= (const E &m)
 Multiplication assignment with input matrix. More...
 
MatrixMxNoperator/= (const T &s)
 Division assignment with input scalar. More...
 
T & operator[] (size_t i)
 Returns reference of i-th element. More...
 
const T & operator[] (size_t i) const
 Returns constant reference of i-th element. More...
 
T & operator() (size_t i, size_t j)
 Returns reference of (i,j) element. More...
 
const T & operator() (size_t i, size_t j) const
 Returns constant reference of (i,j) element. More...
 
template<typename E >
bool operator== (const MatrixExpression< T, E > &m) const
 Returns true if is equal to m. More...
 
template<typename E >
bool operator!= (const MatrixExpression< T, E > &m) const
 Returns true if is not equal to m. More...
 
template<typename Callback >
void forEach (Callback func) const
 Iterates the matrix and invoke given func for each index. More...
 
template<typename Callback >
void forEachIndex (Callback func) const
 Iterates the matrix and invoke given func for each index. More...
 
template<typename Callback >
void parallelForEach (Callback func)
 Iterates the matrix and invoke given func for each index in parallel. More...
 
template<typename Callback >
void parallelForEachIndex (Callback func) const
 Iterates the matrix and invoke given func for each index in parallel using multi-threading. More...
 
- Public Member Functions inherited from jet::MatrixExpression< T, MatrixMxN< T > >
Size2 size () const
 Size of the matrix. More...
 
size_t rows () const
 Number of rows. More...
 
size_t cols () const
 Number of columns. More...
 
const MatrixMxN< T > & operator() () const
 Returns actual implementation (the subclass). More...
 

Static Public Member Functions

static MatrixConstant< T > makeZero (size_t m, size_t n)
 Makes a m x n matrix with zeros. More...
 
static MatrixIdentity< T > makeIdentity (size_t m)
 

Detailed Description

template<typename T>
class jet::MatrixMxN< T >

M x N matrix class.

This class defines M x N row-major matrix.

Template Parameters
TType of the element.

Member Typedef Documentation

◆ ConstIterator

template<typename T >
typedef ContainerType::ConstIterator jet::MatrixMxN< T >::ConstIterator

◆ ContainerType

template<typename T >
typedef Array2<T> jet::MatrixMxN< T >::ContainerType

◆ Iterator

template<typename T >
typedef ContainerType::Iterator jet::MatrixMxN< T >::Iterator

Constructor & Destructor Documentation

◆ MatrixMxN() [1/7]

template<typename T >
jet::MatrixMxN< T >::MatrixMxN ( )

Constructs an empty matrix.

◆ MatrixMxN() [2/7]

template<typename T >
jet::MatrixMxN< T >::MatrixMxN ( size_t  m,
size_t  n,
const T &  s = T(0) 
)

Constructs m x n constant value matrix.

◆ MatrixMxN() [3/7]

template<typename T >
jet::MatrixMxN< T >::MatrixMxN ( const std::initializer_list< std::initializer_list< T >> &  lst)

Constructs a matrix with given initializer list lst.

This constructor will build a matrix with given initializer list lst such as

MatrixMxN<float> mat = {
{1.f, 2.f, 4.f, 3.f},
{9.f, 3.f, 5.f, 1.f},
{4.f, 8.f, 1.f, 5.f}
};

Note the initializer has 4x3 structure which will create 4x3 matrix.

Parameters
lstInitializer list that should be copy to the new matrix.

◆ MatrixMxN() [4/7]

template<typename T >
template<typename E >
jet::MatrixMxN< T >::MatrixMxN ( const MatrixExpression< T, E > &  other)

Constructs a matrix with expression template.

◆ MatrixMxN() [5/7]

template<typename T >
jet::MatrixMxN< T >::MatrixMxN ( size_t  m,
size_t  n,
const T *  arr 
)

Constructs a m x n matrix with input array.

Warning
Ordering of the input elements is row-major.

◆ MatrixMxN() [6/7]

template<typename T >
jet::MatrixMxN< T >::MatrixMxN ( const MatrixMxN< T > &  other)

Copy constructor.

◆ MatrixMxN() [7/7]

template<typename T >
jet::MatrixMxN< T >::MatrixMxN ( MatrixMxN< T > &&  other)

Move constructor.

Member Function Documentation

◆ absmax()

template<typename T >
T jet::MatrixMxN< T >::absmax ( ) const

Returns absolute maximum among all elements.

◆ absmin()

template<typename T >
T jet::MatrixMxN< T >::absmin ( ) const

Returns absolute minimum among all elements.

◆ add() [1/2]

template<typename T >
template<typename E >
MatrixAdd<T, MatrixMxN, E> jet::MatrixMxN< T >::add ( const E &  m) const

Returns this matrix + input matrix (element-wise).

◆ add() [2/2]

template<typename T >
MatrixScalarAdd<T, MatrixMxN> jet::MatrixMxN< T >::add ( const T &  s) const

Returns this matrix + input scalar.

◆ avg()

template<typename T >
T jet::MatrixMxN< T >::avg ( ) const

Returns average of all elements.

◆ begin() [1/2]

template<typename T >
Iterator jet::MatrixMxN< T >::begin ( )

Returns the begin iterator of the matrix.

◆ begin() [2/2]

template<typename T >
ConstIterator jet::MatrixMxN< T >::begin ( ) const

Returns the begin const iterator of the matrix.

◆ castTo()

template<typename T >
template<typename U >
MatrixTypeCast<U, MatrixMxN, T> jet::MatrixMxN< T >::castTo ( ) const

Type-casts to different value-typed matrix.

◆ cols()

template<typename T >
size_t jet::MatrixMxN< T >::cols ( ) const

Returns number of columns of this matrix.

◆ data() [1/2]

template<typename T >
T* jet::MatrixMxN< T >::data ( )

Returns data pointer of this matrix.

◆ data() [2/2]

template<typename T >
const T* const jet::MatrixMxN< T >::data ( ) const

Returns constant pointer of this matrix.

◆ determinant()

template<typename T >
T jet::MatrixMxN< T >::determinant ( ) const

Returns determinant of this matrix.

◆ diagonal()

template<typename T >
MatrixDiagonal<T, MatrixMxN> jet::MatrixMxN< T >::diagonal ( ) const

Returns diagonal part of this matrix.

◆ div()

template<typename T >
MatrixScalarDiv<T, MatrixMxN> jet::MatrixMxN< T >::div ( const T &  s) const

Returns this matrix / input scalar.

◆ end() [1/2]

template<typename T >
Iterator jet::MatrixMxN< T >::end ( )

Returns the end iterator of the matrix.

◆ end() [2/2]

template<typename T >
ConstIterator jet::MatrixMxN< T >::end ( ) const

Returns the end const iterator of the matrix.

◆ forEach()

template<typename T >
template<typename Callback >
void jet::MatrixMxN< T >::forEach ( Callback  func) const

Iterates the matrix and invoke given func for each index.

This function iterates the matrix elements and invoke the callback function func. The callback function takes matrix's element as its input. The order of execution will be the same as the nested for-loop below:

MatrixMxN<double> mat(100, 200, 4.0);
for (size_t i = 0; i < mat.rows(); ++i) {
for (size_t j = 0; j < mat.cols(); ++j) {
func(mat(i, j));
}
}

Below is the sample usage:

MatrixMxN<double> mat(100, 200, 4.0);
mat.forEach([](double elem) {
printf("%d\n", elem);
});

◆ forEachIndex()

template<typename T >
template<typename Callback >
void jet::MatrixMxN< T >::forEachIndex ( Callback  func) const

Iterates the matrix and invoke given func for each index.

This function iterates the matrix elements and invoke the callback function func. The callback function takes two parameters which are the (i, j) indices of the matrix. The order of execution will be the same as the nested for-loop below:

MatrixMxN<double> mat(100, 200, 4.0);
for (size_t i = 0; i < mat.rows(); ++i) {
for (size_t j = 0; j < mat.cols(); ++j) {
func(i, j);
}
}

Below is the sample usage:

MatrixMxN<double> mat(100, 200, 4.0);
mat.forEachIndex([&](size_t i, size_t j) {
mat(i, j) = 4.0 * i + 7.0 * j + 1.5;
});

◆ iadd() [1/2]

template<typename T >
template<typename E >
void jet::MatrixMxN< T >::iadd ( const E &  m)

Adds input matrix to this matrix (element-wise).

◆ iadd() [2/2]

template<typename T >
void jet::MatrixMxN< T >::iadd ( const T &  s)

Adds input scalar to this matrix.

◆ idiv()

template<typename T >
void jet::MatrixMxN< T >::idiv ( const T &  s)

Divides this matrix with input scalar.

◆ imul() [1/2]

template<typename T >
template<typename E >
void jet::MatrixMxN< T >::imul ( const E &  m)

Multiplies input matrix to this matrix.

◆ imul() [2/2]

template<typename T >
void jet::MatrixMxN< T >::imul ( const T &  s)

Multiplies input scalar to this matrix.

◆ inverse()

template<typename T >
MatrixMxN jet::MatrixMxN< T >::inverse ( ) const

Returns inverse matrix.

◆ invert()

template<typename T >
void jet::MatrixMxN< T >::invert ( )

Inverts this matrix.

This function computes the inverse using Gaussian elimination method.

◆ isEqual()

template<typename T >
template<typename E >
bool jet::MatrixMxN< T >::isEqual ( const MatrixExpression< T, E > &  other) const

◆ isSimilar()

template<typename T >
template<typename E >
bool jet::MatrixMxN< T >::isSimilar ( const MatrixExpression< T, E > &  other,
double  tol = std::numeric_limits< double >::epsilon() 
) const

Returns true if this matrix is similar to the input matrix within the given tolerance.

◆ isSquare()

template<typename T >
bool jet::MatrixMxN< T >::isSquare ( ) const

Returns true if this matrix is a square matrix.

◆ isub() [1/2]

template<typename T >
template<typename E >
void jet::MatrixMxN< T >::isub ( const E &  m)

Subtracts input matrix from this matrix (element-wise).

◆ isub() [2/2]

template<typename T >
void jet::MatrixMxN< T >::isub ( const T &  s)

Subtracts input scalar from this matrix.

◆ lowerTri()

template<typename T >
MatrixTriangular<T, MatrixMxN> jet::MatrixMxN< T >::lowerTri ( ) const

Returns lower triangle part of this matrix (including the diagonal).

◆ makeIdentity()

template<typename T >
static MatrixIdentity<T> jet::MatrixMxN< T >::makeIdentity ( size_t  m)
static

Makes a m x m matrix with all diagonal elements to 1, and other elements to 0.

◆ makeZero()

template<typename T >
static MatrixConstant<T> jet::MatrixMxN< T >::makeZero ( size_t  m,
size_t  n 
)
static

Makes a m x n matrix with zeros.

◆ max()

template<typename T >
T jet::MatrixMxN< T >::max ( ) const

Returns maximum among all elements.

◆ min()

template<typename T >
T jet::MatrixMxN< T >::min ( ) const

Returns minimum among all elements.

◆ mul() [1/3]

template<typename T >
template<typename E >
MatrixMul<T, MatrixMxN, E> jet::MatrixMxN< T >::mul ( const E &  m) const

Returns this matrix * input matrix.

◆ mul() [2/3]

template<typename T >
MatrixScalarMul<T, MatrixMxN> jet::MatrixMxN< T >::mul ( const T &  s) const

Returns this matrix * input scalar.

◆ mul() [3/3]

template<typename T >
template<typename VE >
MatrixVectorMul<T, MatrixMxN, VE> jet::MatrixMxN< T >::mul ( const VectorExpression< T, VE > &  v) const

Returns this matrix * input vector.

◆ offDiagonal()

template<typename T >
MatrixDiagonal<T, MatrixMxN> jet::MatrixMxN< T >::offDiagonal ( ) const

Returns off-diagonal part of this matrix.

◆ operator!=()

template<typename T >
template<typename E >
bool jet::MatrixMxN< T >::operator!= ( const MatrixExpression< T, E > &  m) const

Returns true if is not equal to m.

◆ operator()() [1/2]

template<typename T >
T& jet::MatrixMxN< T >::operator() ( size_t  i,
size_t  j 
)

Returns reference of (i,j) element.

◆ operator()() [2/2]

template<typename T >
const T& jet::MatrixMxN< T >::operator() ( size_t  i,
size_t  j 
) const

Returns constant reference of (i,j) element.

◆ operator*=() [1/2]

template<typename T >
template<typename E >
MatrixMxN& jet::MatrixMxN< T >::operator*= ( const E &  m)

Multiplication assignment with input matrix.

◆ operator*=() [2/2]

template<typename T >
MatrixMxN& jet::MatrixMxN< T >::operator*= ( const T &  s)

Multiplication assignment with input scalar.

◆ operator+=() [1/2]

template<typename T >
template<typename E >
MatrixMxN& jet::MatrixMxN< T >::operator+= ( const E &  m)

Addition assignment with input matrix (element-wise).

◆ operator+=() [2/2]

template<typename T >
MatrixMxN& jet::MatrixMxN< T >::operator+= ( const T &  s)

Addition assignment with input scalar.

◆ operator-=() [1/2]

template<typename T >
template<typename E >
MatrixMxN& jet::MatrixMxN< T >::operator-= ( const E &  m)

Subtraction assignment with input matrix (element-wise).

◆ operator-=() [2/2]

template<typename T >
MatrixMxN& jet::MatrixMxN< T >::operator-= ( const T &  s)

Subtraction assignment with input scalar.

◆ operator/=()

template<typename T >
MatrixMxN& jet::MatrixMxN< T >::operator/= ( const T &  s)

Division assignment with input scalar.

◆ operator=() [1/3]

template<typename T >
template<typename E >
MatrixMxN& jet::MatrixMxN< T >::operator= ( const E &  m)

Assigns input matrix.

◆ operator=() [2/3]

template<typename T >
MatrixMxN& jet::MatrixMxN< T >::operator= ( const MatrixMxN< T > &  other)

Copies to this matrix.

◆ operator=() [3/3]

template<typename T >
MatrixMxN& jet::MatrixMxN< T >::operator= ( MatrixMxN< T > &&  other)

Moves to this matrix.

◆ operator==()

template<typename T >
template<typename E >
bool jet::MatrixMxN< T >::operator== ( const MatrixExpression< T, E > &  m) const

Returns true if is equal to m.

◆ operator[]() [1/2]

template<typename T >
T& jet::MatrixMxN< T >::operator[] ( size_t  i)

Returns reference of i-th element.

◆ operator[]() [2/2]

template<typename T >
const T& jet::MatrixMxN< T >::operator[] ( size_t  i) const

Returns constant reference of i-th element.

◆ parallelForEach()

template<typename T >
template<typename Callback >
void jet::MatrixMxN< T >::parallelForEach ( Callback  func)

Iterates the matrix and invoke given func for each index in parallel.

This function iterates the matrix elements and invoke the callback function func. The callback function takes matrix's element as its input. The order of execution will be non-deterministic since it runs in parallel. Below is the sample usage:

MatrixMxN<double> mat(100, 200, 4.0);
mat.parallelForEach([](double& elem) {
elem *= 2.0;
});

The parameter type of the callback function doesn't have to be T&, but const T& or T can be used as well.

◆ parallelForEachIndex()

template<typename T >
template<typename Callback >
void jet::MatrixMxN< T >::parallelForEachIndex ( Callback  func) const

Iterates the matrix and invoke given func for each index in parallel using multi-threading.

This function iterates the matrix elements and invoke the callback function func in parallel using multi-threading. The callback function takes two parameters which are the (i, j) indices of the matrix. The order of execution will be non-deterministic since it runs in parallel. Below is the sample usage:

MatrixMxN<double> mat(100, 200, 4.0);
mat.parallelForEachIndex([&](size_t i, size_t j) {
mat(i, j) *= 2;
});

◆ radd() [1/2]

template<typename T >
template<typename E >
MatrixAdd<T, MatrixMxN, E> jet::MatrixMxN< T >::radd ( const E &  m) const

Returns input matrix + this matrix (element-wise).

◆ radd() [2/2]

template<typename T >
MatrixScalarAdd<T, MatrixMxN> jet::MatrixMxN< T >::radd ( const T &  s) const

Returns input scalar + this matrix.

◆ rdiv()

template<typename T >
MatrixScalarRDiv<T, MatrixMxN> jet::MatrixMxN< T >::rdiv ( const T &  s) const

Returns input matrix / this scalar.

◆ resize()

template<typename T >
void jet::MatrixMxN< T >::resize ( size_t  m,
size_t  n,
const T &  s = T(0) 
)

Resizes to m x n matrix with initial value s.

◆ rmul() [1/2]

template<typename T >
template<typename E >
MatrixMul<T, E, MatrixMxN> jet::MatrixMxN< T >::rmul ( const E &  m) const

Returns input matrix * this matrix.

◆ rmul() [2/2]

template<typename T >
MatrixScalarMul<T, MatrixMxN> jet::MatrixMxN< T >::rmul ( const T &  s) const

Returns input scalar * this matrix.

◆ rows()

template<typename T >
size_t jet::MatrixMxN< T >::rows ( ) const

Returns number of rows of this matrix.

◆ rsub() [1/2]

template<typename T >
template<typename E >
MatrixSub<T, MatrixMxN, E> jet::MatrixMxN< T >::rsub ( const E &  m) const

Returns input matrix - this matrix (element-wise).

◆ rsub() [2/2]

template<typename T >
MatrixScalarRSub<T, MatrixMxN> jet::MatrixMxN< T >::rsub ( const T &  s) const

Returns input scalar - this matrix.

◆ set() [1/4]

template<typename T >
template<typename E >
void jet::MatrixMxN< T >::set ( const MatrixExpression< T, E > &  other)

Copies from input matrix expression.

◆ set() [2/4]

template<typename T >
void jet::MatrixMxN< T >::set ( const std::initializer_list< std::initializer_list< T >> &  lst)

Sets a matrix with given initializer list lst.

This function will fill the matrix with given initializer list lst such as

MatrixMxN<float> mat;
mat.set({
{1.f, 2.f, 4.f, 3.f},
{9.f, 3.f, 5.f, 1.f},
{4.f, 8.f, 1.f, 5.f}
});

Note the initializer has 4x3 structure which will resize to 4x3 matrix.

Parameters
lstInitializer list that should be copy to the new matrix.

◆ set() [3/4]

template<typename T >
void jet::MatrixMxN< T >::set ( const T &  s)

Sets whole matrix with input scalar.

◆ set() [4/4]

template<typename T >
void jet::MatrixMxN< T >::set ( size_t  m,
size_t  n,
const T *  arr 
)

Copies from input array.

Warning
Ordering of the input elements is row-major.

◆ setColumn()

template<typename T >
template<typename E >
void jet::MatrixMxN< T >::setColumn ( size_t  j,
const VectorExpression< T, E > &  col 
)

Sets j-th column with input vector.

◆ setDiagonal()

template<typename T >
void jet::MatrixMxN< T >::setDiagonal ( const T &  s)

Sets diagonal elements with input scalar.

◆ setOffDiagonal()

template<typename T >
void jet::MatrixMxN< T >::setOffDiagonal ( const T &  s)

Sets off-diagonal elements with input scalar.

◆ setRow()

template<typename T >
template<typename E >
void jet::MatrixMxN< T >::setRow ( size_t  i,
const VectorExpression< T, E > &  row 
)

Sets i-th row with input vector.

◆ size()

template<typename T >
Size2 jet::MatrixMxN< T >::size ( ) const

Returns the size of this matrix.

◆ strictLowerTri()

template<typename T >
MatrixTriangular<T, MatrixMxN> jet::MatrixMxN< T >::strictLowerTri ( ) const

Returns strictly lower triangle part of this matrix.

◆ strictUpperTri()

template<typename T >
MatrixTriangular<T, MatrixMxN> jet::MatrixMxN< T >::strictUpperTri ( ) const

Returns strictly upper triangle part of this matrix.

◆ sub() [1/2]

template<typename T >
template<typename E >
MatrixSub<T, MatrixMxN, E> jet::MatrixMxN< T >::sub ( const E &  m) const

Returns this matrix - input matrix (element-wise).

◆ sub() [2/2]

template<typename T >
MatrixScalarSub<T, MatrixMxN> jet::MatrixMxN< T >::sub ( const T &  s) const

Returns this matrix - input scalar.

◆ sum()

template<typename T >
T jet::MatrixMxN< T >::sum ( ) const

Returns sum of all elements.

◆ trace()

template<typename T >
T jet::MatrixMxN< T >::trace ( ) const

Returns sum of all diagonal elements.

Warning
Should be a square matrix.

◆ transpose()

template<typename T >
void jet::MatrixMxN< T >::transpose ( )

Transposes this matrix.

◆ transposed()

template<typename T >
MatrixMxN jet::MatrixMxN< T >::transposed ( ) const

Returns transposed matrix.

◆ upperTri()

template<typename T >
MatrixTriangular<T, MatrixMxN> jet::MatrixMxN< T >::upperTri ( ) const

Returns upper triangle part of this matrix (including the diagonal).


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