numerics 0.1.0
Loading...
Searching...
No Matches
num::BasicVector< T > Class Template Reference

Dense vector with optional GPU storage, templated over scalar type T. More...

#include <vector.hpp>

Public Member Functions

 BasicVector ()
 
 BasicVector (idx n)
 
 BasicVector (idx n, T val)
 
 BasicVector (std::initializer_list< T > init)
 
 ~BasicVector ()
 
 BasicVector (const BasicVector &o)
 
 BasicVector (BasicVector &&o) noexcept
 
BasicVectoroperator= (const BasicVector &o)
 
BasicVectoroperator= (BasicVector &&o) noexcept
 
constexpr idx size () const noexcept
 
BasicVectorvec ()
 Satisfy the VecField concept: a Vector is its own underlying vector.
 
const BasicVectorvec () const
 
T * data ()
 
const T * data () const
 
T & operator[] (idx i)
 
operator[] (idx i) const
 
T * begin ()
 
T * end ()
 
const T * begin () const
 
const T * end () const
 
void to_gpu ()
 
void to_cpu ()
 
realgpu_data ()
 
const realgpu_data () const
 
bool on_gpu () const
 

Detailed Description

template<typename T>
class num::BasicVector< T >

Dense vector with optional GPU storage, templated over scalar type T.

Typical aliases:

All member functions are defined inline so the template is usable across translation units without explicit instantiation.

Definition at line 24 of file vector.hpp.

Constructor & Destructor Documentation

◆ BasicVector() [1/6]

template<typename T >
num::BasicVector< T >::BasicVector ( )
inline

Definition at line 26 of file vector.hpp.

◆ BasicVector() [2/6]

template<typename T >
num::BasicVector< T >::BasicVector ( idx  n)
inlineexplicit

Definition at line 28 of file vector.hpp.

◆ BasicVector() [3/6]

template<typename T >
num::BasicVector< T >::BasicVector ( idx  n,
val 
)
inline

Definition at line 30 of file vector.hpp.

◆ BasicVector() [4/6]

template<typename T >
num::BasicVector< T >::BasicVector ( std::initializer_list< T >  init)
inline

Definition at line 34 of file vector.hpp.

◆ ~BasicVector()

template<typename T >
num::BasicVector< T >::~BasicVector ( )
inline

Definition at line 39 of file vector.hpp.

References num::cuda::free().

◆ BasicVector() [5/6]

template<typename T >
num::BasicVector< T >::BasicVector ( const BasicVector< T > &  o)
inline

Definition at line 46 of file vector.hpp.

◆ BasicVector() [6/6]

template<typename T >
num::BasicVector< T >::BasicVector ( BasicVector< T > &&  o)
inlinenoexcept

Definition at line 50 of file vector.hpp.

Member Function Documentation

◆ begin() [1/2]

template<typename T >
T * num::BasicVector< T >::begin ( )
inline

Definition at line 92 of file vector.hpp.

◆ begin() [2/2]

template<typename T >
const T * num::BasicVector< T >::begin ( ) const
inline

Definition at line 94 of file vector.hpp.

◆ data() [1/2]

◆ data() [2/2]

template<typename T >
const T * num::BasicVector< T >::data ( ) const
inline

Definition at line 87 of file vector.hpp.

◆ end() [1/2]

template<typename T >
T * num::BasicVector< T >::end ( )
inline

Definition at line 93 of file vector.hpp.

◆ end() [2/2]

template<typename T >
const T * num::BasicVector< T >::end ( ) const
inline

Definition at line 95 of file vector.hpp.

◆ gpu_data() [1/2]

◆ gpu_data() [2/2]

template<typename T >
const real * num::BasicVector< T >::gpu_data ( ) const
inline

Definition at line 119 of file vector.hpp.

◆ on_gpu()

template<typename T >
bool num::BasicVector< T >::on_gpu ( ) const
inline

Definition at line 120 of file vector.hpp.

◆ operator=() [1/2]

template<typename T >
BasicVector & num::BasicVector< T >::operator= ( BasicVector< T > &&  o)
inlinenoexcept

Definition at line 65 of file vector.hpp.

References num::cuda::free().

◆ operator=() [2/2]

template<typename T >
BasicVector & num::BasicVector< T >::operator= ( const BasicVector< T > &  o)
inline

Definition at line 56 of file vector.hpp.

◆ operator[]() [1/2]

template<typename T >
T & num::BasicVector< T >::operator[] ( idx  i)
inline

Definition at line 89 of file vector.hpp.

◆ operator[]() [2/2]

template<typename T >
T num::BasicVector< T >::operator[] ( idx  i) const
inline

Definition at line 90 of file vector.hpp.

◆ size()

template<typename T >
constexpr idx num::BasicVector< T >::size ( ) const
inlineconstexprnoexcept

Definition at line 80 of file vector.hpp.

Referenced by num::backends::seq::add(), num::add(), num::kernel::subspace::DenseOp::apply(), num::kernel::subspace::SparseOp::apply(), num::kernel::subspace::CallableOp< F >::apply(), num::kernel::array::axpby(), num::kernel::array::axpbyz(), num::axpy(), num::backends::blas::axpy(), num::backends::gpu::axpy(), num::backends::omp::axpy(), num::backends::seq::axpy(), num::banded_gemv(), num::banded_lu_solve(), num::banded_solve(), backends::seq::bit_reverse(), num::cg(), num::cg_matfree(), backends::seq::cooley_tukey(), num::pde::diffusion_step_2d(), num::pde::diffusion_step_2d_4th_dirichlet(), num::pde::diffusion_step_2d_dirichlet(), num::dot(), num::backends::blas::dot(), num::backends::gpu::dot(), num::backends::omp::dot(), num::backends::seq::dot(), num::spectral::FFTPlan::execute(), num::spectral::fft(), backends::opt::fft(), backends::seq::fft(), num::gauss_seidel(), num::kernel::dense::ger(), num::gmres(), num::spectral::ifft(), backends::opt::ifft(), backends::seq::ifft(), num::spectral::irfft(), num::jacobi(), num::kernel::reduce::l1_norm(), num::kernel::reduce::linf_norm(), num::kernel::array::map(), num::kernel::array::map(), num::norm(), num::backends::blas::norm(), num::backends::gpu::norm(), num::backends::seq::norm(), num::detail::normalise(), num::rayleigh_iteration(), num::kernel::array::reduce(), backends::opt::rfft(), backends::seq::rfft(), num::spectral::rfft(), num::scale(), num::backends::blas::scale(), num::backends::gpu::scale(), num::backends::omp::scale(), num::backends::seq::scale(), num::ScalarField2D::size(), num::Vec2View::size(), num::Vec2ConstView::size(), num::sparse_matvec(), num::kernel::reduce::sum(), num::backends::lapack::thomas(), num::backends::seq::thomas(), num::thomas(), num::kernel::dense::trsv_lower(), num::kernel::dense::trsv_upper(), and num::kernel::array::zip_map().

◆ to_cpu()

template<typename T >
void num::BasicVector< T >::to_cpu ( )
inline

Definition at line 108 of file vector.hpp.

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

Referenced by num::cg(), and num::thomas().

◆ to_gpu()

template<typename T >
void num::BasicVector< T >::to_gpu ( )
inline

Definition at line 99 of file vector.hpp.

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

Referenced by num::cg(), and num::thomas().

◆ vec() [1/2]

template<typename T >
BasicVector & num::BasicVector< T >::vec ( )
inline

Satisfy the VecField concept: a Vector is its own underlying vector.

Definition at line 83 of file vector.hpp.

Referenced by num::ode::advance(), and num::ode::advance().

◆ vec() [2/2]

template<typename T >
const BasicVector & num::BasicVector< T >::vec ( ) const
inline

Definition at line 84 of file vector.hpp.


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