Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shammath::mat< T, m, n > Class Template Reference

Matrix class based on std::array storage and mdspan. More...

#include <shammath/include/shammath/matrix.hpp>

Collaboration diagram for shammath::mat< T, m, n >:

Public Member Functions

constexpr auto get_mdspan ()
 Get the matrix data as a mdspan.
constexpr auto get_mdspan () const
 const overload
constexpr T & operator() (int i, int j)
 Access the matrix entry at position (i, j).
constexpr const T & operator() (int i, int j) const
 const overload
bool operator== (const mat< T, m, n > &other) const
 Check if this matrix is equal to another one.
matoperator+= (const mat &other)
bool equal_at_precision (const mat< T, m, n > &other, const T precision) const
 check if this matrix is equal to another one at a given precison

Public Attributes

std::array< T, m *n > data
 The matrix data.

Detailed Description

template<class T, int m, int n>
class shammath::mat< T, m, n >

Matrix class based on std::array storage and mdspan.

Template Parameters
Tthe type of the matrix entries
mthe number of rows
nthe number of columns

Definition at line 36 of file matrix.hpp.

Member Function Documentation

◆ equal_at_precision()

template<class T, int m, int n>
bool shammath::mat< T, m, n >::equal_at_precision ( const mat< T, m, n > & other,
const T precision ) const
inline

check if this matrix is equal to another one at a given precison

Definition at line 69 of file matrix.hpp.

◆ get_mdspan() [1/2]

template<class T, int m, int n>
auto shammath::mat< T, m, n >::get_mdspan ( )
inlineconstexpr

Get the matrix data as a mdspan.

Definition at line 42 of file matrix.hpp.

◆ get_mdspan() [2/2]

template<class T, int m, int n>
auto shammath::mat< T, m, n >::get_mdspan ( ) const
inlineconstexpr

const overload

Definition at line 47 of file matrix.hpp.

◆ operator()() [1/2]

template<class T, int m, int n>
T & shammath::mat< T, m, n >::operator() ( int i,
int j )
inlineconstexpr

Access the matrix entry at position (i, j).

Definition at line 52 of file matrix.hpp.

◆ operator()() [2/2]

template<class T, int m, int n>
const T & shammath::mat< T, m, n >::operator() ( int i,
int j ) const
inlineconstexpr

const overload

Definition at line 55 of file matrix.hpp.

◆ operator+=()

template<class T, int m, int n>
mat & shammath::mat< T, m, n >::operator+= ( const mat< T, m, n > & other)
inline

Definition at line 60 of file matrix.hpp.

◆ operator==()

template<class T, int m, int n>
bool shammath::mat< T, m, n >::operator== ( const mat< T, m, n > & other) const
inline

Check if this matrix is equal to another one.

Definition at line 58 of file matrix.hpp.

Member Data Documentation

◆ data

template<class T, int m, int n>
std::array<T, m * n> shammath::mat< T, m, n >::data

The matrix data.

Definition at line 39 of file matrix.hpp.


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