Template Numerical Library version main:1655e92
Public Types | Public Member Functions | List of all members
TNL::Containers::StaticVector< Size, Real > Class Template Reference

Vector with constant size. More...

#include <TNL/Containers/StaticVector.h>

Inheritance diagram for TNL::Containers::StaticVector< Size, Real >:
Inheritance graph
[legend]
Collaboration diagram for TNL::Containers::StaticVector< Size, Real >:
Collaboration graph
[legend]

Public Types

using IndexType = int
 Indexing type.
 
using RealType = Real
 Type of numbers stored in this vector.
 
- Public Types inherited from TNL::Containers::StaticArray< Size, double >
using IndexType = int
 Type being used for the array elements indexing.
 
using ValueType = double
 Type of elements stored in this array.
 

Public Member Functions

__cuda_callable__ StaticVector ()=default
 Default constructor.
 
template<typename T1 , typename T2 , typename Operation >
__cuda_callable__ StaticVector (const Expressions::StaticBinaryExpressionTemplate< T1, T2, Operation > &expr)
 Constructor from binary vector expression. More...
 
template<typename T , typename Operation >
__cuda_callable__ StaticVector (const Expressions::StaticUnaryExpressionTemplate< T, Operation > &expr)
 Constructor from unary expression. More...
 
__cuda_callable__ StaticVector (const StaticVector &)=default
 Default copy constructor.
 
template<typename OtherReal >
__cuda_callable__ operator StaticVector< Size, OtherReal > () const
 Cast operator for changing of the Value type. More...
 
template<typename VectorExpression >
__cuda_callable__ StaticVectoroperator%= (const VectorExpression &expression)
 Elementwise modulo by a vector expression. More...
 
template<typename VectorExpression >
__cuda_callable__ StaticVector< Size, Real > & operator%= (const VectorExpression &expression)
 
template<typename VectorExpression >
__cuda_callable__ StaticVectoroperator*= (const VectorExpression &expression)
 Elementwise multiplication by a vector expression. More...
 
template<typename VectorExpression >
__cuda_callable__ StaticVector< Size, Real > & operator*= (const VectorExpression &expression)
 
template<typename VectorExpression >
__cuda_callable__ StaticVectoroperator+= (const VectorExpression &expression)
 Addition operator with a vector expression. More...
 
template<typename VectorExpression >
__cuda_callable__ StaticVector< Size, Real > & operator+= (const VectorExpression &expression)
 
template<typename VectorExpression >
__cuda_callable__ StaticVectoroperator-= (const VectorExpression &expression)
 Subtraction operator with a vector expression. More...
 
template<typename VectorExpression >
__cuda_callable__ StaticVector< Size, Real > & operator-= (const VectorExpression &expression)
 
template<typename VectorExpression >
__cuda_callable__ StaticVectoroperator/= (const VectorExpression &expression)
 Elementwise division by a vector expression. More...
 
template<typename VectorExpression >
__cuda_callable__ StaticVector< Size, Real > & operator/= (const VectorExpression &expression)
 
__cuda_callable__ StaticVectoroperator= (const StaticVector &)=default
 Default copy-assignment operator.
 
template<typename VectorExpression >
__cuda_callable__ StaticVectoroperator= (const VectorExpression &expression)
 Assignment operator with a vector expression. More...
 
template<typename VectorExpression >
__cuda_callable__ StaticVector< Size, Real > & operator= (const VectorExpression &expression)
 
__cuda_callable__ StaticVectoroperator= (StaticVector &&) noexcept=default
 Default move-assignment operator.
 
- Public Member Functions inherited from TNL::Containers::StaticArray< Size, double >
__cuda_callable__ StaticArray ()=default
 Default constructor.
 
__cuda_callable__ StaticArray (const double &v)
 Constructor that sets all array components to value v. More...
 
__cuda_callable__ StaticArray (const double &v1, const double &v2)
 Constructor that sets components of arrays with Size = 2. More...
 
__cuda_callable__ StaticArray (const double &v1, const double &v2, const double &v3)
 Constructor that sets components of arrays with Size = 3. More...
 
__cuda_callable__ StaticArray (const double v[Size])
 Constructor from static array. More...
 
__cuda_callable__ StaticArray (const StaticArray< Size, double > &v)
 Copy constructor. More...
 
__cuda_callable__ StaticArray (const std::initializer_list< double > &elems)
 Constructor which initializes the array by copying elements from std::initializer_list, e.g. {...}. More...
 
__cuda_callable__ double * getData ()
 Gets pointer to data of this static array.
 
__cuda_callable__ const double * getData () const
 Gets constant pointer to data of this static array.
 
bool load (File &file)
 Loads data from the file to this static array. More...
 
__cuda_callable__ operator StaticArray< Size, OtherValue > () const
 Cast operator for changing of the Value type. More...
 
__cuda_callable__ bool operator!= (const Array &array) const
 This function checks whether this static array is not equal to another array. More...
 
__cuda_callable__ double & operator() (int i)
 Accesses specified element at the position i and returns a reference to its value. More...
 
__cuda_callable__ const double & operator() (int i) const
 Accesses specified element at the position i and returns a constant reference to its value. More...
 
__cuda_callable__ StaticArray< Size, double > & operator= (const StaticArray< Size, double > &array)
 Assigns another static array to this array.
 
__cuda_callable__ StaticArray< Size, double > & operator= (const T &v)
 Assigns an object v of type T. More...
 
__cuda_callable__ bool operator== (const Array &array) const
 This function checks whether this static array is equal to another array. More...
 
__cuda_callable__ double & operator[] (int i)
 Accesses specified element at the position i and returns a reference to its value. More...
 
__cuda_callable__ const double & operator[] (int i) const
 Accesses specified element at the position i and returns a constant reference to its value. More...
 
bool save (File &file) const
 Saves this static array into the file. More...
 
__cuda_callable__ void setValue (const ValueType &val)
 Sets all values of this static array to val.
 
void sort ()
 Sorts the elements in this static array in ascending order.
 
std::ostreamwrite (std::ostream &str, const char *separator=" ") const
 Writes the array values into stream str with specified separator. More...
 
__cuda_callable__ double & x ()
 Returns reference to the first coordinate.
 
__cuda_callable__ const double & x () const
 Returns constant reference to the first coordinate.
 
__cuda_callable__ double & y ()
 Returns reference to the second coordinate for arrays with Size >= 2.
 
__cuda_callable__ const double & y () const
 Returns constant reference to the second coordinate for arrays with Size >= 2.
 
__cuda_callable__ double & z ()
 Returns reference to the third coordinate for arrays with Size >= 3.
 
__cuda_callable__ const double & z () const
 Returns constant reference to the third coordinate for arrays with Size >= 3.
 

Additional Inherited Members

- Static Public Member Functions inherited from TNL::Containers::StaticArray< Size, double >
static __cuda_callable__ constexpr int getSize ()
 Gets size of this array.
 
- Protected Attributes inherited from TNL::Containers::StaticArray< Size, double >
double data [Size]
 

Detailed Description

template<int Size, typename Real = double>
class TNL::Containers::StaticVector< Size, Real >

Vector with constant size.

Parameters
SizeSize of static vector. Number of its elements.
RealType of the values in the static vector.

Constructor & Destructor Documentation

◆ StaticVector() [1/2]

template<int Size, typename Real >
template<typename T1 , typename T2 , typename Operation >
__cuda_callable__ TNL::Containers::StaticVector< Size, Real >::StaticVector ( const Expressions::StaticBinaryExpressionTemplate< T1, T2, Operation > &  expr)

Constructor from binary vector expression.

Parameters
expris binary expression.

◆ StaticVector() [2/2]

template<int Size, typename Real >
template<typename T , typename Operation >
__cuda_callable__ TNL::Containers::StaticVector< Size, Real >::StaticVector ( const Expressions::StaticUnaryExpressionTemplate< T, Operation > &  expr)

Constructor from unary expression.

Parameters
expris unary expression

Member Function Documentation

◆ operator StaticVector< Size, OtherReal >()

template<int Size, typename Real >
template<typename OtherReal >
__cuda_callable__ TNL::Containers::StaticVector< Size, Real >::operator StaticVector< Size, OtherReal >

Cast operator for changing of the Value type.

Returns static array having ValueType set to OtherValue, i.e. StaticArray< Size, OtherValue >.

Template Parameters
OtherValueis the Value type of the static array the casting will be performed to.
Returns
instance of StaticVector< Size, OtherValue >

◆ operator%=()

template<int Size, typename Real = double>
template<typename VectorExpression >
__cuda_callable__ StaticVector & TNL::Containers::StaticVector< Size, Real >::operator%= ( const VectorExpression &  expression)

Elementwise modulo by a vector expression.

The vector expression can be even just static vector.

Parameters
expressionis the vector expression
Returns
reference to this vector

◆ operator*=()

template<int Size, typename Real = double>
template<typename VectorExpression >
__cuda_callable__ StaticVector & TNL::Containers::StaticVector< Size, Real >::operator*= ( const VectorExpression &  expression)

Elementwise multiplication by a vector expression.

The vector expression can be even just static vector.

Parameters
expressionis the vector expression.
Returns
reference to this vector

◆ operator+=()

template<int Size, typename Real = double>
template<typename VectorExpression >
__cuda_callable__ StaticVector & TNL::Containers::StaticVector< Size, Real >::operator+= ( const VectorExpression &  expression)

Addition operator with a vector expression.

The vector expression can be even just static vector.

Parameters
expressionis the vector expression
Returns
reference to this vector

◆ operator-=()

template<int Size, typename Real = double>
template<typename VectorExpression >
__cuda_callable__ StaticVector & TNL::Containers::StaticVector< Size, Real >::operator-= ( const VectorExpression &  expression)

Subtraction operator with a vector expression.

The vector expression can be even just static vector.

Parameters
expressionis the vector expression
Returns
reference to this vector

◆ operator/=()

template<int Size, typename Real = double>
template<typename VectorExpression >
__cuda_callable__ StaticVector & TNL::Containers::StaticVector< Size, Real >::operator/= ( const VectorExpression &  expression)

Elementwise division by a vector expression.

The vector expression can be even just static vector.

Parameters
expressionis the vector expression
Returns
reference to this vector

◆ operator=()

template<int Size, typename Real = double>
template<typename VectorExpression >
__cuda_callable__ StaticVector & TNL::Containers::StaticVector< Size, Real >::operator= ( const VectorExpression &  expression)

Assignment operator with a vector expression.

The vector expression can be even just static vector.

Parameters
expressionis the vector expression
Returns
reference to this vector

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