cuLite v0.3.1
A lite CUDA C++ Interface
Loading...
Searching...
No Matches
culite::dns::XiVector< T_Scalar > Class Template Reference

The general purpose device dense vector class. More...

Inheritance diagram for culite::dns::XiVector< T_Scalar >:

Public Member Functions

void clear ()
 Clear the device vector.
void fill (T_Scalar val)
 Fill all elements with a value.
XiVector< T_Scalar > copy () const
 Create a deep copy of the device vector.
XiVector< T_Scalar > rcopy ()
 Create a reference copy (shallow copy) of the device vector.
Guard< XiVector< T_Scalar > > rcopy () const
 Create a guarded reference copy (shallow copy) of the device vector.
XiVector< T_Scalar > move ()
 Move the device vector's resources.
std::string info (const std::string &header="") const
 Get information about the device vector.
void copyToHost (::cla3p::dns::XiVector< T_Cla3pScalar > &dest) const
 Copies the device vector to a host vector.
void copyFromHost (const ::cla3p::dns::XiVector< T_Cla3pScalar > &src)
 Copies a host vector to the device vector.

Creators/Generators

static Guard< XiVector< T_Scalar > > view (int_t n, const T_Scalar *vals)
 Create a view of existing device memory.

Detailed Description

template<typename T_Scalar>
class culite::dns::XiVector< T_Scalar >

The general purpose device dense vector class.

Represents a dense vector stored on the GPU device.

Template Parameters
T_ScalarThe scalar type (e.g., float, double, complex).

Member Function Documentation

◆ clear()

template<typename T_Scalar>
void culite::dns::XiVector< T_Scalar >::clear ( )

Clear the device vector.

Releases all device memory and resets the vector to an empty state.

◆ fill()

template<typename T_Scalar>
void culite::dns::XiVector< T_Scalar >::fill ( T_Scalar val)

Fill all elements with a value.

Sets all elements in the vector to the specified scalar value.

Parameters
[in]valThe scalar value to fill with.

◆ copy()

template<typename T_Scalar>
XiVector< T_Scalar > culite::dns::XiVector< T_Scalar >::copy ( ) const

Create a deep copy of the device vector.

Creates a new device vector with its own device memory allocation and copies all elements from this vector to the new vector.

Returns
A new device vector containing a copy of this vector's data.

◆ rcopy() [1/2]

template<typename T_Scalar>
XiVector< T_Scalar > culite::dns::XiVector< T_Scalar >::rcopy ( )

Create a reference copy (shallow copy) of the device vector.

Creates a new device vector object that references the same device memory as this vector. Changes to either vector will affect both.

Returns
A device vector that shares device memory with this vector.

◆ rcopy() [2/2]

template<typename T_Scalar>
Guard< XiVector< T_Scalar > > culite::dns::XiVector< T_Scalar >::rcopy ( ) const

Create a guarded reference copy (shallow copy) of the device vector.

Creates a guarded device vector object that references the same device memory as this vector. The guard ensures the reference is read-only.

Returns
A guarded device vector that shares device memory with this vector.

◆ move()

template<typename T_Scalar>
XiVector< T_Scalar > culite::dns::XiVector< T_Scalar >::move ( )

Move the device vector's resources.

Transfers ownership of the device memory to a new vector object, leaving this vector in an empty state.

Returns
A new device vector containing this vector's device memory.

◆ info()

template<typename T_Scalar>
std::string culite::dns::XiVector< T_Scalar >::info ( const std::string & header = "") const

Get information about the device vector.

Returns a string containing information about the vector's size and properties.

Parameters
[in]headerOptional header string to prepend to the information.
Returns
A string containing vector information.
Examples
ex01a_dense_vector_create.cpp, and ex01c_dense_vector_create_from_aux_data.cpp.

◆ copyToHost()

template<typename T_Scalar>
void culite::dns::XiVector< T_Scalar >::copyToHost ( ::cla3p::dns::XiVector< T_Cla3pScalar > & dest) const

Copies the device vector to a host vector.

Performs a device-to-host copy operation. If dest is empty, it is resized to match the size of the device vector. Otherwise, dest must be compatible with the device vector.

Parameters
[out]destThe destination host vector.

◆ copyFromHost()

template<typename T_Scalar>
void culite::dns::XiVector< T_Scalar >::copyFromHost ( const ::cla3p::dns::XiVector< T_Cla3pScalar > & src)

Copies a host vector to the device vector.

Performs a host-to-device copy operation. If the device vector is empty, it is resized to match the size of src. Otherwise, the device vector must be compatible with src.

Parameters
[in]srcThe source host vector.

◆ view()

template<typename T_Scalar>
Guard< XiVector< T_Scalar > > culite::dns::XiVector< T_Scalar >::view ( int_t n,
const T_Scalar * vals )
static

Create a view of existing device memory.

Creates a guarded device vector that references existing device memory without taking ownership. The memory must remain valid for the lifetime of the returned view.

Parameters
[in]nThe number of elements in the vector.
[in]valsPointer to the device memory.
Returns
A guarded device vector that views the specified device memory.