numerics 0.1.0
Loading...
Searching...
No Matches
num::Matrix Class Reference

Dense row-major matrix with optional GPU storage. More...

#include <matrix.hpp>

Public Member Functions

 Matrix ()
 
 Matrix (idx rows, idx cols)
 
 Matrix (idx rows, idx cols, real val)
 
 ~Matrix ()
 
 Matrix (const Matrix &)
 
 Matrix (Matrix &&) noexcept
 
Matrixoperator= (const Matrix &)
 
Matrixoperator= (Matrix &&) noexcept
 
constexpr idx rows () const noexcept
 
constexpr idx cols () const noexcept
 
constexpr idx size () const noexcept
 
realdata ()
 
const realdata () const
 
realoperator() (idx i, idx j)
 
real operator() (idx i, idx j) const
 
void to_gpu ()
 
void to_cpu ()
 
realgpu_data ()
 
const realgpu_data () const
 
bool on_gpu () const
 

Detailed Description

Dense row-major matrix with optional GPU storage.

Definition at line 12 of file matrix.hpp.

Constructor & Destructor Documentation

◆ Matrix() [1/5]

num::Matrix::Matrix ( )
inline

Definition at line 14 of file matrix.hpp.

◆ Matrix() [2/5]

num::Matrix::Matrix ( idx  rows,
idx  cols 
)

Definition at line 23 of file matrix.cpp.

◆ Matrix() [3/5]

num::Matrix::Matrix ( idx  rows,
idx  cols,
real  val 
)

Definition at line 28 of file matrix.cpp.

References size().

◆ ~Matrix()

num::Matrix::~Matrix ( )

Definition at line 35 of file matrix.cpp.

References num::cuda::free().

◆ Matrix() [4/5]

num::Matrix::Matrix ( const Matrix o)

Definition at line 40 of file matrix.cpp.

References size().

◆ Matrix() [5/5]

num::Matrix::Matrix ( Matrix &&  o)
noexcept

Definition at line 47 of file matrix.cpp.

Member Function Documentation

◆ cols()

◆ data() [1/2]

◆ data() [2/2]

const real * num::Matrix::data ( ) const
inline

Definition at line 29 of file matrix.hpp.

◆ gpu_data() [1/2]

real * num::Matrix::gpu_data ( )
inline

Definition at line 35 of file matrix.hpp.

Referenced by num::backends::gpu::matmul(), and num::backends::gpu::matvec().

◆ gpu_data() [2/2]

const real * num::Matrix::gpu_data ( ) const
inline

Definition at line 36 of file matrix.hpp.

◆ on_gpu()

bool num::Matrix::on_gpu ( ) const
inline

Definition at line 37 of file matrix.hpp.

◆ operator()() [1/2]

real & num::Matrix::operator() ( idx  i,
idx  j 
)
inline

Definition at line 30 of file matrix.hpp.

◆ operator()() [2/2]

real num::Matrix::operator() ( idx  i,
idx  j 
) const
inline

Definition at line 31 of file matrix.hpp.

◆ operator=() [1/2]

Matrix & num::Matrix::operator= ( const Matrix o)

Definition at line 56 of file matrix.cpp.

References size().

◆ operator=() [2/2]

Matrix & num::Matrix::operator= ( Matrix &&  o)
noexcept

Definition at line 66 of file matrix.cpp.

References num::cuda::free().

◆ rows()

◆ size()

constexpr idx num::Matrix::size ( ) const
inlineconstexprnoexcept

◆ to_cpu()

void num::Matrix::to_cpu ( )

Definition at line 87 of file matrix.cpp.

References num::cuda::free(), size(), and num::cuda::to_host().

◆ to_gpu()

void num::Matrix::to_gpu ( )

Definition at line 80 of file matrix.cpp.

References num::cuda::alloc(), size(), and num::cuda::to_device().


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