qualpal 2.3.0
Loading...
Searching...
No Matches
qualpal::Matrix< T > Class Template Reference

Dynamic matrix class with runtime-determined dimensions. More...

#include <matrix.h>

Public Member Functions

 Matrix (std::size_t rows, std::size_t cols)
 Construct matrix with specified dimensions.
 
 Matrix ()
 Default constructor creates an empty matrix (0x0)
 
 Matrix (std::size_t rows, std::size_t cols, const std::vector< T > &data)
 Construct matrix with specified dimensions and data.
 
T & operator() (std::size_t row, std::size_t col)
 Access matrix element (mutable)
 
const T & operator() (std::size_t row, std::size_t col) const
 Access matrix element (const)
 
Matrix< T > transpose () const
 Create transpose of this matrix.
 
std::size_t ncol () const
 Get number of columns.
 
std::size_t nrow () const
 Get number of rows.
 

Detailed Description

template<typename T>
class qualpal::Matrix< T >

Dynamic matrix class with runtime-determined dimensions.

Template Parameters
TElement type (typically double or float)

Definition at line 22 of file matrix.h.

Constructor & Destructor Documentation

◆ Matrix() [1/3]

template<typename T >
qualpal::Matrix< T >::Matrix ( std::size_t  rows,
std::size_t  cols 
)
inline

Construct matrix with specified dimensions.

Parameters
rowsNumber of rows
colsNumber of columns

Definition at line 30 of file matrix.h.

◆ Matrix() [2/3]

template<typename T >
qualpal::Matrix< T >::Matrix ( )
inline

Default constructor creates an empty matrix (0x0)

Definition at line 40 of file matrix.h.

◆ Matrix() [3/3]

template<typename T >
qualpal::Matrix< T >::Matrix ( std::size_t  rows,
std::size_t  cols,
const std::vector< T > &  data 
)
inline

Construct matrix with specified dimensions and data.

Parameters
rowsNumber of rows
colsNumber of columns
dataVector containing matrix elements in column-major order

Definition at line 53 of file matrix.h.

Member Function Documentation

◆ ncol()

template<typename T >
std::size_t qualpal::Matrix< T >::ncol ( ) const
inline

Get number of columns.

Definition at line 99 of file matrix.h.

◆ nrow()

template<typename T >
std::size_t qualpal::Matrix< T >::nrow ( ) const
inline

Get number of rows.

Definition at line 102 of file matrix.h.

◆ operator()() [1/2]

template<typename T >
T & qualpal::Matrix< T >::operator() ( std::size_t  row,
std::size_t  col 
)
inline

Access matrix element (mutable)

Parameters
rowRow index
colColumn index
Returns
Reference to element at (row, col)

Definition at line 67 of file matrix.h.

◆ operator()() [2/2]

template<typename T >
const T & qualpal::Matrix< T >::operator() ( std::size_t  row,
std::size_t  col 
) const
inline

Access matrix element (const)

Parameters
rowRow index
colColumn index
Returns
Const reference to element at (row, col)

Definition at line 78 of file matrix.h.

◆ transpose()

template<typename T >
Matrix< T > qualpal::Matrix< T >::transpose ( ) const
inline

Create transpose of this matrix.

Returns
New matrix that is the transpose of this matrix

Definition at line 87 of file matrix.h.


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