Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shammath::mat_d< T > Class Template Reference

Matrix class with runtime size based on std::vector storage and mdspan. More...

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

Collaboration diagram for shammath::mat_d< T >:

Public Member Functions

 mat_d (int rows, int columns)
 Constructor.
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_d< T > &other) const
 Check if this matrix is equal to another one.
mat_doperator+= (const mat_d &other)
 Addition operator for matrices.
bool equal_at_precision (const mat_d< T > &other, const T precision) const
 check if this matrix is equal to another one at a given precison

Public Attributes

std::vector< T > data
 The matrix data.
int rows
 Number of rows.
int columns
 Number of columns.

Detailed Description

template<class T>
class shammath::mat_d< T >

Matrix class with runtime size based on std::vector storage and mdspan.

Template Parameters
Tthe type of the matrix entries

Definition at line 130 of file matrix.hpp.

Constructor & Destructor Documentation

◆ mat_d()

template<class T>
shammath::mat_d< T >::mat_d ( int rows,
int columns )
inline

Constructor.

Definition at line 140 of file matrix.hpp.

Member Function Documentation

◆ equal_at_precision()

template<class T>
bool shammath::mat_d< T >::equal_at_precision ( const mat_d< T > & other,
const T precision ) const
inline

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

Definition at line 170 of file matrix.hpp.

Here is the call graph for this function:

◆ get_mdspan() [1/2]

template<class T>
auto shammath::mat_d< T >::get_mdspan ( )
inlineconstexpr

Get the matrix data as a mdspan.

Definition at line 143 of file matrix.hpp.

◆ get_mdspan() [2/2]

template<class T>
auto shammath::mat_d< T >::get_mdspan ( ) const
inlineconstexpr

const overload

Definition at line 148 of file matrix.hpp.

◆ operator()() [1/2]

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

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

Definition at line 153 of file matrix.hpp.

Here is the call graph for this function:

◆ operator()() [2/2]

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

const overload

Definition at line 156 of file matrix.hpp.

Here is the call graph for this function:

◆ operator+=()

template<class T>
mat_d & shammath::mat_d< T >::operator+= ( const mat_d< T > & other)
inline

Addition operator for matrices.

Definition at line 162 of file matrix.hpp.

Here is the call graph for this function:

◆ operator==()

template<class T>
bool shammath::mat_d< T >::operator== ( const mat_d< T > & other) const
inline

Check if this matrix is equal to another one.

Definition at line 159 of file matrix.hpp.

Here is the call graph for this function:

Member Data Documentation

◆ columns

template<class T>
int shammath::mat_d< T >::columns

Number of columns.

Definition at line 137 of file matrix.hpp.

◆ data

template<class T>
std::vector<T> shammath::mat_d< T >::data

The matrix data.

Definition at line 133 of file matrix.hpp.

◆ rows

template<class T>
int shammath::mat_d< T >::rows

Number of rows.

Definition at line 135 of file matrix.hpp.


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