PVector< T > Class Template Reference

Detailed Description

template<typename T>
class PVector< T >

Dense numeric vector (templated) used for linear algebra; specialised versions are PIntVector, PFloatVector and PDoubleVector; NOT thread-safe.

It can be used with int32, float and double data types.

Definition at line 29 of file PVector.h.

#include <PVector.h>

Constructor & Destructor Documentation

◆ PVector() [1/2]

template<typename T>
PVector< T >::PVector ( papillon::int32  n = 0,
const T *  array = nullptr 
)
explicit

Constructs vector with N elements set to 0 if array parameter is nullptr.

◆ PVector() [2/2]

template<typename T>
PVector< T >::PVector ( const PVector< T > &  other)

Constructs a shared copy of other.

See also
Clone()

◆ ~PVector()

template<typename T>
PVector< T >::~PVector ( )
override

Destroys this object.

Member Function Documentation

◆ Clone()

template<typename T>
PVector<T> PVector< T >::Clone ( ) const

Returns a deep copy of this vector.

◆ Fill()

template<typename T>
void PVector< T >::Fill ( t)

Sets all elements to the specified value.

◆ Get()

template<typename T>
T PVector< T >::Get ( const papillon::int32  index) const

Returns the element at the specified index.

Returns an unspecified value if index is outside the valid range (0 .. Size()-1).

◆ GetDataPtr() [1/2]

template<typename T>
T* PVector< T >::GetDataPtr ( )

UNSAFE: Returns a pointer to the internal buffer of this vector.

◆ GetDataPtr() [2/2]

template<typename T>
const T* PVector< T >::GetDataPtr ( ) const

UNSAFE: Returns a pointer to the internal buffer of this vector.

◆ operator=()

template<typename T>
PVector<T>& PVector< T >::operator= ( const PVector< T > &  other)

Performs a shared copy of other to this object.

See also
Clone()

◆ Reset()

template<typename T>
void PVector< T >::Reset ( )

Changes size to empty.

◆ Resize()

template<typename T>
void PVector< T >::Resize ( papillon::int32  n)

Changes size while keeping elements.

◆ Set()

template<typename T>
void PVector< T >::Set ( const papillon::int32  index,
value 
)

Sets the element at the specified index.

Do nothing if the index is outside the valid range (0 .. Size()-1).

◆ Size()

template<typename T>
papillon::int32 PVector< T >::Size ( ) const

Returns the number of elements in this vector.