FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
FEAT::Tiny::Vector< T_, n_, s_ > Class Template Reference

Tiny Vector class template. More...

#include <tiny_algebra.hpp>

Public Types

typedef Intern::DataTypeExtractor< ValueType >::MyDataType DataType
 The basic data type buried in the lowest level of the vector. More...
 
typedef T_ ValueType
 the value type of the vector More...
 

Public Member Functions

CUDA_HOST_DEVICE Vector ()
 default constructor More...
 
template<typename Tx_ >
CUDA_HOST_DEVICE Vector (const std::initializer_list< Tx_ > &x)
 Initializer list constructor. More...
 
template<int sx_>
CUDA_HOST_DEVICE Vector (const Vector< T_, n_, sx_ > &x)
 copy constructor More...
 
CUDA_HOST_DEVICE Vector (DataType value)
 value-assignment constructor More...
 
template<int m_, int sma_, int sna_, int sx_>
CUDA_HOST_DEVICE Vectoradd_mat_vec_mult (const Matrix< T_, n_, m_, sma_, sna_ > &a, const Vector< T_, m_, sx_ > &x, DataType alpha=DataType(1))
 Adds the result of a matrix-vector product onto this vector. More...
 
template<int mm_, int nn_, int ma_, int na_, int sna_, int sma_, int nx_, int sx_>
CUDA_HOST_DEVICE Vectoradd_mat_vec_mult_n (const Matrix< T_, ma_, na_, sma_, sna_ > &a, const Vector< T_, nx_, sx_ > &x, DataType alpha=DataType(1))
 Adds the result of a matrix-vector product onto this vector. More...
 
template<int m_, int sma_, int sna_, int sx_>
CUDA_HOST_DEVICE Vectoradd_vec_mat_mult (const Vector< T_, m_, sx_ > &x, const Matrix< T_, m_, n_, sma_, sna_ > &a, DataType alpha=DataType(1))
 Adds the result of a vector-matrix product onto this vector. More...
 
template<int nn_, int mm_, int mx_, int smx_, int ma_, int na_, int sma_, int sna_>
CUDA_HOST_DEVICE Vectoradd_vec_mat_mult_n (const Vector< T_, mx_, smx_ > &x, const Matrix< T_, ma_, na_, sma_, sna_ > &a, DataType alpha=DataType(1))
 Adds the result of a vector-matrix product onto this vector. More...
 
template<int snx_>
CUDA_HOST_DEVICE Vectoraxpy (DataType alpha, const Vector< T_, n_, snx_ > &x)
 Adds another scaled vector onto this vector. More...
 
template<int nn_, int nx_, int snx_>
CUDA_HOST_DEVICE Vectoraxpy_n (DataType alpha, const Vector< T_, nx_, snx_ > &x)
 Adds the first nn_ entries of another scaled vector onto this vector. More...
 
template<typename Tx_ , int sx_>
CUDA_HOST_DEVICE void convert (const Vector< Tx_, n_, sx_ > &x)
 conversion operator More...
 
template<int snx_>
CUDA_HOST_DEVICE void copy (const Vector< T_, n_, snx_ > &x)
 Copies a vector. More...
 
template<int nn_, int nx_, int snx_>
CUDA_HOST_DEVICE void copy_n (const Vector< T_, nx_, snx_ > &x)
 Copies the first nn_ entries of a vector. More...
 
CUDA_HOST_DEVICE void format (DataType alpha=DataType(0))
 Formats the vector. More...
 
template<int nn_>
CUDA_HOST_DEVICE void format_n (DataType alpha=DataType(0))
 Formats the first nn_ entries of the vector. More...
 
CUDA_HOST_DEVICE Vectornegate ()
 Negates the vector, i.e. effectively multiplies all components by -1. More...
 
template<int nn_>
CUDA_HOST_DEVICE Vectornegate_n ()
 Negates the first nn_ entries of this vector. More...
 
CUDA_HOST_DEVICE DataType norm_euclid () const
 Computes the euclid norm of this vector. More...
 
template<int nn_>
CUDA_HOST_DEVICE DataType norm_euclid_n () const
 Computes the euclid norm of first nn_ entries of this vector. More...
 
CUDA_HOST_DEVICE DataType norm_euclid_sqr () const
 Computes the squared euclid norm of this vector. More...
 
template<int nn_>
CUDA_HOST_DEVICE DataType norm_euclid_sqr_n () const
 Computes the squared euclid norm of first nn_ entries of this vector. More...
 
CUDA_HOST_DEVICE DataType norm_l1 () const
 Computes the l1-norm of this vector. More...
 
template<int nn_>
CUDA_HOST_DEVICE DataType norm_l1_n () const
 Computes the l1-norm of the first nn_ entries of this vector. More...
 
CUDA_HOST_DEVICE DataType norm_max () const
 Computes the max-norm of this vector. More...
 
template<int nn_>
CUDA_HOST_DEVICE DataType norm_max_n () const
 Computes the max-norm of the vector. More...
 
CUDA_HOST_DEVICE Vectornormalize ()
 Normalizes this vector. More...
 
template<int nn_>
CUDA_HOST_DEVICE Vectornormalize_n ()
 Normalizes the first nn_ entries of this vector. More...
 
CUDA_HOST_DEVICE bool normalized () const
 Return if the vector is normalized. More...
 
CUDA_HOST_DEVICE T_ & operator() (int i)
 Access operator. More...
 
CUDA_HOST_DEVICE const T_ & operator() (int i) const
 Access operator. More...
 
template<int sx_>
CUDA_HOST_DEVICE Vectoroperator*= (const Vector< T_, n_, sx_ > &x)
 element-wise-multiply operator More...
 
CUDA_HOST_DEVICE Vectoroperator*= (DataType alpha)
 scalar-multiply operator More...
 
template<int sx_>
CUDA_HOST_DEVICE Vectoroperator+= (const Vector< T_, n_, sx_ > &x)
 vector-add operator More...
 
template<int sx_>
CUDA_HOST_DEVICE Vectoroperator-= (const Vector< T_, n_, sx_ > &x)
 vector-subtract operator More...
 
template<typename Tx_ >
CUDA_HOST_DEVICE Vectoroperator= (const std::initializer_list< Tx_ > &x)
 Initializer list assignment operator. More...
 
template<int sx_>
CUDA_HOST_DEVICE Vectoroperator= (const Vector< T_, n_, sx_ > &x)
 copy-assignment operator More...
 
CUDA_HOST_DEVICE Vectoroperator= (DataType value)
 value-assignment operator More...
 
CUDA_HOST_DEVICE T_ & operator[] (int i)
 Access operator. More...
 
CUDA_HOST_DEVICE const T_ & operator[] (int i) const
 Access operator. More...
 
CUDA_HOST_DEVICE void scale (DataType alpha)
 Scales the vector. More...
 
template<int nn_>
CUDA_HOST_DEVICE void scale_n (DataType alpha)
 Scales the first nn_ entries of the vector. More...
 
template<int sna_, int snb_>
CUDA_HOST_DEVICE Vectorset_convex (DataType alpha, const Vector< T_, n_, sna_ > &a, const Vector< T_, n_, snb_ > &b)
 Sets this vector to the convex combination of two other vectors. More...
 
template<int nn_, int na_, int nb_, int sna_, int snb_>
CUDA_HOST_DEVICE Vectorset_convex_n (DataType alpha, const Vector< T_, na_, sna_ > &a, const Vector< T_, nb_, snb_ > &b)
 Sets the first nn_ entries of this vector to the convex combination of two other vectors. More...
 
template<int m_, int sma_, int sna_, int sx_>
CUDA_HOST_DEVICE Vectorset_mat_vec_mult (const Matrix< T_, n_, m_, sma_, sna_ > &a, const Vector< T_, m_, sx_ > &x)
 Sets this vector to the result of a matrix-vector product. More...
 
template<int mm_, int nn_, int ma_, int na_, int sna_, int sma_, int nx_, int sx_>
CUDA_HOST_DEVICE Vectorset_mat_vec_mult_n (const Matrix< T_, ma_, na_, sma_, sna_ > &a, const Vector< T_, nx_, sx_ > &x)
 Sets the first nn_ entries of this vector to the result of a matrix-vector product with the first mm_ entries of another vector. More...
 
template<int m_, int sma_, int sna_, int sx_>
CUDA_HOST_DEVICE Vectorset_vec_mat_mult (const Vector< T_, m_, sx_ > &x, const Matrix< T_, m_, n_, sma_, sna_ > &a)
 Sets this vector to the result of a vector-matrix product. More...
 
template<int nn_, int mm_, int mx_, int smx_, int ma_, int na_, int sma_, int sna_>
CUDA_HOST_DEVICE Vectorset_vec_mat_mult_n (const Vector< T_, mx_, smx_ > &x, const Matrix< T_, ma_, na_, sma_, sna_ > &a)
 Sets the first mm_ entries of this vector to the result of a vector-matrix product with the first mm_ entries of another vector. More...
 

Static Public Member Functions

template<typename Tx_ , int sx_>
static CUDA_HOST_DEVICE Vector convert_new (const Vector< Tx_, n_, sx_ > &x)
 convert function, not callable with non convertable inner type More...
 
static CUDA_HOST_DEVICE Vector convert_new (Vector &&x)
 overload for moveable rvalue type More...
 
static CUDA_HOST_DEVICE Vector null ()
 Returns a null-vector. More...
 

Public Attributes

T_ v [s_]
 actual vector data More...
 

Static Public Attributes

static constexpr int n = n_
 the length of the vector More...
 
static constexpr int s = s_
 the stride of the vector More...
 

Friends

CUDA_HOST friend std::ostream & operator<< (std::ostream &lhs, const Vector &b)
 Tiny::Vector streaming operator. More...
 

Detailed Description

template<typename T_, int n_, int s_ = n_>
class FEAT::Tiny::Vector< T_, n_, s_ >

Tiny Vector class template.

This class template implements a vector whose value type and size is given at compile-time. The value type can be a primitive type, or some other object like (again) a Vector.

Template Parameters
T_The value-type that the vector shall contain.
n_The length of the vector. Must be > 0.
s_The stride of the vector. Must be >= n_.
Author
Peter Zajac

Definition at line 52 of file tiny_algebra.hpp.

Member Typedef Documentation

◆ DataType

template<typename T_ , int n_, int s_ = n_>
typedef Intern::DataTypeExtractor<ValueType>::MyDataType FEAT::Tiny::Vector< T_, n_, s_ >::DataType

The basic data type buried in the lowest level of the vector.

Definition at line 222 of file tiny_algebra.hpp.

◆ ValueType

template<typename T_ , int n_, int s_ = n_>
typedef T_ FEAT::Tiny::Vector< T_, n_, s_ >::ValueType

the value type of the vector

Definition at line 220 of file tiny_algebra.hpp.

Constructor & Destructor Documentation

◆ Vector() [1/4]

template<typename T_ , int n_, int s_ = n_>
CUDA_HOST_DEVICE FEAT::Tiny::Vector< T_, n_, s_ >::Vector ( )
inline

default constructor

Definition at line 228 of file tiny_algebra.hpp.

Referenced by FEAT::Tiny::Vector< T_, n_, s_ >::null().

◆ Vector() [2/4]

template<typename T_ , int n_, int s_ = n_>
CUDA_HOST_DEVICE FEAT::Tiny::Vector< T_, n_, s_ >::Vector ( DataType  value)
inlineexplicit

value-assignment constructor

Definition at line 233 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v, and FEAT::value.

◆ Vector() [3/4]

template<typename T_ , int n_, int s_ = n_>
template<int sx_>
CUDA_HOST_DEVICE FEAT::Tiny::Vector< T_, n_, s_ >::Vector ( const Vector< T_, n_, sx_ > &  x)
inline

copy constructor

Definition at line 243 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ Vector() [4/4]

template<typename T_ , int n_, int s_ = n_>
template<typename Tx_ >
CUDA_HOST_DEVICE FEAT::Tiny::Vector< T_, n_, s_ >::Vector ( const std::initializer_list< Tx_ > &  x)
inlineexplicit

Initializer list constructor.

This operator allows to assign values to a new vector in a simple manner:

Tiny::Vector<double, 3> v1{0.1, 2.1, 7.3};
Tiny::Vector<double, 3> v2 = {0.1, 2.1, 7.3};
Tiny Vector class template.
Parameters
[in]xThe initializer list whose elements are to be assigned.

Definition at line 285 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v, and XASSERTM.

Member Function Documentation

◆ add_mat_vec_mult()

template<typename T_ , int n_, int s_ = n_>
template<int m_, int sma_, int sna_, int sx_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::add_mat_vec_mult ( const Matrix< T_, n_, m_, sma_, sna_ > &  a,
const Vector< T_, m_, sx_ > &  x,
DataType  alpha = DataType(1) 
)
inline

Adds the result of a matrix-vector product onto this vector.

Let y denote this vector, and let A denote the input matrix and x in the input vector, then this function computes:

\[ y \leftarrow y + \alpha\cdot A\cdot x \]

Parameters
[in]aThe matrix for the product.
[in]xThe (right) multiplicand vector for the product.
[in]alphaThe scaling parameter for the product.
Returns
*this

Definition at line 861 of file tiny_algebra.hpp.

References ASSERTM, FEAT::Tiny::Vector< T_, n_, s_ >::v, and FEAT::Tiny::Matrix< T_, m_, n_, sm_, sn_ >::v.

◆ add_mat_vec_mult_n()

template<typename T_ , int n_, int s_ = n_>
template<int mm_, int nn_, int ma_, int na_, int sna_, int sma_, int nx_, int sx_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::add_mat_vec_mult_n ( const Matrix< T_, ma_, na_, sma_, sna_ > &  a,
const Vector< T_, nx_, sx_ > &  x,
DataType  alpha = DataType(1) 
)
inline

Adds the result of a matrix-vector product onto this vector.

Let y denote this vector, and let A denote the input matrix and x in the input vector, then this function computes:

\[ y \leftarrow y + \alpha\cdot A\cdot x \]

Template Parameters
mm_The number of matrix rows to multiply; must be mm_ <= min(n_, ma_)
nn_The number of matrix columns to multiply; must be nn_ <= min(nx_, na_)
Parameters
[in]aThe matrix for the product.
[in]xThe (right) multiplicand vector for the product.
[in]alphaThe scaling parameter for the product.
Returns
*this

Definition at line 901 of file tiny_algebra.hpp.

References ASSERTM, FEAT::Tiny::Vector< T_, n_, s_ >::v, and FEAT::Tiny::Matrix< T_, m_, n_, sm_, sn_ >::v.

◆ add_vec_mat_mult()

template<typename T_ , int n_, int s_ = n_>
template<int m_, int sma_, int sna_, int sx_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::add_vec_mat_mult ( const Vector< T_, m_, sx_ > &  x,
const Matrix< T_, m_, n_, sma_, sna_ > &  a,
DataType  alpha = DataType(1) 
)
inline

Adds the result of a vector-matrix product onto this vector.

Let y denote this vector, and let x in the input vector and A denote the input matrix, then this function computes:

\[ y^\top \leftarrow y^\top + \alpha\cdot x^\top \cdot A \Longleftrightarrow y \leftarrow y + \alpha\cdot A^\top\cdot x \]

Parameters
[in]xThe (left) multiplicand vector for the product.
[in]aThe matrix for the product.
[in]alphaThe scaling parameter for the product.
Returns
*this

Definition at line 940 of file tiny_algebra.hpp.

References ASSERTM, FEAT::Tiny::Vector< T_, n_, s_ >::v, and FEAT::Tiny::Matrix< T_, m_, n_, sm_, sn_ >::v.

◆ add_vec_mat_mult_n()

template<typename T_ , int n_, int s_ = n_>
template<int nn_, int mm_, int mx_, int smx_, int ma_, int na_, int sma_, int sna_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::add_vec_mat_mult_n ( const Vector< T_, mx_, smx_ > &  x,
const Matrix< T_, ma_, na_, sma_, sna_ > &  a,
DataType  alpha = DataType(1) 
)
inline

Adds the result of a vector-matrix product onto this vector.

Let y denote this vector, and let x in the input vector and A denote the input matrix, then this function computes:

\[ y^\top \leftarrow y^\top + \alpha\cdot x^\top \cdot A \Longleftrightarrow y \leftarrow y + \alpha\cdot A^\top\cdot x \]

Template Parameters
nn_The number of matrix columns to multiply; must be nn_ <= min(nx_, na_)
mm_The number of matrix rows to multiply; must be mm_ <= min(n_, ma_)
Parameters
[in]xThe (left) multiplicand vector for the product.
[in]aThe matrix for the product.
[in]alphaThe scaling parameter for the product.
Returns
*this

Definition at line 980 of file tiny_algebra.hpp.

References ASSERTM, FEAT::Tiny::Vector< T_, n_, s_ >::v, and FEAT::Tiny::Matrix< T_, m_, n_, sm_, sn_ >::v.

◆ axpy()

◆ axpy_n()

template<typename T_ , int n_, int s_ = n_>
template<int nn_, int nx_, int snx_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::axpy_n ( DataType  alpha,
const Vector< T_, nx_, snx_ > &  x 
)
inline

Adds the first nn_ entries of another scaled vector onto this vector.

Template Parameters
nn_The number of elements to axpy; must be nn_ <= min(n_, nx_)
Parameters
[in]xThe vector to be added onto this vector.
[in]alphaThe scaling parameter for the axpy.
Returns
*this

Definition at line 631 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ convert()

template<typename T_ , int n_, int s_ = n_>
template<typename Tx_ , int sx_>
CUDA_HOST_DEVICE void FEAT::Tiny::Vector< T_, n_, s_ >::convert ( const Vector< Tx_, n_, sx_ > &  x)
inline

◆ convert_new() [1/2]

template<typename T_ , int n_, int s_ = n_>
template<typename Tx_ , int sx_>
static CUDA_HOST_DEVICE Vector FEAT::Tiny::Vector< T_, n_, s_ >::convert_new ( const Vector< Tx_, n_, sx_ > &  x)
inlinestatic

convert function, not callable with non convertable inner type

Definition at line 253 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ convert_new() [2/2]

template<typename T_ , int n_, int s_ = n_>
static CUDA_HOST_DEVICE Vector FEAT::Tiny::Vector< T_, n_, s_ >::convert_new ( Vector< T_, n_, s_ > &&  x)
inlinestatic

overload for moveable rvalue type

Definition at line 267 of file tiny_algebra.hpp.

◆ copy()

template<typename T_ , int n_, int s_ = n_>
template<int snx_>
CUDA_HOST_DEVICE void FEAT::Tiny::Vector< T_, n_, s_ >::copy ( const Vector< T_, n_, snx_ > &  x)
inline

Copies a vector.

Parameters
[in]xThe source vector to copy

Definition at line 388 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ copy_n()

template<typename T_ , int n_, int s_ = n_>
template<int nn_, int nx_, int snx_>
CUDA_HOST_DEVICE void FEAT::Tiny::Vector< T_, n_, s_ >::copy_n ( const Vector< T_, nx_, snx_ > &  x)
inline

Copies the first nn_ entries of a vector.

Template Parameters
nn_The number of elements to copy; must be nn_ <= min(n_, nx_)
Parameters
[in]xThe source vector to copy the elements from

Definition at line 406 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ format()

template<typename T_ , int n_, int s_ = n_>
CUDA_HOST_DEVICE void FEAT::Tiny::Vector< T_, n_, s_ >::format ( DataType  alpha = DataType(0))
inline

Formats the vector.

Parameters
[in]alphaThe value that the vector is to be set to.

Definition at line 465 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v.

Referenced by FEAT::Analytic::Distance::DistanceFunction< dim_, DataType_ >::DistanceFunction(), FEAT::Analytic::Common::HarmonicShellFunction< dim_, DataType_ >::HarmonicShellFunction(), FEAT::Analytic::Distance::InverseDistanceFunction< dim_, DataType_ >::InverseDistanceFunction(), FEAT::Assembly::GradOperatorAssembler::assemble(), FEAT::Assembly::GridTransfer::assemble_intermesh_transfer(), FEAT::Assembly::BurgersAssembler< DataType_, IndexType_, dim_ >::assemble_matrix(), FEAT::Assembly::BurgersAssemblerCarreau< DataType_, IndexType_, dim_ >::assemble_matrix(), FEAT::Assembly::OldroydAssembler::assemble_matrix(), FEAT::Assembly::GridTransfer::assemble_prolongation(), FEAT::Assembly::BurgersAssembler< DataType_, IndexType_, dim_ >::assemble_scalar_matrix(), FEAT::Assembly::SpaceTransfer::assemble_transfer(), FEAT::Assembly::GridTransfer::assemble_truncation(), FEAT::Assembly::BurgersAssembler< DataType_, IndexType_, dim_ >::assemble_vector(), FEAT::Assembly::BurgersAssemblerCarreau< DataType_, IndexType_, dim_ >::assemble_vector(), FEAT::Assembly::VelocityAnalyser::compute(), FEAT::Meshopt::ChartDistanceFunction< ElementalFunction_, Trafo_, RefCellTrafo_ >::compute_dist_add(), FEAT::Meshopt::ChartDistanceFunction< ElementalFunction_, Trafo_, RefCellTrafo_ >::compute_dist_max(), FEAT::Meshopt::ChartDistanceFunction< ElementalFunction_, Trafo_, RefCellTrafo_ >::compute_dist_min(), FEAT::Assembly::BurgersBlockedVectorAssemblyJob< Vector_, Space_, ConvVector_ >::Task::compute_local_vector(), FEAT::Assembly::BurgersScalarVectorAssemblyJob< Vector_, Space_, ConvVector_ >::Task::compute_local_vector(), FEAT::Assembly::BurgersCarreauBlockedVectorAssemblyJob< Vector_, Space_, ConvVector_ >::Task::compute_local_vector(), FEAT::Assembly::BurgersCarreauScalarVectorAssemblyJob< Vector_, Space_, ConvVector_ >::Task::compute_local_vector(), FEAT::Assembly::DiscreteEvaluator::eval_fe_gradient(), FEAT::Tiny::Matrix< T_, m_, n_, sm_, sn_ >::format(), FEAT::Assembly::VectorDiscreteEvalData< DT_, dim_ >::mean_value(), FEAT::Assembly::VectorDiscreteEvalData< DT_, dim_ >::mean_value_dist(), FEAT::Assembly::BurgersAssemblyTaskBase< Job_, DataType_ >::prepare(), FEAT::Assembly::BurgersCarreauAssemblyTaskBase< Job_, DataType_ >::prepare(), FEAT::Assembly::BurgersAssemblyTaskBase< Job_, DataType_ >::prepare_point(), FEAT::Assembly::BurgersCarreauAssemblyTaskBase< Job_, DataType_ >::prepare_point(), FEAT::Assembly::GridTransfer::prolongate_vector(), and FEAT::Assembly::SpaceTransfer::transfer_vector().

◆ format_n()

template<typename T_ , int n_, int s_ = n_>
template<int nn_>
CUDA_HOST_DEVICE void FEAT::Tiny::Vector< T_, n_, s_ >::format_n ( DataType  alpha = DataType(0))
inline

Formats the first nn_ entries of the vector.

Template Parameters
nn_The number of elements to format; must be nn_ <= n_
Parameters
[in]alphaThe value that the vector is to be set to.

Definition at line 483 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ negate()

template<typename T_ , int n_, int s_ = n_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::negate ( )
inline

Negates the vector, i.e. effectively multiplies all components by -1.

Returns
*this

Definition at line 573 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ negate_n()

template<typename T_ , int n_, int s_ = n_>
template<int nn_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::negate_n ( )
inline

Negates the first nn_ entries of this vector.

Template Parameters
nn_The number of elements to negate; must be nn_ <= n_
Returns
*this

Definition at line 589 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ norm_euclid()

◆ norm_euclid_n()

template<typename T_ , int n_, int s_ = n_>
template<int nn_>
CUDA_HOST_DEVICE DataType FEAT::Tiny::Vector< T_, n_, s_ >::norm_euclid_n ( ) const
inline

Computes the euclid norm of first nn_ entries of this vector.

Returns
The euclid norm of the vector.

Definition at line 1064 of file tiny_algebra.hpp.

References FEAT::Math::sqrt().

◆ norm_euclid_sqr()

◆ norm_euclid_sqr_n()

template<typename T_ , int n_, int s_ = n_>
template<int nn_>
CUDA_HOST_DEVICE DataType FEAT::Tiny::Vector< T_, n_, s_ >::norm_euclid_sqr_n ( ) const
inline

Computes the squared euclid norm of first nn_ entries of this vector.

Returns
The squared euclid norm of the vector.

Definition at line 1027 of file tiny_algebra.hpp.

References FEAT::Math::sqr(), and FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ norm_l1()

template<typename T_ , int n_, int s_ = n_>
CUDA_HOST_DEVICE DataType FEAT::Tiny::Vector< T_, n_, s_ >::norm_l1 ( ) const
inline

Computes the l1-norm of this vector.

Returns
The l1-norm of this vector

Definition at line 1080 of file tiny_algebra.hpp.

References FEAT::Math::abs(), and FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ norm_l1_n()

template<typename T_ , int n_, int s_ = n_>
template<int nn_>
CUDA_HOST_DEVICE DataType FEAT::Tiny::Vector< T_, n_, s_ >::norm_l1_n ( ) const
inline

Computes the l1-norm of the first nn_ entries of this vector.

Returns
The l1-norm of the vector

Definition at line 1101 of file tiny_algebra.hpp.

References FEAT::Math::abs(), and FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ norm_max()

template<typename T_ , int n_, int s_ = n_>
CUDA_HOST_DEVICE DataType FEAT::Tiny::Vector< T_, n_, s_ >::norm_max ( ) const
inline

Computes the max-norm of this vector.

Returns
The max-norm of this vector

Definition at line 1122 of file tiny_algebra.hpp.

References FEAT::Math::abs(), FEAT::Math::max(), and FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ norm_max_n()

template<typename T_ , int n_, int s_ = n_>
template<int nn_>
CUDA_HOST_DEVICE DataType FEAT::Tiny::Vector< T_, n_, s_ >::norm_max_n ( ) const
inline

Computes the max-norm of the vector.

Returns
The max-norm of the vector.

Definition at line 1143 of file tiny_algebra.hpp.

References FEAT::Math::abs(), FEAT::Math::max(), and FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ normalize()

template<typename T_ , int n_, int s_ = n_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::normalize ( )
inline

◆ normalize_n()

template<typename T_ , int n_, int s_ = n_>
template<int nn_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::normalize_n ( )
inline

Normalizes the first nn_ entries of this vector.

Template Parameters
nn_The number of elements to normalize; must be nn_ <= n_
Returns
*this

Definition at line 552 of file tiny_algebra.hpp.

References ASSERTM.

◆ normalized()

template<typename T_ , int n_, int s_ = n_>
CUDA_HOST_DEVICE bool FEAT::Tiny::Vector< T_, n_, s_ >::normalized ( ) const
inline

Return if the vector is normalized.

Definition at line 1169 of file tiny_algebra.hpp.

References FEAT::Math::abs(), FEAT::Tiny::Vector< T_, n_, s_ >::norm_euclid(), and FEAT::Math::pow().

◆ null()

template<typename T_ , int n_, int s_ = n_>
static CUDA_HOST_DEVICE Vector FEAT::Tiny::Vector< T_, n_, s_ >::null ( )
inlinestatic

Returns a null-vector.

Definition at line 1161 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::Vector().

◆ operator()() [1/2]

template<typename T_ , int n_, int s_ = n_>
CUDA_HOST_DEVICE T_ & FEAT::Tiny::Vector< T_, n_, s_ >::operator() ( int  i)
inline

Access operator.

Parameters
[in]iThe index of the vector component to be returned.
Returns
A (const) reference to the i-th entry of the vector.

Definition at line 354 of file tiny_algebra.hpp.

References ASSERTM, and FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ operator()() [2/2]

template<typename T_ , int n_, int s_ = n_>
CUDA_HOST_DEVICE const T_ & FEAT::Tiny::Vector< T_, n_, s_ >::operator() ( int  i) const
inline

Access operator.

Parameters
[in]iThe index of the vector component to be returned.
Returns
A (const) reference to the i-th entry of the vector.

Definition at line 361 of file tiny_algebra.hpp.

References ASSERTM, and FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ operator*=() [1/2]

template<typename T_ , int n_, int s_ = n_>
template<int sx_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::operator*= ( const Vector< T_, n_, sx_ > &  x)
inline

element-wise-multiply operator

Definition at line 428 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ operator*=() [2/2]

template<typename T_ , int n_, int s_ = n_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::operator*= ( DataType  alpha)
inline

scalar-multiply operator

Definition at line 417 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ operator+=()

template<typename T_ , int n_, int s_ = n_>
template<int sx_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::operator+= ( const Vector< T_, n_, sx_ > &  x)
inline

vector-add operator

Definition at line 439 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ operator-=()

template<typename T_ , int n_, int s_ = n_>
template<int sx_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::operator-= ( const Vector< T_, n_, sx_ > &  x)
inline

vector-subtract operator

Definition at line 450 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ operator=() [1/3]

template<typename T_ , int n_, int s_ = n_>
template<typename Tx_ >
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::operator= ( const std::initializer_list< Tx_ > &  x)
inline

Initializer list assignment operator.

This operator allows to assign values to the vector in a simple manner:

v = {0.1, 2.1, 7.3};
T_ v[s_]
actual vector data
Parameters
[in]xThe initializer list whose elements are to be assigned.
Returns
*this

Definition at line 329 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v, and XASSERTM.

◆ operator=() [2/3]

template<typename T_ , int n_, int s_ = n_>
template<int sx_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::operator= ( const Vector< T_, n_, sx_ > &  x)
inline

copy-assignment operator

Definition at line 305 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ operator=() [3/3]

template<typename T_ , int n_, int s_ = n_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::operator= ( DataType  value)
inline

value-assignment operator

Definition at line 294 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v, and FEAT::value.

◆ operator[]() [1/2]

template<typename T_ , int n_, int s_ = n_>
CUDA_HOST_DEVICE T_ & FEAT::Tiny::Vector< T_, n_, s_ >::operator[] ( int  i)
inline

Access operator.

Parameters
[in]iThe index of the vector component to be returned.
Returns
A (const) reference to the i-th entry of the vector.

Definition at line 368 of file tiny_algebra.hpp.

References ASSERTM, and FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ operator[]() [2/2]

template<typename T_ , int n_, int s_ = n_>
CUDA_HOST_DEVICE const T_ & FEAT::Tiny::Vector< T_, n_, s_ >::operator[] ( int  i) const
inline

Access operator.

Parameters
[in]iThe index of the vector component to be returned.
Returns
A (const) reference to the i-th entry of the vector.

Definition at line 375 of file tiny_algebra.hpp.

References ASSERTM, and FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ scale()

template<typename T_ , int n_, int s_ = n_>
CUDA_HOST_DEVICE void FEAT::Tiny::Vector< T_, n_, s_ >::scale ( DataType  alpha)
inline

Scales the vector.

Parameters
[in]alphaThe value that the vector is to be scaled by

Definition at line 498 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ scale_n()

template<typename T_ , int n_, int s_ = n_>
template<int nn_>
CUDA_HOST_DEVICE void FEAT::Tiny::Vector< T_, n_, s_ >::scale_n ( DataType  alpha)
inline

Scales the first nn_ entries of the vector.

Template Parameters
nn_The number of elements to scale; must be nn_ <= n_
Parameters
[in]alphaThe value that the vector is to be scaled by

Definition at line 516 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ set_convex()

template<typename T_ , int n_, int s_ = n_>
template<int sna_, int snb_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::set_convex ( DataType  alpha,
const Vector< T_, n_, sna_ > &  a,
const Vector< T_, n_, snb_ > &  b 
)
inline

Sets this vector to the convex combination of two other vectors.

Let y denote this vector, then this function computes:

\[ y \leftarrow (1-\alpha)\cdot a + \alpha\cdot b \]

Parameters
[in]alphaThe interpolation parameter for the convex combination. Should be 0 <= alpha <= 1
[in]aThe first vector for the convex combination.
[in]bThe second vector for the convex combination.
Returns
*this

Definition at line 658 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v.

Referenced by FEAT::Trafo::Isoparam::Evaluator< Trafo_, EvalPolicy_, degree_, Shape::Hypercube< 2 > >::prepare().

◆ set_convex_n()

template<typename T_ , int n_, int s_ = n_>
template<int nn_, int na_, int nb_, int sna_, int snb_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::set_convex_n ( DataType  alpha,
const Vector< T_, na_, sna_ > &  a,
const Vector< T_, nb_, snb_ > &  b 
)
inline

Sets the first nn_ entries of this vector to the convex combination of two other vectors.

Let y denote this vector, then this function computes:

\[ y \leftarrow (1-\alpha)\cdot a + \alpha\cdot b \]

Template Parameters
nn_The number of elements to combine; must be nn_ <= min(n_, na_, nb_)
Parameters
[in]alphaThe interpolation parameter for the convex combination. Should be 0 <= alpha <= 1
[in]aThe first vector for the convex combination.
[in]bThe second vector for the convex combination.
Returns
*this

Definition at line 686 of file tiny_algebra.hpp.

References FEAT::Tiny::Vector< T_, n_, s_ >::v.

◆ set_mat_vec_mult()

template<typename T_ , int n_, int s_ = n_>
template<int m_, int sma_, int sna_, int sx_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::set_mat_vec_mult ( const Matrix< T_, n_, m_, sma_, sna_ > &  a,
const Vector< T_, m_, sx_ > &  x 
)
inline

Sets this vector to the result of a matrix-vector product.

Let y denote this vector, and let A denote the input matrix and x in the input vector, then this function computes:

\[ y \leftarrow A\cdot x \]

Parameters
[in]aThe matrix for the product.
[in]xThe (right) multiplicand vector for the product.
Returns
*this

Definition at line 712 of file tiny_algebra.hpp.

References ASSERTM, FEAT::Tiny::Vector< T_, n_, s_ >::v, and FEAT::Tiny::Matrix< T_, m_, n_, sm_, sn_ >::v.

Referenced by FEAT::VoxelAssembly::Kernel::burgers_velo_material_mat_assembly_kernel(), FEAT::Geometry::MeshExtruder< ConformalMesh< Shape::Hypercube< 2 >, 2, Coord_ > >::extrude_vertex_set(), and FEAT::Tiny::operator*().

◆ set_mat_vec_mult_n()

template<typename T_ , int n_, int s_ = n_>
template<int mm_, int nn_, int ma_, int na_, int sna_, int sma_, int nx_, int sx_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::set_mat_vec_mult_n ( const Matrix< T_, ma_, na_, sma_, sna_ > &  a,
const Vector< T_, nx_, sx_ > &  x 
)
inline

Sets the first nn_ entries of this vector to the result of a matrix-vector product with the first mm_ entries of another vector.

This function effectively multiplies the upper left mm_ x nn_ block of the matrix a.

Template Parameters
mm_The number of matrix rows to multiply; must be mm_ <= min(n_, ma_)
nn_The number of matrix columns to multiply; must be nn_ <= min(nx_, na_)
Parameters
[in]aThe matrix for the product.
[in]xThe (right) multiplicand vector for the product.
Returns
*this

Definition at line 748 of file tiny_algebra.hpp.

References ASSERTM, FEAT::Tiny::Vector< T_, n_, s_ >::v, and FEAT::Tiny::Matrix< T_, m_, n_, sm_, sn_ >::v.

◆ set_vec_mat_mult()

template<typename T_ , int n_, int s_ = n_>
template<int m_, int sma_, int sna_, int sx_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::set_vec_mat_mult ( const Vector< T_, m_, sx_ > &  x,
const Matrix< T_, m_, n_, sma_, sna_ > &  a 
)
inline

Sets this vector to the result of a vector-matrix product.

Let y denote this vector, and let x in the input vector and A denote the input matrix, then this function computes:

\[ y^\top \leftarrow x^\top \cdot A \Longleftrightarrow y \leftarrow A^\top\cdot x \]

Parameters
[in]xThe (left) multiplicand vector for the product.
[in]aThe matrix for the product.
Returns
*this

Definition at line 785 of file tiny_algebra.hpp.

References ASSERTM, FEAT::Tiny::Vector< T_, n_, s_ >::v, and FEAT::Tiny::Matrix< T_, m_, n_, sm_, sn_ >::v.

Referenced by FEAT::Tiny::operator*().

◆ set_vec_mat_mult_n()

template<typename T_ , int n_, int s_ = n_>
template<int nn_, int mm_, int mx_, int smx_, int ma_, int na_, int sma_, int sna_>
CUDA_HOST_DEVICE Vector & FEAT::Tiny::Vector< T_, n_, s_ >::set_vec_mat_mult_n ( const Vector< T_, mx_, smx_ > &  x,
const Matrix< T_, ma_, na_, sma_, sna_ > &  a 
)
inline

Sets the first mm_ entries of this vector to the result of a vector-matrix product with the first mm_ entries of another vector.

This function effectively multiplies the upper left mm_ x nn_ block of the matrix a.

Template Parameters
nn_The number of matrix columns to multiply; must be nn_ <= min(nx_, na_)
mm_The number of matrix rows to multiply; must be mm_ <= min(n_, ma_)
Parameters
[in]xThe (left) multiplicand vector for the product.
[in]aThe matrix for the product.
Returns
*this

Definition at line 821 of file tiny_algebra.hpp.

References ASSERTM, FEAT::Tiny::Vector< T_, n_, s_ >::v, and FEAT::Tiny::Matrix< T_, m_, n_, sm_, sn_ >::v.

Friends And Related Function Documentation

◆ operator<<

template<typename T_ , int n_, int s_ = n_>
CUDA_HOST friend std::ostream & operator<< ( std::ostream &  lhs,
const Vector< T_, n_, s_ > &  b 
)
friend

Tiny::Vector streaming operator.

Parameters
[in]lhsThe target stream.
[in]bThe vector to be streamed.

Definition at line 1180 of file tiny_algebra.hpp.

Member Data Documentation

◆ n

template<typename T_ , int n_, int s_ = n_>
constexpr int FEAT::Tiny::Vector< T_, n_, s_ >::n = n_
staticconstexpr

◆ s

template<typename T_ , int n_, int s_ = n_>
constexpr int FEAT::Tiny::Vector< T_, n_, s_ >::s = s_
staticconstexpr

the stride of the vector

Definition at line 217 of file tiny_algebra.hpp.

◆ v

template<typename T_ , int n_, int s_ = n_>
T_ FEAT::Tiny::Vector< T_, n_, s_ >::v[s_]

actual vector data

Definition at line 225 of file tiny_algebra.hpp.

Referenced by FEAT::Tiny::Vector< T_, n_, s_ >::Vector(), FEAT::Tiny::Vector< T_, n_, s_ >::add_mat_vec_mult(), FEAT::Tiny::Vector< T_, n_, s_ >::add_mat_vec_mult_n(), FEAT::Tiny::Vector< T_, n_, s_ >::add_vec_mat_mult(), FEAT::Tiny::Vector< T_, n_, s_ >::add_vec_mat_mult_n(), FEAT::Tiny::Vector< T_, n_, s_ >::axpy(), FEAT::Tiny::Vector< T_, n_, s_ >::axpy_n(), FEAT::Tiny::Vector< T_, n_, s_ >::convert(), FEAT::Tiny::Vector< T_, n_, s_ >::convert_new(), FEAT::Tiny::Vector< T_, n_, s_ >::copy(), FEAT::Tiny::Vector< T_, n_, s_ >::copy_n(), FEAT::Tiny::Vector< T_, n_, s_ >::format(), FEAT::Tiny::Vector< T_, n_, s_ >::format_n(), FEAT::Geometry::VoxelFormulaMasker< dim_ >::mask_line(), FEAT::Tiny::Vector< T_, n_, s_ >::negate(), FEAT::Tiny::Vector< T_, n_, s_ >::negate_n(), FEAT::Tiny::Vector< T_, n_, s_ >::norm_euclid_sqr(), FEAT::Tiny::Vector< T_, n_, s_ >::norm_euclid_sqr_n(), FEAT::Tiny::Vector< T_, n_, s_ >::norm_l1(), FEAT::Tiny::Vector< T_, n_, s_ >::norm_l1_n(), FEAT::Tiny::Vector< T_, n_, s_ >::norm_max(), FEAT::Tiny::Vector< T_, n_, s_ >::norm_max_n(), FEAT::LAFEM::SparseVectorBlocked< DT_, IT_, BlockSize_ >::operator()(), FEAT::Tiny::Vector< T_, n_, s_ >::operator()(), FEAT::Tiny::Vector< T_, n_, s_ >::operator*=(), FEAT::Tiny::Vector< T_, n_, s_ >::operator+=(), FEAT::Tiny::Vector< T_, n_, s_ >::operator-=(), FEAT::Tiny::Vector< T_, n_, s_ >::operator=(), FEAT::Tiny::Vector< T_, n_, s_ >::operator[](), FEAT::Tiny::Vector< T_, n_, s_ >::scale(), FEAT::Tiny::Vector< T_, n_, s_ >::scale_n(), FEAT::Tiny::Vector< T_, n_, s_ >::set_convex(), FEAT::Tiny::Vector< T_, n_, s_ >::set_convex_n(), FEAT::Tiny::Vector< T_, n_, s_ >::set_mat_vec_mult(), FEAT::Tiny::Vector< T_, n_, s_ >::set_mat_vec_mult_n(), FEAT::Tiny::Vector< T_, n_, s_ >::set_vec_mat_mult(), and FEAT::Tiny::Vector< T_, n_, s_ >::set_vec_mat_mult_n().


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