OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
Vector< T > Class Template Reference

Vector. More...

#include <Vector.h>

Inheritance diagram for Vector< T >:
Collaboration diagram for Vector< T >:

Public Types

typedef T value_type
 The value type of this array.
typedef T * iterator
 The iterator type for the array.
typedef const T * const_iterator
 The iterator type for constant array.

Public Member Functions

 Vector ()
 Default constructor.
 Vector (int n)
 Constructor.
 Vector (int n, const T &t)
 Constructor.
 Vector (const Array1D< T > &)
 Conversion.
 Vector (const Vector< T > &)
 ~Vector ()
Vector< T > & operator= (const Vector< T > &)
Vector< T > operator- () const
 Change sign of vector.
Vector< T > & operator*= (const T &)
 Multiply by scalar and assign.
Vector< T > & operator/= (const T &)
 Divide by scalar and assign.
Vector< T > & operator+= (const Vector< T > &)
 Add vector and assign.
Vector< T > & operator-= (const Vector< T > &)
 Subtract vector and assign.
T & operator() (int n)
 Get reference to element.
const T & operator() (int n) const
 Get value of element.
T & operator[] (int)
 Get reference to element.
const T & operator[] (int) const
 Get value of element.
iterator begin ()
 Get beginning of data.
const_iterator begin () const
 Get beginning of data.
iterator end ()
 Get end of data.
const_iterator end () const
 Get end of data.
int size () const
 Get array size.
void resize (int size)
 Change array size.

Protected Attributes

int len
T * data

Detailed Description

template<class T>
class Vector< T >

Vector.

Definition at line 37 of file Vector.h.

Member Typedef Documentation

◆ const_iterator

template<class T>
typedef const T* Array1D< T >::const_iterator
inherited

The iterator type for constant array.

Definition at line 47 of file Array1D.h.

◆ iterator

template<class T>
typedef T* Array1D< T >::iterator
inherited

The iterator type for the array.

Definition at line 44 of file Array1D.h.

◆ value_type

template<class T>
typedef T Array1D< T >::value_type
inherited

The value type of this array.

Definition at line 41 of file Array1D.h.

Constructor & Destructor Documentation

◆ Vector() [1/5]

template<class T>
Vector< T >::Vector ( )

Default constructor.

Definition at line 109 of file Vector.h.

References Array1D< T >::Array1D().

Referenced by operator*=(), operator+=(), operator-(), operator-=(), operator/=(), operator=(), and Vector().

Here is the call graph for this function:

◆ Vector() [2/5]

template<class T>
Vector< T >::Vector ( int n)
explicit

Constructor.

Definition at line 115 of file Vector.h.

References Array1D< T >::Array1D().

Here is the call graph for this function:

◆ Vector() [3/5]

template<class T>
Vector< T >::Vector ( int n,
const T & t )

Constructor.

Definition at line 121 of file Vector.h.

References Array1D< T >::Array1D().

Here is the call graph for this function:

◆ Vector() [4/5]

template<class T>
Vector< T >::Vector ( const Array1D< T > & array)

Conversion.

Definition at line 133 of file Vector.h.

References Array1D< T >::Array1D().

Here is the call graph for this function:

◆ Vector() [5/5]

template<class T>
Vector< T >::Vector ( const Vector< T > & array)

Definition at line 127 of file Vector.h.

References Array1D< T >::Array1D(), and Vector().

Here is the call graph for this function:

◆ ~Vector()

template<class T>
Vector< T >::~Vector ( )

Definition at line 139 of file Vector.h.

Member Function Documentation

◆ begin() [1/2]

◆ begin() [2/2]

template<class T>
Array1D< T >::const_iterator Array1D< T >::begin ( ) const
inherited

Get beginning of data.

Definition at line 216 of file Array1D.h.

References data.

◆ end() [1/2]

template<class T>
Array1D< T >::iterator Array1D< T >::end ( )
inherited

◆ end() [2/2]

template<class T>
Array1D< T >::const_iterator Array1D< T >::end ( ) const
inherited

Get end of data.

Definition at line 222 of file Array1D.h.

References data, and len.

◆ operator()() [1/2]

template<class T>
T & Array1D< T >::operator() ( int n)
inherited

Get reference to element.

Definition at line 186 of file Array1D.h.

References data, and size().

Here is the call graph for this function:

◆ operator()() [2/2]

template<class T>
const T & Array1D< T >::operator() ( int n) const
inherited

Get value of element.

Definition at line 195 of file Array1D.h.

References data, and size().

Here is the call graph for this function:

◆ operator*=()

template<class T>
Vector< T > & Vector< T >::operator*= ( const T & val)

Multiply by scalar and assign.

Definition at line 159 of file Vector.h.

References begin(), end(), and Vector().

Here is the call graph for this function:

◆ operator+=()

template<class T>
Vector< T > & Vector< T >::operator+= ( const Vector< T > & array)

Add vector and assign.

Definition at line 175 of file Vector.h.

References Array1D< T >::begin(), begin(), end(), and Vector().

Here is the call graph for this function:

◆ operator-()

template<class T>
Vector< T > Vector< T >::operator- ( ) const

Change sign of vector.

Definition at line 151 of file Vector.h.

References Array1D< T >::begin(), begin(), end(), Array1D< T >::size(), and Vector().

Here is the call graph for this function:

◆ operator-=()

template<class T>
Vector< T > & Vector< T >::operator-= ( const Vector< T > & array)

Subtract vector and assign.

Definition at line 183 of file Vector.h.

References Array1D< T >::begin(), begin(), end(), and Vector().

Here is the call graph for this function:

◆ operator/=()

template<class T>
Vector< T > & Vector< T >::operator/= ( const T & val)

Divide by scalar and assign.

Definition at line 167 of file Vector.h.

References begin(), end(), and Vector().

Here is the call graph for this function:

◆ operator=()

template<class T>
Vector< T > & Vector< T >::operator= ( const Vector< T > & right)

Definition at line 144 of file Vector.h.

References Array1D< T >::operator=(), and Vector().

Here is the call graph for this function:

◆ operator[]() [1/2]

template<class T>
T & Array1D< T >::operator[] ( int i)
inlineinherited

Get reference to element.

Definition at line 174 of file Array1D.h.

References data.

◆ operator[]() [2/2]

template<class T>
const T & Array1D< T >::operator[] ( int i) const
inlineinherited

Get value of element.

Definition at line 180 of file Array1D.h.

References data.

◆ resize()

template<class T>
void Array1D< T >::resize ( int size)
inherited

Change array size.

Definition at line 234 of file Array1D.h.

References begin(), data, and len.

Here is the call graph for this function:

◆ size()

Member Data Documentation

◆ data

template<class T>
T* Array1D< T >::data
protectedinherited

◆ len

template<class T>
int Array1D< T >::len
protectedinherited

Definition at line 116 of file Array1D.h.

Referenced by Array1D(), Array1D(), Array1D(), Array1D(), end(), end(), operator=(), resize(), and size().


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