CLA3P v0.3.1
Compact Linear Algebra Parallel Portable Package
Loading...
Searching...
No Matches
cla3p::dns::XxVector< T_Scalar > Class Template Reference

The floating point dense vector class. More...

Inheritance diagram for cla3p::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 (T_Scalar val)
 Scale the 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 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.
XxVector< T_Scalar > permuteLeft (const prm::PxMatrix< int_t > &P) const
 Permute the vector.
void permuteLeft (const prm::PxMatrix< int_t > &P, XxVector< T_Scalar > &dest) const
 Permute the vector into a destination.
XxVector< T_Scalar > block (int_t ibgn, int_t ni) const
 Extract a block as a new 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.

Creators/Generators

static XxVector< T_Scalar > random (int_t n, T_RScalar lo=T_RScalar(0), T_RScalar hi=T_RScalar(1))
 Create a random vector.

Additional Inherited Members

T_Scalar & operator() (int_t i)
 Element access operator.
const T_Scalar & operator() (int_t i) const
 Element access operator.
void clear ()
 Clear the vector.
void fill (T_Scalar val)
 Fill all elements with a value.
XiVector< T_Scalar > copy () const
 Create a deep copy of the vector.
XiVector< T_Scalar > rcopy ()
 Create a reference copy (shallow copy) of the vector.
Guard< XiVector< T_Scalar > > rcopy () const
 Create a guarded reference copy (shallow copy) of the vector.
XiVector< T_Scalar > move ()
 Move the vector's resources.
std::string info (const std::string &header="") const
 Get information about the vector.
void print (std::streamsize prec=0) const
 Print the vector to standard output.
void toStream (std::ostream &os, std::streamsize prec=0) const
 Output the vector to a stream.
Public Member Functions inherited from cla3p::Meta1D< int_t >
int_t size () const
 Vector size.
bool empty () const
 Tests whether the object has zero dimension.
 operator bool () const
 Boolean conversion operator.
Public Member Functions inherited from cla3p::dns::XxContainerBase< T_Scalar >
T_Scalar * values ()
 Access the data buffer.
const T_Scalar * values () const
 Access the data buffer.
Public Member Functions inherited from cla3p::Ownership
 Ownership ()
 Default constructor.
 Ownership (bool owner)
 Ownership constructor.
 ~Ownership ()
 Destructor.
bool owner () const
 Tests memory ownership.
void unbind ()
 Relinquishes memory ownership.
static Guard< XiVector< T_Scalar > > view (int_t n, const T_Scalar *vals)
 Create a view of existing memory.

Detailed Description

template<typename T_Scalar>
class cla3p::dns::XxVector< T_Scalar >

The floating point dense vector class.

Constructor & Destructor Documentation

◆ XxVector() [1/5]

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

Default constructor.

Creates an empty vector with no allocated memory.

◆ XxVector() [2/5]

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

Dimension constructor.

Creates a vector of the specified size and allocates memory.

Parameters
[in]nThe number of elements.

◆ XxVector() [3/5]

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

Auxiliary constructor.

Creates a vector using existing memory.

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

◆ XxVector() [4/5]

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

Copy constructor.

Creates a new vector by copying another vector.

Parameters
[in]otherThe vector to copy.

◆ XxVector() [5/5]

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

Move constructor.

Creates a new vector by moving resources from another vector.

Parameters
[in]otherThe vector to move from.

◆ ~XxVector()

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

Destructor.

Destroys the vector and releases allocated memory.

Member Function Documentation

◆ operator=() [1/3]

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

Copy assignment operator.

Copies the contents of another vector to this vector.

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

◆ operator=() [2/3]

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

Move assignment operator.

Moves resources from another vector to this vector.

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

◆ operator=() [3/3]

template<typename T_Scalar>
void cla3p::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 > cla3p::dns::XxVector< T_Scalar >::operator- ( ) const

Unary negation operator.

Returns a negated copy of the vector.

Returns
A virtual expression containing the negated elements.

◆ iscale()

template<typename T_Scalar>
void cla3p::dns::XxVector< T_Scalar >::iscale ( T_Scalar val)

Scale the vector in-place.

Multiplies all elements of the vector by a scalar value.

Parameters
[in]valThe scalar value to multiply by.

◆ transpose()

template<typename T_Scalar>
VirtualRowvec< T_Scalar > cla3p::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 > cla3p::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 > cla3p::dns::XxVector< T_Scalar >::conjugate ( ) const

Compute the complex conjugate.

Returns a virtual expression containing the complex conjugate of each element.

Returns
A virtual expression with conjugated elements.

◆ iconjugate()

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

Conjugate the vector in-place.

Replaces all elements with their complex conjugates.

◆ normOne()

template<typename T_Scalar>
T_RScalar cla3p::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 vector.

◆ normInf()

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

Compute the infinity norm.

Computes the maximum absolute value of all elements.

Returns
The infinity norm of the vector.

◆ normEuc()

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

Compute the Euclidean norm.

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

Returns
The Euclidean norm of the vector.

◆ permuteLeft() [1/2]

template<typename T_Scalar>
XxVector< T_Scalar > cla3p::dns::XxVector< T_Scalar >::permuteLeft ( const prm::PxMatrix< int_t > & P) const

Permute the vector.

Applies a left permutation to the vector.

Parameters
[in]PThe permutation matrix.
Returns
A new vector containing the permuted elements.

◆ permuteLeft() [2/2]

template<typename T_Scalar>
void cla3p::dns::XxVector< T_Scalar >::permuteLeft ( const prm::PxMatrix< int_t > & P,
XxVector< T_Scalar > & dest ) const

Permute the vector into a destination.

Applies a left permutation to the vector and stores the result in the destination vector.

Parameters
[in]PThe permutation matrix.
[out]destThe destination vector for the permuted elements.

◆ block()

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

Extract a block as a new vector.

Creates a new 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 vector containing the block's data.

◆ rblock() [1/2]

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

Extract a reference block.

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

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

◆ rblock() [2/2]

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

Extract a guarded reference block.

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

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

◆ setBlock()

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

Set a block of elements.

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

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

◆ random()

template<typename T_Scalar>
XxVector< T_Scalar > cla3p::dns::XxVector< T_Scalar >::random ( int_t n,
T_RScalar lo = T_RScalar(0),
T_RScalar hi = T_RScalar(1) )
static

Create a random vector.

Creates a vector with random values uniformly distributed in the specified range.

Parameters
[in]nThe number of elements.
[in]loThe lower bound of the random values (default: 0).
[in]hiThe upper bound of the random values (default: 1).
Returns
A vector containing random values.
Examples
ex01d_dense_vector_create_random.cpp.