M x N matrix class. More...
#include <Core/Matrix/MatrixMxN.h>
Public Types | |
using | ContainerType = Array2< T > |
using | Iterator = typename ContainerType::Iterator |
using | ConstIterator = typename ContainerType::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 >> &list) | |
Constructs a matrix with given initializer list list . 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) noexcept | |
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 >> &list) |
Sets a matrix with given initializer list list . 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 * | 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, MatrixMxN > | Add (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, MatrixMxN > | Sub (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, MatrixMxN > | Mul (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, MatrixMxN > | Div (const T &s) const |
Returns this matrix / input scalar. More... | |
MatrixScalarAdd< T, MatrixMxN > | RAdd (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, MatrixMxN > | RSub (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, MatrixMxN > | RMul (const T &s) const |
Returns input scalar * this matrix. More... | |
template<typename E > | |
MatrixMul< T, E, MatrixMxN > | RMul (const E &m) const |
Returns input matrix * this matrix. More... | |
MatrixScalarRDiv< T, MatrixMxN > | RDiv (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... | |
T | Sum () const |
Returns sum of all elements. More... | |
T | Avg () const |
Returns average of all elements. More... | |
T | Min () const |
Returns minimum among all elements. More... | |
T | Max () const |
Returns maximum among all elements. More... | |
T | AbsMin () const |
Returns absolute minimum among all elements. More... | |
T | AbsMax () const |
Returns absolute maximum among all elements. More... | |
T | Trace () const |
T | Determinant () const |
Returns determinant of this matrix. More... | |
MatrixDiagonal< T, MatrixMxN > | Diagonal () const |
Returns diagonal part of this matrix. More... | |
MatrixDiagonal< T, MatrixMxN > | OffDiagonal () const |
Returns off-diagonal part of this matrix. More... | |
MatrixTriangular< T, MatrixMxN > | StrictLowerTri () const |
Returns strictly lower triangle part of this matrix. More... | |
MatrixTriangular< T, MatrixMxN > | StrictUpperTri () const |
Returns strictly upper triangle part of this matrix. More... | |
MatrixTriangular< T, MatrixMxN > | LowerTri () const |
Returns lower triangle part of this matrix (including the diagonal). More... | |
MatrixTriangular< T, MatrixMxN > | UpperTri () 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 > | |
MatrixMxN & | operator= (const E &m) |
Assigns input matrix. More... | |
MatrixMxN & | operator= (const MatrixMxN &other) |
Copies to this matrix. More... | |
MatrixMxN & | operator= (MatrixMxN &&other) noexcept |
Moves to this matrix. More... | |
MatrixMxN & | operator+= (const T &s) |
Addition assignment with input scalar. More... | |
template<typename E > | |
MatrixMxN & | operator+= (const E &m) |
Addition assignment with input matrix (element-wise). More... | |
MatrixMxN & | operator-= (const T &s) |
Subtraction assignment with input scalar. More... | |
template<typename E > | |
MatrixMxN & | operator-= (const E &m) |
Subtraction assignment with input matrix (element-wise). More... | |
MatrixMxN & | operator*= (const T &s) |
Multiplication assignment with input scalar. More... | |
template<typename E > | |
MatrixMxN & | operator*= (const E &m) |
Multiplication assignment with input matrix. More... | |
MatrixMxN & | operator/= (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... | |
template<typename E > | |
MatrixAdd< T, MatrixMxN< T >, E > | Add (const E &m) const |
template<typename E > | |
MatrixSub< T, MatrixMxN< T >, E > | Sub (const E &m) const |
template<typename VE > | |
MatrixVectorMul< T, MatrixMxN< T >, VE > | Mul (const VectorExpression< T, VE > &v) const |
template<typename E > | |
MatrixMul< T, MatrixMxN< T >, E > | Mul (const E &m) const |
template<typename E > | |
MatrixAdd< T, MatrixMxN< T >, E > | RAdd (const E &m) const |
template<typename E > | |
MatrixSub< T, MatrixMxN< T >, E > | RSub (const E &m) const |
template<typename E > | |
MatrixMul< T, E, MatrixMxN< T > > | RMul (const E &m) const |
template<typename U > | |
MatrixTypeCast< U, MatrixMxN< T >, T > | CastTo () const |
template<typename E > | |
MatrixMxN< T > & | operator= (const E &m) |
template<typename E > | |
MatrixMxN< T > & | operator+= (const E &m) |
template<typename E > | |
MatrixMxN< T > & | operator-= (const E &m) |
template<typename E > | |
MatrixMxN< T > & | operator*= (const E &m) |
Public Member Functions inherited from CubbyFlow::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) |
Makes a m x m matrix with all diagonal elements to 1, and other elements to 0. More... | |
Detailed Description
template<typename T>
class CubbyFlow::MatrixMxN< T >
M x N matrix class.
This class defines M x N row-major matrix.
- Template Parameters
-
T Type of the element.
Member Typedef Documentation
◆ ConstIterator
using CubbyFlow::MatrixMxN< T >::ConstIterator = typename ContainerType::ConstIterator |
◆ ContainerType
using CubbyFlow::MatrixMxN< T >::ContainerType = Array2<T> |
◆ Iterator
using CubbyFlow::MatrixMxN< T >::Iterator = typename ContainerType::Iterator |
Constructor & Destructor Documentation
◆ MatrixMxN() [1/7]
CubbyFlow::MatrixMxN< T >::MatrixMxN | ( | ) |
Constructs an empty matrix.
◆ MatrixMxN() [2/7]
CubbyFlow::MatrixMxN< T >::MatrixMxN | ( | size_t | m, |
size_t | n, | ||
const T & | s = T(0) |
||
) |
Constructs m x n constant value matrix.
◆ MatrixMxN() [3/7]
CubbyFlow::MatrixMxN< T >::MatrixMxN | ( | const std::initializer_list< std::initializer_list< T >> & | list | ) |
Constructs a matrix with given initializer list list
.
This constructor will build a matrix with given initializer list list
such as
Note the initializer has 4x3 structure which will create 4x3 matrix.
- Parameters
-
list Initializer list that should be copy to the new matrix.
◆ MatrixMxN() [4/7]
CubbyFlow::MatrixMxN< T >::MatrixMxN | ( | const MatrixExpression< T, E > & | other | ) |
Constructs a matrix with expression template.
◆ MatrixMxN() [5/7]
CubbyFlow::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]
CubbyFlow::MatrixMxN< T >::MatrixMxN | ( | const MatrixMxN< T > & | other | ) |
Copy constructor.
◆ MatrixMxN() [7/7]
|
noexcept |
Move constructor.
Member Function Documentation
◆ AbsMax()
T CubbyFlow::MatrixMxN< T >::AbsMax | ( | ) | const |
Returns absolute maximum among all elements.
◆ AbsMin()
T CubbyFlow::MatrixMxN< T >::AbsMin | ( | ) | const |
Returns absolute minimum among all elements.
◆ Add() [1/3]
MatrixScalarAdd< T, MatrixMxN< T > > CubbyFlow::MatrixMxN< T >::Add | ( | const T & | s | ) | const |
Returns this matrix + input scalar.
◆ Add() [2/3]
MatrixAdd<T, MatrixMxN, E> CubbyFlow::MatrixMxN< T >::Add | ( | const E & | m | ) | const |
Returns this matrix + input matrix (element-wise).
◆ Add() [3/3]
MatrixAdd<T, MatrixMxN<T>, E> CubbyFlow::MatrixMxN< T >::Add | ( | const E & | m | ) | const |
◆ Avg()
T CubbyFlow::MatrixMxN< T >::Avg | ( | ) | const |
Returns average of all elements.
◆ begin() [1/2]
MatrixMxN< T >::Iterator CubbyFlow::MatrixMxN< T >::begin | ( | ) |
Returns the begin iterator of the matrix.
◆ begin() [2/2]
MatrixMxN< T >::ConstIterator CubbyFlow::MatrixMxN< T >::begin | ( | ) | const |
Returns the begin const iterator of the matrix.
◆ CastTo() [1/2]
MatrixTypeCast<U, MatrixMxN, T> CubbyFlow::MatrixMxN< T >::CastTo | ( | ) | const |
Type-casts to different value-typed matrix.
◆ CastTo() [2/2]
MatrixTypeCast<U, MatrixMxN<T>, T> CubbyFlow::MatrixMxN< T >::CastTo | ( | ) | const |
◆ Cols()
size_t CubbyFlow::MatrixMxN< T >::Cols | ( | ) | const |
Returns number of columns of this matrix.
◆ data() [1/2]
T * CubbyFlow::MatrixMxN< T >::data | ( | ) |
Returns data pointer of this matrix.
◆ data() [2/2]
const T * CubbyFlow::MatrixMxN< T >::data | ( | ) | const |
Returns constant pointer of this matrix.
◆ Determinant()
T CubbyFlow::MatrixMxN< T >::Determinant | ( | ) | const |
Returns determinant of this matrix.
◆ Diagonal()
MatrixDiagonal< T, MatrixMxN< T > > CubbyFlow::MatrixMxN< T >::Diagonal | ( | ) | const |
Returns diagonal part of this matrix.
◆ Div()
MatrixScalarDiv< T, MatrixMxN< T > > CubbyFlow::MatrixMxN< T >::Div | ( | const T & | s | ) | const |
Returns this matrix / input scalar.
◆ end() [1/2]
MatrixMxN< T >::Iterator CubbyFlow::MatrixMxN< T >::end | ( | ) |
Returns the end iterator of the matrix.
◆ end() [2/2]
MatrixMxN< T >::ConstIterator CubbyFlow::MatrixMxN< T >::end | ( | ) | const |
Returns the end const iterator of the matrix.
◆ ForEach()
void CubbyFlow::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:
Below is the sample usage:
◆ ForEachIndex()
void CubbyFlow::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:
Below is the sample usage:
◆ IAdd() [1/2]
void CubbyFlow::MatrixMxN< T >::IAdd | ( | const T & | s | ) |
Adds input scalar to this matrix.
◆ IAdd() [2/2]
Adds input matrix to this matrix (element-wise).
◆ IDiv()
void CubbyFlow::MatrixMxN< T >::IDiv | ( | const T & | s | ) |
Divides this matrix with input scalar.
◆ IMul() [1/2]
void CubbyFlow::MatrixMxN< T >::IMul | ( | const T & | s | ) |
Multiplies input scalar to this matrix.
◆ IMul() [2/2]
Multiplies input matrix to this matrix.
◆ Inverse()
MatrixMxN< T > CubbyFlow::MatrixMxN< T >::Inverse | ( | ) | const |
Returns inverse matrix.
◆ Invert()
void CubbyFlow::MatrixMxN< T >::Invert | ( | ) |
Inverts this matrix.
This function computes the inverse using Gaussian elimination method.
◆ IsEqual()
bool CubbyFlow::MatrixMxN< T >::IsEqual | ( | const MatrixExpression< T, E > & | other | ) | const |
◆ IsSimilar()
bool CubbyFlow::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()
bool CubbyFlow::MatrixMxN< T >::IsSquare | ( | ) | const |
Returns true if this matrix is a square matrix.
◆ ISub() [1/2]
void CubbyFlow::MatrixMxN< T >::ISub | ( | const T & | s | ) |
Subtracts input scalar from this matrix.
◆ ISub() [2/2]
Subtracts input matrix from this matrix (element-wise).
◆ LowerTri()
MatrixTriangular< T, MatrixMxN< T > > CubbyFlow::MatrixMxN< T >::LowerTri | ( | ) | const |
Returns lower triangle part of this matrix (including the diagonal).
◆ MakeIdentity()
|
static |
Makes a m x m matrix with all diagonal elements to 1, and other elements to 0.
◆ MakeZero()
|
static |
Makes a m x n matrix with zeros.
◆ Max()
T CubbyFlow::MatrixMxN< T >::Max | ( | ) | const |
Returns maximum among all elements.
◆ Min()
T CubbyFlow::MatrixMxN< T >::Min | ( | ) | const |
Returns minimum among all elements.
◆ Mul() [1/5]
MatrixScalarMul< T, MatrixMxN< T > > CubbyFlow::MatrixMxN< T >::Mul | ( | const T & | s | ) | const |
Returns this matrix * input scalar.
◆ Mul() [2/5]
MatrixVectorMul<T, MatrixMxN, VE> CubbyFlow::MatrixMxN< T >::Mul | ( | const VectorExpression< T, VE > & | v | ) | const |
Returns this matrix * input vector.
◆ Mul() [3/5]
MatrixMul<T, MatrixMxN, E> CubbyFlow::MatrixMxN< T >::Mul | ( | const E & | m | ) | const |
Returns this matrix * input matrix.
◆ Mul() [4/5]
MatrixVectorMul<T, MatrixMxN<T>, VE> CubbyFlow::MatrixMxN< T >::Mul | ( | const VectorExpression< T, VE > & | v | ) | const |
◆ Mul() [5/5]
MatrixMul<T, MatrixMxN<T>, E> CubbyFlow::MatrixMxN< T >::Mul | ( | const E & | m | ) | const |
◆ OffDiagonal()
MatrixDiagonal< T, MatrixMxN< T > > CubbyFlow::MatrixMxN< T >::OffDiagonal | ( | ) | const |
Returns off-diagonal part of this matrix.
◆ operator!=()
bool CubbyFlow::MatrixMxN< T >::operator!= | ( | const MatrixExpression< T, E > & | m | ) | const |
Returns true if is not equal to m.
◆ operator()() [1/2]
T & CubbyFlow::MatrixMxN< T >::operator() | ( | size_t | i, |
size_t | j | ||
) |
Returns reference of (i,j) element.
◆ operator()() [2/2]
const T & CubbyFlow::MatrixMxN< T >::operator() | ( | size_t | i, |
size_t | j | ||
) | const |
Returns constant reference of (i,j) element.
◆ operator*=() [1/3]
MatrixMxN< T > & CubbyFlow::MatrixMxN< T >::operator*= | ( | const T & | s | ) |
Multiplication assignment with input scalar.
◆ operator*=() [2/3]
MatrixMxN& CubbyFlow::MatrixMxN< T >::operator*= | ( | const E & | m | ) |
Multiplication assignment with input matrix.
◆ operator*=() [3/3]
MatrixMxN<T>& CubbyFlow::MatrixMxN< T >::operator*= | ( | const E & | m | ) |
◆ operator+=() [1/3]
MatrixMxN< T > & CubbyFlow::MatrixMxN< T >::operator+= | ( | const T & | s | ) |
Addition assignment with input scalar.
◆ operator+=() [2/3]
MatrixMxN& CubbyFlow::MatrixMxN< T >::operator+= | ( | const E & | m | ) |
Addition assignment with input matrix (element-wise).
◆ operator+=() [3/3]
MatrixMxN<T>& CubbyFlow::MatrixMxN< T >::operator+= | ( | const E & | m | ) |
◆ operator-=() [1/3]
MatrixMxN< T > & CubbyFlow::MatrixMxN< T >::operator-= | ( | const T & | s | ) |
Subtraction assignment with input scalar.
◆ operator-=() [2/3]
MatrixMxN& CubbyFlow::MatrixMxN< T >::operator-= | ( | const E & | m | ) |
Subtraction assignment with input matrix (element-wise).
◆ operator-=() [3/3]
MatrixMxN<T>& CubbyFlow::MatrixMxN< T >::operator-= | ( | const E & | m | ) |
◆ operator/=()
MatrixMxN< T > & CubbyFlow::MatrixMxN< T >::operator/= | ( | const T & | s | ) |
Division assignment with input scalar.
◆ operator=() [1/4]
MatrixMxN& CubbyFlow::MatrixMxN< T >::operator= | ( | const E & | m | ) |
Assigns input matrix.
◆ operator=() [2/4]
MatrixMxN< T > & CubbyFlow::MatrixMxN< T >::operator= | ( | const MatrixMxN< T > & | other | ) |
Copies to this matrix.
◆ operator=() [3/4]
|
noexcept |
Moves to this matrix.
◆ operator=() [4/4]
MatrixMxN<T>& CubbyFlow::MatrixMxN< T >::operator= | ( | const E & | m | ) |
◆ operator==()
bool CubbyFlow::MatrixMxN< T >::operator== | ( | const MatrixExpression< T, E > & | m | ) | const |
Returns true if is equal to m.
◆ operator[]() [1/2]
T & CubbyFlow::MatrixMxN< T >::operator[] | ( | size_t | i | ) |
Returns reference of i-th element.
◆ operator[]() [2/2]
const T & CubbyFlow::MatrixMxN< T >::operator[] | ( | size_t | i | ) | const |
Returns constant reference of i-th element.
◆ ParallelForEach()
void CubbyFlow::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:
The parameter type of the callback function doesn't have to be T&, but const T& or T can be used as well.
◆ ParallelForEachIndex()
void CubbyFlow::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:
◆ RAdd() [1/3]
MatrixScalarAdd< T, MatrixMxN< T > > CubbyFlow::MatrixMxN< T >::RAdd | ( | const T & | s | ) | const |
Returns input scalar + this matrix.
◆ RAdd() [2/3]
MatrixAdd<T, MatrixMxN, E> CubbyFlow::MatrixMxN< T >::RAdd | ( | const E & | m | ) | const |
Returns input matrix + this matrix (element-wise).
◆ RAdd() [3/3]
MatrixAdd<T, MatrixMxN<T>, E> CubbyFlow::MatrixMxN< T >::RAdd | ( | const E & | m | ) | const |
◆ RDiv()
MatrixScalarRDiv< T, MatrixMxN< T > > CubbyFlow::MatrixMxN< T >::RDiv | ( | const T & | s | ) | const |
Returns input matrix / this scalar.
◆ Resize()
void CubbyFlow::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/3]
MatrixScalarMul< T, MatrixMxN< T > > CubbyFlow::MatrixMxN< T >::RMul | ( | const T & | s | ) | const |
Returns input scalar * this matrix.
◆ RMul() [2/3]
MatrixMul<T, E, MatrixMxN> CubbyFlow::MatrixMxN< T >::RMul | ( | const E & | m | ) | const |
Returns input matrix * this matrix.
◆ RMul() [3/3]
MatrixMul<T, E, MatrixMxN<T> > CubbyFlow::MatrixMxN< T >::RMul | ( | const E & | m | ) | const |
◆ Rows()
size_t CubbyFlow::MatrixMxN< T >::Rows | ( | ) | const |
Returns number of rows of this matrix.
◆ RSub() [1/3]
MatrixScalarRSub< T, MatrixMxN< T > > CubbyFlow::MatrixMxN< T >::RSub | ( | const T & | s | ) | const |
Returns input scalar - this matrix.
◆ RSub() [2/3]
MatrixSub<T, MatrixMxN, E> CubbyFlow::MatrixMxN< T >::RSub | ( | const E & | m | ) | const |
Returns input matrix - this matrix (element-wise).
◆ RSub() [3/3]
MatrixSub<T, MatrixMxN<T>, E> CubbyFlow::MatrixMxN< T >::RSub | ( | const E & | m | ) | const |
◆ Set() [1/4]
void CubbyFlow::MatrixMxN< T >::Set | ( | const T & | s | ) |
Sets whole matrix with input scalar.
◆ Set() [2/4]
void CubbyFlow::MatrixMxN< T >::Set | ( | const std::initializer_list< std::initializer_list< T >> & | list | ) |
Sets a matrix with given initializer list list
.
This function will fill the matrix with given initializer list list
such as
Note the initializer has 4x3 structure which will resize to 4x3 matrix.
- Parameters
-
list Initializer list that should be copy to the new matrix.
◆ Set() [3/4]
void CubbyFlow::MatrixMxN< T >::Set | ( | const MatrixExpression< T, E > & | other | ) |
Copies from input matrix expression.
◆ Set() [4/4]
void CubbyFlow::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()
void CubbyFlow::MatrixMxN< T >::SetColumn | ( | size_t | j, |
const VectorExpression< T, E > & | col | ||
) |
Sets j-th column with input vector.
◆ SetDiagonal()
void CubbyFlow::MatrixMxN< T >::SetDiagonal | ( | const T & | s | ) |
Sets diagonal elements with input scalar.
◆ SetOffDiagonal()
void CubbyFlow::MatrixMxN< T >::SetOffDiagonal | ( | const T & | s | ) |
Sets off-diagonal elements with input scalar.
◆ SetRow()
void CubbyFlow::MatrixMxN< T >::SetRow | ( | size_t | i, |
const VectorExpression< T, E > & | row | ||
) |
Sets i-th row with input vector.
◆ size()
Size2 CubbyFlow::MatrixMxN< T >::size | ( | ) | const |
Returns the size of this matrix.
◆ StrictLowerTri()
MatrixTriangular< T, MatrixMxN< T > > CubbyFlow::MatrixMxN< T >::StrictLowerTri | ( | ) | const |
Returns strictly lower triangle part of this matrix.
◆ StrictUpperTri()
MatrixTriangular< T, MatrixMxN< T > > CubbyFlow::MatrixMxN< T >::StrictUpperTri | ( | ) | const |
Returns strictly upper triangle part of this matrix.
◆ Sub() [1/3]
MatrixScalarSub< T, MatrixMxN< T > > CubbyFlow::MatrixMxN< T >::Sub | ( | const T & | s | ) | const |
Returns this matrix - input scalar.
◆ Sub() [2/3]
MatrixSub<T, MatrixMxN, E> CubbyFlow::MatrixMxN< T >::Sub | ( | const E & | m | ) | const |
Returns this matrix - input matrix (element-wise).
◆ Sub() [3/3]
MatrixSub<T, MatrixMxN<T>, E> CubbyFlow::MatrixMxN< T >::Sub | ( | const E & | m | ) | const |
◆ Sum()
T CubbyFlow::MatrixMxN< T >::Sum | ( | ) | const |
Returns sum of all elements.
◆ Trace()
T CubbyFlow::MatrixMxN< T >::Trace | ( | ) | const |
Returns sum of all diagonal elements.
- Warning
- Should be a square matrix.
◆ Transpose()
void CubbyFlow::MatrixMxN< T >::Transpose | ( | ) |
Transposes this matrix.
◆ Transposed()
MatrixMxN< T > CubbyFlow::MatrixMxN< T >::Transposed | ( | ) | const |
Returns transposed matrix.
◆ UpperTri()
MatrixTriangular< T, MatrixMxN< T > > CubbyFlow::MatrixMxN< T >::UpperTri | ( | ) | const |
Returns upper triangle part of this matrix (including the diagonal).
The documentation for this class was generated from the following files:
- Core/Matrix/MatrixMxN.h
- Core/Matrix/MatrixMxN-Impl.h