CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > Class Template Referencefinal

#include <Core/Matrix/Matrix.hpp>

Inheritance diagram for CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >:
CubbyFlow::MatrixExpression< T, MATRIX_SIZE_DYNAMIC, 1, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > > CubbyFlow::MatrixDenseBase< T, MATRIX_SIZE_DYNAMIC, 1, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > >

Public Types

using ValueType = T
 
using Reference = T &
 
using ConstReference = const T &
 
using Pointer = T *
 
using ConstPointer = const T *
 
using Iterator = Pointer
 
using ConstIterator = ConstPointer
 
- Public Types inherited from CubbyFlow::MatrixExpression< T, MATRIX_SIZE_DYNAMIC, 1, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > >
using ValueType = T
 
- Public Types inherited from CubbyFlow::MatrixDenseBase< T, MATRIX_SIZE_DYNAMIC, 1, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > >
using ValueType = T
 
using Reference = T &
 
using ConstReference = const T &
 

Public Member Functions

 Matrix ()
 
 Matrix (size_t rows, ConstReference value=ValueType{})
 
template<size_t R, size_t C, typename E >
 Matrix (const MatrixExpression< T, R, C, E > &expression)
 
 Matrix (const std::initializer_list< T > &lst)
 
 Matrix (size_t rows, ConstPointer ptr)
 
 ~Matrix ()=default
 
 Matrix (const Matrix &other)
 
 Matrix (Matrix &&other) noexcept
 
Matrixoperator= (const Matrix &other)
 
Matrixoperator= (Matrix &&other) noexcept
 
void Fill (const T &val)
 
void Fill (const std::function< T(size_t i)> &func)
 
void Fill (const std::function< T(size_t i, size_t j)> &func)
 
void Swap (Matrix &other)
 
void Resize (size_t rows, ConstReference val=ValueType{})
 
void AddElement (ConstReference newElem)
 
void AddElement (const Matrix &newElems)
 
void Clear ()
 
size_t GetRows () const
 
constexpr size_t GetCols () const
 
Iterator begin ()
 
ConstIterator begin () const
 
Iterator end ()
 
ConstIterator end () const
 
Pointer data ()
 
ConstPointer data () const
 
Reference operator[] (size_t i)
 
ConstReference operator[] (size_t i) const
 
- Public Member Functions inherited from CubbyFlow::MatrixExpression< T, MATRIX_SIZE_DYNAMIC, 1, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > >
constexpr size_t GetRows () const
 Returns the number of rows. More...
 
constexpr size_t GetCols () const
 Returns the number of columns. More...
 
Eval (size_t i, size_t j) const
 Returns the evaluated value for (i, j). More...
 
Matrix< T, Rows, Cols > Eval () const
 
bool IsSimilar (const MatrixExpression< T, R, C, E > &m, double tol=std::numeric_limits< double >::epsilon()) const
 
constexpr bool IsSquare () const
 Returns true if this matrix is a square matrix. More...
 
ValueType Sum () const
 
ValueType Avg () const
 
ValueType Min () const
 
ValueType Max () const
 
ValueType AbsMin () const
 
ValueType AbsMax () const
 
ValueType Trace () const
 
ValueType Determinant () const
 
std::enable_if_t<(Rows > 4 &&Cols > 4)||IsMatrixSizeDynamic< Rows, Cols >), U > Determinant (const MatrixExpression &m)
 
size_t DominantAxis () const
 
size_t SubdominantAxis () const
 
ValueType Norm () const
 
ValueType NormSquared () const
 
ValueType FrobeniusNorm () const
 
ValueType Length () const
 
ValueType LengthSquared () const
 
ValueType DistanceTo (const MatrixExpression< T, R, C, E > &other) const
 Returns the distance to the other vector. More...
 
DistanceTo (const MatrixExpression< T, R, C, E > &other) const
 
ValueType DistanceSquaredTo (const MatrixExpression< T, R, C, E > &other) const
 Returns the squared distance to the other vector. More...
 
DistanceSquaredTo (const MatrixExpression< T, R, C, E > &other) const
 
MatrixScalarElemWiseBinaryOp< T, Rows, Cols, const Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > &, std::divides< T > > Normalized () const
 
MatrixDiagonal< T, Rows, Cols, const Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > &> Diagonal () const
 Returns diagonal part of this matrix. More...
 
MatrixOffDiagonal< T, Rows, Cols, const Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > &> OffDiagonal () const
 Returns off-diagonal part of this matrix. More...
 
MatrixTri< T, Rows, Cols, const Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > &> StrictLowerTri () const
 Returns strictly lower triangle part of this matrix. More...
 
MatrixTri< T, Rows, Cols, const Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > &> StrictUpperTri () const
 Returns strictly upper triangle part of this matrix. More...
 
MatrixTri< T, Rows, Cols, const Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > &> LowerTri () const
 Returns lower triangle part of this matrix (including the diagonal). More...
 
MatrixTri< T, Rows, Cols, const Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > &> UpperTri () const
 Returns upper triangle part of this matrix (including the diagonal). More...
 
MatrixTranspose< T, Rows, Cols, const Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > &> Transposed () const
 
Matrix< T, Rows, Cols > Inverse () const
 Returns inverse matrix. More...
 
void Inverse (const MatrixExpression< T, Rows, Cols, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > > &m, std::enable_if_t<(Rows > 4 &&Cols > 4)||IsMatrixSizeDynamic< Rows, Cols >(), M > &result)
 
MatrixUnaryOp< U, Rows, Cols, const Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > &, TypeCast< T, U > > CastTo () const
 
MatrixTypeCast< T, Rows, Cols, U, const D &> CastTo () const
 
std::enable_if_t<(IsMatrixSizeDynamic< Rows, Cols >)||Cols==1) &&(IsMatrixSizeDynamic< R, C >)||C==1), U > Dot (const MatrixExpression< T, R, C, E > &expression) const
 
std::enable_if_t<(IsMatrixSizeDynamic< Rows, Cols >)||(Rows==2 &&Cols==1)) &&(IsMatrixSizeDynamic< R, C >)||(R==2 &&C==1)), U > Cross (const MatrixExpression< T, R, C, E > &expression) const
 
std::enable_if_t<(IsMatrixSizeDynamic< Rows, Cols >)||(Rows==3 &&Cols==1)) &&(IsMatrixSizeDynamic< R, C >)||(R==3 &&C==1)), Matrix< U, 3, 1 > > Cross (const MatrixExpression< T, R, C, E > &expression) const
 
std::enable_if_t<(IsMatrixSizeDynamic< Rows, Cols >)||((Rows==2||Rows==3) &&Cols==1)) &&(IsMatrixSizeDynamic< R, C >)||((R==2||R==3) &&C==1)), Matrix< U, Rows, 1 > > Reflected (const MatrixExpression< T, R, C, E > &normal) const
 Returns the reflection vector to the surface with given surface normal. More...
 
std::enable_if_t<(IsMatrixSizeDynamic< Rows, Cols >)||((Rows==2||Rows==3) &&Cols==1)) &&(IsMatrixSizeDynamic< R, C >)||((R==2||R==3) &&C==1)), Matrix< U, Rows, 1 > > Projected (const MatrixExpression< T, R, C, E > &normal) const
 Returns the projected vector to the surface with given surface normal. More...
 
std::enable_if_t<(IsMatrixSizeDynamic< Rows, Cols >)||(Rows==2 &&Cols==1)), Matrix< U, 2, 1 > > Tangential () const
 Returns the tangential vector for this vector. More...
 
std::enable_if_t<(IsMatrixSizeDynamic< Rows, Cols >)||(Rows==3 &&Cols==1)), std::tuple< Matrix< U, 3, 1 >, Matrix< U, 3, 1 > > > Tangentials () const
 Returns the tangential vectors for this vector. More...
 
Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > & GetDerived ()
 Returns actual implementation (the subclass). More...
 
const Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > & GetDerived () const
 Returns actual implementation (the subclass). More...
 
- Public Member Functions inherited from CubbyFlow::MatrixDenseBase< T, MATRIX_SIZE_DYNAMIC, 1, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > >
void CopyFrom (const MatrixExpression< T, R, C, E > &expression)
 Copies from generic expression. More...
 
void SetDiagonal (ConstReference val)
 Sets diagonal elements with input scalar. More...
 
void SetOffDiagonal (ConstReference val)
 Sets off-diagonal elements with input scalar. More...
 
void SetRow (size_t i, const MatrixExpression< T, R, C, E > &row)
 Sets i-th row with input column vector. More...
 
void SetColumn (size_t j, const MatrixExpression< T, R, C, E > &col)
 Sets j-th column with input vector. More...
 
void Normalize ()
 
void Transpose ()
 Transposes this matrix. More...
 
void Invert ()
 Inverts this matrix. More...
 
Reference operator() (size_t i, size_t j)
 
ConstReference operator() (size_t i, size_t j) const
 
MatrixDenseBaseoperator= (const MatrixExpression< T, R, C, E > &expression)
 Copies from generic expression. More...
 
MatrixDenseBase< T, Rows, Cols, D > & operator= (const MatrixExpression< T, R, C, E > &expression)
 

Additional Inherited Members

- Static Public Member Functions inherited from CubbyFlow::MatrixDenseBase< T, MATRIX_SIZE_DYNAMIC, 1, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > >
static std::enable_if_t< IsMatrixSizeStatic< Rows, Cols >), D > MakeZero ()
 Makes a static matrix with zero entries. More...
 
static std::enable_if_t< IsMatrixSizeDynamic< Rows, Cols >), D > MakeZero (size_t rows, size_t cols)
 Makes a dynamic matrix with zero entries. More...
 
static std::enable_if_t< IsMatrixSizeStatic< Rows, Cols >), D > MakeConstant (ValueType val)
 Makes a static matrix with constant entries. More...
 
static std::enable_if_t< IsMatrixSizeDynamic< Rows, Cols >), D > MakeConstant (size_t rows, size_t cols, ValueType val)
 Makes a dynamic matrix with constant entries. More...
 
static std::enable_if_t< IsMatrixStaticSquare< Rows, Cols >), D > MakeIdentity ()
 Makes a static identity matrix. More...
 
static std::enable_if_t< IsMatrixSizeDynamic< Rows, Cols >), D > MakeIdentity (size_t rows)
 Makes a dynamic identity matrix. More...
 
static std::enable_if_t< IsMatrixStaticSquare< Rows, Cols >), D > MakeScaleMatrix (ValueType first, Args... rest)
 Makes scale matrix. More...
 
static std::enable_if_t< IsMatrixStaticSquare< Rows, Cols >), D > MakeScaleMatrix (const MatrixExpression< T, R, C, E > &expression)
 Makes scale matrix. More...
 
static std::enable_if_t< IsMatrixStaticSquare< Rows, Cols >) &&(Rows==2), D > MakeRotationMatrix (T rad)
 
static std::enable_if_t< IsMatrixStaticSquare< Rows, Cols >) &&(Rows==3||Rows==4), D > MakeRotationMatrix (const MatrixExpression< T, R, C, E > &axis, T rad)
 
static std::enable_if_t< IsMatrixStaticSquare< Rows, Cols >) &&(Rows==4), D > MakeTranslationMatrix (const MatrixExpression< T, R, C, E > &t)
 Makes translation matrix. More...
 
- Protected Member Functions inherited from CubbyFlow::MatrixExpression< T, MATRIX_SIZE_DYNAMIC, 1, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > >
 MatrixExpression ()=default
 
- Protected Member Functions inherited from CubbyFlow::MatrixDenseBase< T, MATRIX_SIZE_DYNAMIC, 1, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > >
 MatrixDenseBase ()=default
 
- Static Protected Member Functions inherited from CubbyFlow::MatrixExpression< T, MATRIX_SIZE_DYNAMIC, 1, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > >
static constexpr T Determinant (const MatrixExpression< T, 1, 1, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > > &m)
 
static constexpr T Determinant (const MatrixExpression< T, 2, 2, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > > &m)
 
static constexpr T Determinant (const MatrixExpression< T, 3, 3, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > > &m)
 
static constexpr T Determinant (const MatrixExpression< T, 4, 4, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > > &m)
 
static std::enable_if_t<(Rows > 4 &&Cols > 4)||IsMatrixSizeDynamic< Rows, Cols >), U > Determinant (const MatrixExpression< T, Rows, Cols, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > > &m)
 
static void Inverse (const MatrixExpression< T, 1, 1, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > > &m, Matrix< T, Rows, Cols > &result)
 
static void Inverse (const MatrixExpression< T, 2, 2, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > > &m, Matrix< T, Rows, Cols > &result)
 
static void Inverse (const MatrixExpression< T, 3, 3, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > > &m, Matrix< T, Rows, Cols > &result)
 
static void Inverse (const MatrixExpression< T, 4, 4, Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > > &m, Matrix< T, Rows, Cols > &result)
 
static void Inverse (const MatrixExpression &m, std::enable_if_t<(Rows > 4 &&Cols > 4)||IsMatrixSizeDynamic< Rows, Cols >(), M > &result)
 

Member Typedef Documentation

◆ ConstIterator

template<typename T>
using CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::ConstIterator = ConstPointer

◆ ConstPointer

template<typename T>
using CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::ConstPointer = const T*

◆ ConstReference

template<typename T>
using CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::ConstReference = const T&

◆ Iterator

template<typename T>
using CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Iterator = Pointer

◆ Pointer

template<typename T>
using CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Pointer = T*

◆ Reference

template<typename T>
using CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Reference = T&

◆ ValueType

template<typename T>
using CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::ValueType = T

Constructor & Destructor Documentation

◆ Matrix() [1/7]

template<typename T >
CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Matrix ( )

◆ Matrix() [2/7]

template<typename T >
CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Matrix ( size_t  rows,
ConstReference  value = ValueType{} 
)

◆ Matrix() [3/7]

template<typename T >
template<size_t R, size_t C, typename E >
CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Matrix ( const MatrixExpression< T, R, C, E > &  expression)

◆ Matrix() [4/7]

template<typename T >
CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Matrix ( const std::initializer_list< T > &  lst)

◆ Matrix() [5/7]

template<typename T >
CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Matrix ( size_t  rows,
ConstPointer  ptr 
)
explicit

◆ ~Matrix()

template<typename T>
CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::~Matrix ( )
default

◆ Matrix() [6/7]

template<typename T >
CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Matrix ( const Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > &  other)

◆ Matrix() [7/7]

template<typename T >
CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Matrix ( Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > &&  other)
noexcept

Member Function Documentation

◆ AddElement() [1/2]

template<typename T >
void CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::AddElement ( ConstReference  newElem)

◆ AddElement() [2/2]

template<typename T >
void CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::AddElement ( const Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > &  newElems)

◆ begin() [1/2]

template<typename T >
Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Iterator CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::begin ( )

◆ begin() [2/2]

template<typename T >
Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::ConstIterator CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::begin ( ) const

◆ Clear()

template<typename T >
void CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Clear ( )

◆ data() [1/2]

template<typename T >
Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Pointer CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::data ( )

◆ data() [2/2]

template<typename T >
Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::ConstPointer CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::data ( ) const

◆ end() [1/2]

template<typename T >
Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Iterator CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::end ( )

◆ end() [2/2]

template<typename T >
Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::ConstIterator CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::end ( ) const

◆ Fill() [1/3]

template<typename T >
void CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Fill ( const T &  val)

◆ Fill() [2/3]

template<typename T >
void CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Fill ( const std::function< T(size_t i)> &  func)

◆ Fill() [3/3]

template<typename T >
void CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Fill ( const std::function< T(size_t i, size_t j)> &  func)

◆ GetCols()

template<typename T >
constexpr size_t CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::GetCols ( ) const

◆ GetRows()

template<typename T >
size_t CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::GetRows ( ) const

◆ operator=() [1/2]

template<typename T >
Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > & CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::operator= ( const Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > &  other)

◆ operator=() [2/2]

template<typename T >
Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > & CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::operator= ( Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > &&  other)
noexcept

◆ operator[]() [1/2]

template<typename T >
Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Reference CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::operator[] ( size_t  i)

◆ operator[]() [2/2]

template<typename T >
Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::ConstReference CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::operator[] ( size_t  i) const

◆ Resize()

template<typename T >
void CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Resize ( size_t  rows,
ConstReference  val = ValueType{} 
)

◆ Swap()

template<typename T >
void CubbyFlow::Matrix< T, MATRIX_SIZE_DYNAMIC, 1 >::Swap ( Matrix< T, MATRIX_SIZE_DYNAMIC, 1 > &  other)

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