Phyth v0.1.0
A dimensional safe C++ header-only mechanics and electromagnetics simulation library.
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Friends | List of all members
Phyth::Matrix< Row, Col, T > Struct Template Reference

#include <Matrix.hpp>

Public Member Functions

constexpr Matrix ()
 
template<typename... Args, std::enable_if_t< sizeof...(Args)==Col &&std::conjunction_v< std::is_convertible< Args, Vector< Row, T > >... >, int > = 0>
constexpr Matrix (Args... basics)
 
template<typename... Args, std::enable_if_t< sizeof...(Args)==Row *Col &&std::conjunction_v< std::is_convertible< Args, T >... >, int > = 0>
constexpr Matrix (Args... elems)
 
constexpr auto Transpose () const
 
constexpr T Trace () const
 
constexpr auto Symmetric () const
 
constexpr auto Antisymmetric () const
 
const T & At (const std::size_t i, const std::size_t j) const
 
T & At (const std::size_t i, const std::size_t j)
 
constexpr const T & operator() (const std::size_t i, const std::size_t j) const
 
constexpr T & operator() (const std::size_t i, const std::size_t j)
 
template<typename U >
constexpr auto operator+ (const Matrix< Row, Col, U > &other) const
 
template<typename U >
constexpr auto operator- (const Matrix< Row, Col, U > &other) const
 
constexpr auto operator- () const
 
template<typename U >
constexpr auto operator* (U scalar) const
 
template<typename U >
constexpr auto operator* (const Vector< Row, U > &v) const
 
template<typename U , std::size_t OtherCol>
constexpr auto operator* (const Matrix< Col, OtherCol, U > &other) const
 
template<typename U >
constexpr Matrix & operator+= (const Matrix< Row, Col, U > &other)
 
template<typename U >
constexpr Matrix & operator-= (const Matrix< Row, Col, U > &other)
 
template<typename U >
constexpr Matrix & operator*= (U scalar)
 
template<typename U >
constexpr bool operator== (const Matrix< Row, Col, U > &other) const
 
template<typename U >
constexpr bool operator!= (const Matrix< Row, Col, U > &other) const
 
template<typename UnitT >
Matrix< Row, Col, Quantity< UnitT > > As () const
 

Static Public Member Functions

static constexpr Matrix Identity ()
 

Public Attributes

std::array< Vector< Row, T >, Col > datas
 

Private Member Functions

template<std::size_t... Cs>
constexpr Matrix (const std::array< T, Row *Col > &flat, std::index_sequence< Cs... >)
 
template<std::size_t... Rs, std::size_t... Cs>
constexpr auto TransposeImpl (std::index_sequence< Rs... >, std::index_sequence< Cs... >) const
 
template<std::size_t R, std::size_t... Cs>
constexpr Vector< Col, T > MakeTransposeCol (std::index_sequence< Cs... >) const
 
template<std::size_t... Rs>
constexpr T TraceImpl (std::index_sequence< Rs... >) const
 
template<typename U , std::size_t... Cs>
constexpr auto AddImpl (const Matrix< Row, Col, U > &other, std::index_sequence< Cs... >) const
 
template<typename U , std::size_t... Cs>
constexpr auto SubImpl (const Matrix< Row, Col, U > &other, std::index_sequence< Cs... >) const
 
template<std::size_t... Cs>
constexpr auto NegImpl (std::index_sequence< Cs... >) const
 
template<typename U , std::size_t... Cs>
constexpr auto ScaleImpl (U scalar, std::index_sequence< Cs... >) const
 
template<typename UnitT , std::size_t... Cs>
constexpr Matrix< Row, Col, Quantity< UnitT > > AsImpl (std::index_sequence< Cs... >) const
 

Static Private Member Functions

template<std::size_t... Cs>
static constexpr Matrix MakeZero (std::index_sequence< Cs... >)
 
template<std::size_t... Rs>
static constexpr Vector< Row, T > MakeZeroCol (std::index_sequence< Rs... >)
 
template<std::size_t... Cs>
static constexpr Matrix IdentityImpl (std::index_sequence< Cs... >)
 
template<std::size_t C, std::size_t... Rs>
static constexpr Vector< Row, T > MakeIdentityCol (std::index_sequence< Rs... >)
 
template<std::size_t C, std::size_t... Rs>
static constexpr Vector< Row, T > MakeCol (const std::array< T, Row *Col > &flat, std::index_sequence< Rs... >)
 

Friends

std::ostream & operator<< (std::ostream &os, const Matrix &m)
 

Detailed Description

template<std::size_t Row, std::size_t Col, typename T>
struct Phyth::Matrix< Row, Col, T >

Definition at line 15 of file Matrix.hpp.

Constructor & Destructor Documentation

◆ Matrix() [1/4]

template<std::size_t Row, std::size_t Col, typename T >
constexpr Phyth::Matrix< Row, Col, T >::Matrix ( )
inlineconstexpr

Definition at line 21 of file Matrix.hpp.

◆ Matrix() [2/4]

template<std::size_t Row, std::size_t Col, typename T >
template<typename... Args, std::enable_if_t< sizeof...(Args)==Col &&std::conjunction_v< std::is_convertible< Args, Vector< Row, T > >... >, int > = 0>
constexpr Phyth::Matrix< Row, Col, T >::Matrix ( Args...  basics)
inlineconstexpr

Definition at line 29 of file Matrix.hpp.

◆ Matrix() [3/4]

template<std::size_t Row, std::size_t Col, typename T >
template<typename... Args, std::enable_if_t< sizeof...(Args)==Row *Col &&std::conjunction_v< std::is_convertible< Args, T >... >, int > = 0>
constexpr Phyth::Matrix< Row, Col, T >::Matrix ( Args...  elems)
inlineconstexpr

Definition at line 36 of file Matrix.hpp.

◆ Matrix() [4/4]

template<std::size_t Row, std::size_t Col, typename T >
template<std::size_t... Cs>
constexpr Phyth::Matrix< Row, Col, T >::Matrix ( const std::array< T, Row *Col > &  flat,
std::index_sequence< Cs... >   
)
inlineconstexprprivate

Definition at line 201 of file Matrix.hpp.

Member Function Documentation

◆ AddImpl()

template<std::size_t Row, std::size_t Col, typename T >
template<typename U , std::size_t... Cs>
constexpr auto Phyth::Matrix< Row, Col, T >::AddImpl ( const Matrix< Row, Col, U > &  other,
std::index_sequence< Cs... >   
) const
inlineconstexprprivate

Definition at line 229 of file Matrix.hpp.

◆ Antisymmetric()

template<std::size_t Row, std::size_t Col, typename T >
constexpr auto Phyth::Matrix< Row, Col, T >::Antisymmetric ( ) const
inlineconstexpr

Definition at line 59 of file Matrix.hpp.

◆ As()

template<std::size_t Row, std::size_t Col, typename T >
template<typename UnitT >
Matrix< Row, Col, Quantity< UnitT > > Phyth::Matrix< Row, Col, T >::As ( ) const
inline

Definition at line 162 of file Matrix.hpp.

◆ AsImpl()

template<std::size_t Row, std::size_t Col, typename T >
template<typename UnitT , std::size_t... Cs>
constexpr Matrix< Row, Col, Quantity< UnitT > > Phyth::Matrix< Row, Col, T >::AsImpl ( std::index_sequence< Cs... >  ) const
inlineconstexprprivate

Definition at line 255 of file Matrix.hpp.

◆ At() [1/2]

template<std::size_t Row, std::size_t Col, typename T >
T & Phyth::Matrix< Row, Col, T >::At ( const std::size_t  i,
const std::size_t  j 
)
inline

Definition at line 70 of file Matrix.hpp.

◆ At() [2/2]

template<std::size_t Row, std::size_t Col, typename T >
const T & Phyth::Matrix< Row, Col, T >::At ( const std::size_t  i,
const std::size_t  j 
) const
inline

Definition at line 63 of file Matrix.hpp.

◆ Identity()

template<std::size_t Row, std::size_t Col, typename T >
static constexpr Matrix Phyth::Matrix< Row, Col, T >::Identity ( )
inlinestaticconstexpr

Definition at line 40 of file Matrix.hpp.

◆ IdentityImpl()

template<std::size_t Row, std::size_t Col, typename T >
template<std::size_t... Cs>
static constexpr Matrix Phyth::Matrix< Row, Col, T >::IdentityImpl ( std::index_sequence< Cs... >  )
inlinestaticconstexprprivate

Definition at line 191 of file Matrix.hpp.

◆ MakeCol()

template<std::size_t Row, std::size_t Col, typename T >
template<std::size_t C, std::size_t... Rs>
static constexpr Vector< Row, T > Phyth::Matrix< Row, Col, T >::MakeCol ( const std::array< T, Row *Col > &  flat,
std::index_sequence< Rs... >   
)
inlinestaticconstexprprivate

Definition at line 207 of file Matrix.hpp.

◆ MakeIdentityCol()

template<std::size_t Row, std::size_t Col, typename T >
template<std::size_t C, std::size_t... Rs>
static constexpr Vector< Row, T > Phyth::Matrix< Row, Col, T >::MakeIdentityCol ( std::index_sequence< Rs... >  )
inlinestaticconstexprprivate

Definition at line 196 of file Matrix.hpp.

◆ MakeTransposeCol()

template<std::size_t Row, std::size_t Col, typename T >
template<std::size_t R, std::size_t... Cs>
constexpr Vector< Col, T > Phyth::Matrix< Row, Col, T >::MakeTransposeCol ( std::index_sequence< Cs... >  ) const
inlineconstexprprivate

Definition at line 219 of file Matrix.hpp.

◆ MakeZero()

template<std::size_t Row, std::size_t Col, typename T >
template<std::size_t... Cs>
static constexpr Matrix Phyth::Matrix< Row, Col, T >::MakeZero ( std::index_sequence< Cs... >  )
inlinestaticconstexprprivate

Definition at line 181 of file Matrix.hpp.

◆ MakeZeroCol()

template<std::size_t Row, std::size_t Col, typename T >
template<std::size_t... Rs>
static constexpr Vector< Row, T > Phyth::Matrix< Row, Col, T >::MakeZeroCol ( std::index_sequence< Rs... >  )
inlinestaticconstexprprivate

Definition at line 186 of file Matrix.hpp.

◆ NegImpl()

template<std::size_t Row, std::size_t Col, typename T >
template<std::size_t... Cs>
constexpr auto Phyth::Matrix< Row, Col, T >::NegImpl ( std::index_sequence< Cs... >  ) const
inlineconstexprprivate

Definition at line 243 of file Matrix.hpp.

◆ operator!=()

template<std::size_t Row, std::size_t Col, typename T >
template<typename U >
constexpr bool Phyth::Matrix< Row, Col, T >::operator!= ( const Matrix< Row, Col, U > &  other) const
inlineconstexpr

Definition at line 157 of file Matrix.hpp.

◆ operator()() [1/2]

template<std::size_t Row, std::size_t Col, typename T >
constexpr T & Phyth::Matrix< Row, Col, T >::operator() ( const std::size_t  i,
const std::size_t  j 
)
inlineconstexpr

Definition at line 81 of file Matrix.hpp.

◆ operator()() [2/2]

template<std::size_t Row, std::size_t Col, typename T >
constexpr const T & Phyth::Matrix< Row, Col, T >::operator() ( const std::size_t  i,
const std::size_t  j 
) const
inlineconstexpr

Definition at line 77 of file Matrix.hpp.

◆ operator*() [1/3]

template<std::size_t Row, std::size_t Col, typename T >
template<typename U , std::size_t OtherCol>
constexpr auto Phyth::Matrix< Row, Col, T >::operator* ( const Matrix< Col, OtherCol, U > &  other) const
inlineconstexpr

Definition at line 115 of file Matrix.hpp.

◆ operator*() [2/3]

template<std::size_t Row, std::size_t Col, typename T >
template<typename U >
constexpr auto Phyth::Matrix< Row, Col, T >::operator* ( const Vector< Row, U > &  v) const
inlineconstexpr

Definition at line 105 of file Matrix.hpp.

◆ operator*() [3/3]

template<std::size_t Row, std::size_t Col, typename T >
template<typename U >
constexpr auto Phyth::Matrix< Row, Col, T >::operator* ( U  scalar) const
inlineconstexpr

Definition at line 100 of file Matrix.hpp.

◆ operator*=()

template<std::size_t Row, std::size_t Col, typename T >
template<typename U >
constexpr Matrix & Phyth::Matrix< Row, Col, T >::operator*= ( U  scalar)
inlineconstexpr

Definition at line 141 of file Matrix.hpp.

◆ operator+()

template<std::size_t Row, std::size_t Col, typename T >
template<typename U >
constexpr auto Phyth::Matrix< Row, Col, T >::operator+ ( const Matrix< Row, Col, U > &  other) const
inlineconstexpr

Definition at line 86 of file Matrix.hpp.

◆ operator+=()

template<std::size_t Row, std::size_t Col, typename T >
template<typename U >
constexpr Matrix & Phyth::Matrix< Row, Col, T >::operator+= ( const Matrix< Row, Col, U > &  other)
inlineconstexpr

Definition at line 125 of file Matrix.hpp.

◆ operator-() [1/2]

template<std::size_t Row, std::size_t Col, typename T >
constexpr auto Phyth::Matrix< Row, Col, T >::operator- ( ) const
inlineconstexpr

Definition at line 95 of file Matrix.hpp.

◆ operator-() [2/2]

template<std::size_t Row, std::size_t Col, typename T >
template<typename U >
constexpr auto Phyth::Matrix< Row, Col, T >::operator- ( const Matrix< Row, Col, U > &  other) const
inlineconstexpr

Definition at line 91 of file Matrix.hpp.

◆ operator-=()

template<std::size_t Row, std::size_t Col, typename T >
template<typename U >
constexpr Matrix & Phyth::Matrix< Row, Col, T >::operator-= ( const Matrix< Row, Col, U > &  other)
inlineconstexpr

Definition at line 133 of file Matrix.hpp.

◆ operator==()

template<std::size_t Row, std::size_t Col, typename T >
template<typename U >
constexpr bool Phyth::Matrix< Row, Col, T >::operator== ( const Matrix< Row, Col, U > &  other) const
inlineconstexpr

Definition at line 149 of file Matrix.hpp.

◆ ScaleImpl()

template<std::size_t Row, std::size_t Col, typename T >
template<typename U , std::size_t... Cs>
constexpr auto Phyth::Matrix< Row, Col, T >::ScaleImpl ( U  scalar,
std::index_sequence< Cs... >   
) const
inlineconstexprprivate

Definition at line 248 of file Matrix.hpp.

◆ SubImpl()

template<std::size_t Row, std::size_t Col, typename T >
template<typename U , std::size_t... Cs>
constexpr auto Phyth::Matrix< Row, Col, T >::SubImpl ( const Matrix< Row, Col, U > &  other,
std::index_sequence< Cs... >   
) const
inlineconstexprprivate

Definition at line 236 of file Matrix.hpp.

◆ Symmetric()

template<std::size_t Row, std::size_t Col, typename T >
constexpr auto Phyth::Matrix< Row, Col, T >::Symmetric ( ) const
inlineconstexpr

Definition at line 55 of file Matrix.hpp.

◆ Trace()

template<std::size_t Row, std::size_t Col, typename T >
constexpr T Phyth::Matrix< Row, Col, T >::Trace ( ) const
inlineconstexpr

Definition at line 50 of file Matrix.hpp.

◆ TraceImpl()

template<std::size_t Row, std::size_t Col, typename T >
template<std::size_t... Rs>
constexpr T Phyth::Matrix< Row, Col, T >::TraceImpl ( std::index_sequence< Rs... >  ) const
inlineconstexprprivate

Definition at line 224 of file Matrix.hpp.

◆ Transpose()

template<std::size_t Row, std::size_t Col, typename T >
constexpr auto Phyth::Matrix< Row, Col, T >::Transpose ( ) const
inlineconstexpr

Definition at line 45 of file Matrix.hpp.

◆ TransposeImpl()

template<std::size_t Row, std::size_t Col, typename T >
template<std::size_t... Rs, std::size_t... Cs>
constexpr auto Phyth::Matrix< Row, Col, T >::TransposeImpl ( std::index_sequence< Rs... >  ,
std::index_sequence< Cs... >   
) const
inlineconstexprprivate

Definition at line 212 of file Matrix.hpp.

Friends And Related Symbol Documentation

◆ operator<<

template<std::size_t Row, std::size_t Col, typename T >
std::ostream & operator<< ( std::ostream &  os,
const Matrix< Row, Col, T > &  m 
)
friend

Definition at line 166 of file Matrix.hpp.

Member Data Documentation

◆ datas

template<std::size_t Row, std::size_t Col, typename T >
std::array<Vector<Row, T>, Col> Phyth::Matrix< Row, Col, T >::datas

Definition at line 19 of file Matrix.hpp.


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