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

The floating point device dense vector class. More...

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

Constructors

 XxVector ()
 Default constructor.
 XxVector (int_t n)
 Dimension constructor.
 XxVector (int_t n, T_Scalar *vals, bool bind)
 Auxiliary constructor.
 XxVector (const XxVector< T_Scalar > &other)=default
 Copy constructor.
 XxVector (XxVector< T_Scalar > &&other)=default
 Move constructor.
 ~XxVector ()
 Destructor.

Operators

XxVector< T_Scalar > & operator= (const XxVector< T_Scalar > &other)=default
 Copy assignment operator.
XxVector< T_Scalar > & operator= (XxVector< T_Scalar > &&other)=default
 Move assignment operator.
void operator= (T_Scalar val)
 Fill operator.
alias::VirtualScal_vec< T_Scalar > operator- () const
 Unary negation operator.

Public Member Functions

void iscale (const T_Scalar &val)
 Scale the device vector in-place.
VirtualRowvec< T_Scalar > transpose () const
 Transpose the vector.
VirtualRowvec< T_Scalar > ctranspose () const
 Conjugate transpose the vector.
alias::VirtualConj_vec< T_Scalar > conjugate () const
 Compute the complex conjugate.
void iconjugate ()
 Conjugate the device vector in-place.
T_RScalar normOne () const
 Compute the 1-norm.
T_RScalar normInf () const
 Compute the infinity norm.
T_RScalar normEuc () const
 Compute the Euclidean norm (2-norm).
XxVector< T_Scalar > block (int_t ibgn, int_t ni) const
 Extract a block as a new device vector.
XxVector< T_Scalar > rblock (int_t ibgn, int_t ni)
 Extract a reference block.
Guard< XxVector< T_Scalar > > rblock (int_t ibgn, int_t ni) const
 Extract a guarded reference block.
void setBlock (int_t ibgn, const XxVector< T_Scalar > &src)
 Set a block of elements.

Additional Inherited Members

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.
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::XxVector< T_Scalar >

The floating point device dense vector class.

Represents a floating-point dense vector stored on the GPU device.

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

Constructor & Destructor Documentation

◆ XxVector() [1/5]

template<typename T_Scalar>
culite::dns::XxVector< T_Scalar >::XxVector ( )

Default constructor.

Creates an empty device vector with no allocated device memory.

◆ XxVector() [2/5]

template<typename T_Scalar>
culite::dns::XxVector< T_Scalar >::XxVector ( int_t n)
explicit

Dimension constructor.

Creates a device vector of the specified size and allocates device memory.

Parameters
[in]nThe number of elements in the vector.

◆ XxVector() [3/5]

template<typename T_Scalar>
culite::dns::XxVector< T_Scalar >::XxVector ( int_t n,
T_Scalar * vals,
bool bind )
explicit

Auxiliary constructor.

Creates a device vector using existing device memory.

Parameters
[in]nThe number of elements in the vector.
[in]valsPointer to existing device memory.
[in]bindIf true, the vector takes ownership of the memory.

◆ XxVector() [4/5]

template<typename T_Scalar>
culite::dns::XxVector< T_Scalar >::XxVector ( const XxVector< T_Scalar > & other)
default

Copy constructor.

Creates a new device vector by copying another device vector.

Parameters
[in]otherThe device vector to copy.

◆ XxVector() [5/5]

template<typename T_Scalar>
culite::dns::XxVector< T_Scalar >::XxVector ( XxVector< T_Scalar > && other)
default

Move constructor.

Creates a new device vector by moving resources from another device vector.

Parameters
[in]otherThe device vector to move from.

◆ ~XxVector()

template<typename T_Scalar>
culite::dns::XxVector< T_Scalar >::~XxVector ( )

Destructor.

Destroys the device vector and releases allocated device memory.

Member Function Documentation

◆ operator=() [1/3]

template<typename T_Scalar>
XxVector< T_Scalar > & culite::dns::XxVector< T_Scalar >::operator= ( const XxVector< T_Scalar > & other)
default

Copy assignment operator.

Copies the contents of another device vector to this device vector.

Parameters
[in]otherThe device vector to copy.
Returns
Reference to this device vector.

◆ operator=() [2/3]

template<typename T_Scalar>
XxVector< T_Scalar > & culite::dns::XxVector< T_Scalar >::operator= ( XxVector< T_Scalar > && other)
default

Move assignment operator.

Moves resources from another device vector to this device vector.

Parameters
[in]otherThe device vector to move from.
Returns
Reference to this device vector.

◆ operator=() [3/3]

template<typename T_Scalar>
void culite::dns::XxVector< T_Scalar >::operator= ( T_Scalar val)

Fill operator.

Fills all elements with the specified value.

Parameters
[in]valThe scalar value to fill with.

◆ operator-()

template<typename T_Scalar>
alias::VirtualScal_vec< T_Scalar > culite::dns::XxVector< T_Scalar >::operator- ( ) const

Unary negation operator.

Returns a negated copy of the device vector.

Returns
A device vector containing the negated elements.

◆ iscale()

template<typename T_Scalar>
void culite::dns::XxVector< T_Scalar >::iscale ( const T_Scalar & val)

Scale the device vector in-place.

Multiplies all elements of the device vector by a scalar value.

Parameters
[in]valThe scalar value to multiply by.

◆ transpose()

template<typename T_Scalar>
VirtualRowvec< T_Scalar > culite::dns::XxVector< T_Scalar >::transpose ( ) const

Transpose the vector.

Returns a row vector view of this column vector.

Returns
A virtual row vector expression.

◆ ctranspose()

template<typename T_Scalar>
VirtualRowvec< T_Scalar > culite::dns::XxVector< T_Scalar >::ctranspose ( ) const

Conjugate transpose the vector.

Returns a conjugate transposed row vector view of this column vector.

Returns
A virtual row vector expression.

◆ conjugate()

template<typename T_Scalar>
alias::VirtualConj_vec< T_Scalar > culite::dns::XxVector< T_Scalar >::conjugate ( ) const

Compute the complex conjugate.

Returns a device vector containing the complex conjugate of each element.

Returns
A device vector with conjugated elements.

◆ iconjugate()

template<typename T_Scalar>
void culite::dns::XxVector< T_Scalar >::iconjugate ( )

Conjugate the device vector in-place.

Replaces all elements with their complex conjugates.

◆ normOne()

template<typename T_Scalar>
T_RScalar culite::dns::XxVector< T_Scalar >::normOne ( ) const

Compute the 1-norm.

Computes the sum of absolute values of all elements.

Returns
The 1-norm of the device vector.

◆ normInf()

template<typename T_Scalar>
T_RScalar culite::dns::XxVector< T_Scalar >::normInf ( ) const

Compute the infinity norm.

Computes the maximum absolute value of all elements.

Returns
The infinity norm of the device vector.

◆ normEuc()

template<typename T_Scalar>
T_RScalar culite::dns::XxVector< T_Scalar >::normEuc ( ) const

Compute the Euclidean norm (2-norm).

Computes the square root of the sum of squared absolute values.

Returns
The Euclidean norm of the device vector.

◆ block()

template<typename T_Scalar>
XxVector< T_Scalar > culite::dns::XxVector< T_Scalar >::block ( int_t ibgn,
int_t ni ) const

Extract a block as a new device vector.

Creates a new device vector containing a deep copy of a contiguous block of elements.

Parameters
[in]ibgnThe starting index of the block.
[in]niThe number of elements in the block.
Returns
A new device vector containing the block's data.

◆ rblock() [1/2]

template<typename T_Scalar>
XxVector< T_Scalar > culite::dns::XxVector< T_Scalar >::rblock ( int_t ibgn,
int_t ni )

Extract a reference block.

Creates a device vector that references a contiguous block of this vector's device memory.

Parameters
[in]ibgnThe starting index of the block.
[in]niThe number of elements in the block.
Returns
A device vector that shares device memory with this vector.

◆ rblock() [2/2]

template<typename T_Scalar>
Guard< XxVector< T_Scalar > > culite::dns::XxVector< T_Scalar >::rblock ( int_t ibgn,
int_t ni ) const

Extract a guarded reference block.

Creates a guarded device vector that references a contiguous block of this vector's device memory.

Parameters
[in]ibgnThe starting index of the block.
[in]niThe number of elements in the block.
Returns
A guarded device vector that shares device memory with this vector.

◆ setBlock()

template<typename T_Scalar>
void culite::dns::XxVector< T_Scalar >::setBlock ( int_t ibgn,
const XxVector< T_Scalar > & src )

Set a block of elements.

Copies elements from the source device vector to a contiguous block of this vector.

Parameters
[in]ibgnThe starting index where the block will be written.
[in]srcThe source device vector to copy from.