numerics
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
 
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 23 of file vector.hpp.

Constructor & Destructor Documentation

◆ BasicVector() [1/6]

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

Definition at line 25 of file vector.hpp.

◆ BasicVector() [2/6]

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

Definition at line 27 of file vector.hpp.

◆ BasicVector() [3/6]

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

Definition at line 29 of file vector.hpp.

References num::ipow().

◆ BasicVector() [4/6]

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

Definition at line 33 of file vector.hpp.

◆ ~BasicVector()

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

Definition at line 38 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 44 of file vector.hpp.

References num::ipow().

◆ BasicVector() [6/6]

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

Definition at line 48 of file vector.hpp.

References num::ipow().

Member Function Documentation

◆ begin() [1/2]

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

Definition at line 85 of file vector.hpp.

Referenced by nbody::NBodySim::make_accel().

◆ begin() [2/2]

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

Definition at line 87 of file vector.hpp.

◆ data() [1/2]

◆ data() [2/2]

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

Definition at line 80 of file vector.hpp.

◆ end() [1/2]

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

Definition at line 86 of file vector.hpp.

Referenced by nbody::NBodySim::make_accel().

◆ end() [2/2]

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

Definition at line 88 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 112 of file vector.hpp.

◆ on_gpu()

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

Definition at line 113 of file vector.hpp.

◆ operator=() [1/2]

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

Definition at line 63 of file vector.hpp.

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

◆ operator=() [2/2]

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

Definition at line 54 of file vector.hpp.

References num::ipow().

◆ operator[]() [1/2]

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

Definition at line 82 of file vector.hpp.

References num::ipow().

◆ operator[]() [2/2]

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

Definition at line 83 of file vector.hpp.

References num::ipow().

◆ size()

◆ to_cpu()

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

Definition at line 101 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 92 of file vector.hpp.

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

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


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