The Vish Visualization Shell 0.3
Vish
Classes | Public Types | Public Member Functions | Friends | List of all members
Eagle::Vector< T, n > Class Template Reference

A Vector is an fixed-size array (see class FixedArray) with vector space operations, i.e. More...

#include <elementary/eagle/Vector.hpp>

Inheritance diagram for Eagle::Vector< T, n >:
Eagle::FixedArray< T, n > Eagle::AntiSymmetric< Dims, Row< Dims, Value > > Eagle::LowerTriangular< Dims, Row< Dims, Value > > Eagle::Matrix< R, 1, value > Eagle::Matrix< N, N, value > Eagle::Matrix< N, N, float > Eagle::Torsion< Dims, Value > Eagle::Christoffel< Dims, Value > Eagle::Tensor3< Dims, Value > Eagle::Column< R, value >

Classes

struct  subvector
 Access part of the vector as a vector of smaller size. More...
 

Public Types

enum  
 The number of elements in this array.
 
- Public Types inherited from Eagle::FixedArray< T, n >
typedef FlattenedArray_t::value_type Element_t
 The maximally reduced type of elements stored here.
 
typedef GetFixedArrayType< T >::result_t ElementAsFixedArray_t
 Element type as fixed array, if it is convertible to a fixed array.
 
typedef FixedArray FixedArray_t
 Exporting the type definition of this array cass type.
 
typedef FixedArrayFlattener< FixedArrayOfElements_tFixedArrayFlattener_t
 Internal helper class.
 
typedef FixedArray< ElementAsFixedArray_t, N > FixedArrayOfElements_t
 If the value is derived from a fixed array type itself, then the FixedArrayOfElements_t is an FixedArray<FixedArray<>> type.
 
typedef FixedArrayFlattener_t::result_t FlattenedArray_t
 Reduction of this array type, if it is nested, to an flattened type which contains elementary types.
 
typedef T value_type
 Export the type of the respective element value type.
 

Public Member Functions

Base_tfixed_array ()
 Provide access to the base class, writable.
 
const Base_tfixed_array () const
 Provide access to the base class, read-only.
 
Vectoroperator*= (const T &value)
 Self-multiplication.
 
Vectoroperator+= (const Vector &v)
 Self-addition.
 
Vector operator- () const
 Unary minus.
 
Vectoroperator-= (const Vector &v)
 Self-subtraction.
 
Vectoroperator/= (const T &value)
 Self-division.
 
template<class scalar >
Assignment< Vector, 0 > operator= (const scalar &x)
 Assign first element with scalar and use consecutive comma expressions for assignment of further elements As such a Vector may be assigned as.
 
Vectoroperator= (const Vector &src)
 Assignment operator.
 
template<class V >
void set (const V &value)
 Assign all values to the same scalar.
 
constexpr Vector ()
 Default constructor.
 
template<class AType , class BType , int CompType>
 Vector (const FixedArray< AType, n > &l, const FixedArray< BType, n > &r, const Operator< CompType > &Op)
 Computational constructor for binary operations on two fixed arrays, calls the Operator's ternary() member function for each element.
 
template<class AType , class ScalarType , int CompType>
 Vector (const FixedArray< AType, n > &l, const Operator< CompType > &, const ScalarType &scalar)
 Computational constructor from vector with scalar, calls the Operator's ternary() member function for each element and the scalar as its 3rd argument.
 
template<typename InputType >
 Vector (const FixedArray< InputType, SIZE > &V)
 Type conversion constructor.
 
template<typename Indicable >
 Vector (const Indicable &I, const AnyType &)
 Construct from indicable object, i.e.
 
template<class AType , class ScalarType , int CompType>
 Vector (const Operator< CompType > &, const ScalarType &scalar, const FixedArray< AType, n > &v)
 Computational constructor from scalar with vector calls the Operator's ternary() member function for each element and the scalar as its 2nd argument.
 
template<typename InputType >
constexpr Vector (const std::initializer_list< InputType > &Init)
 Construct from a initialization array.
 
 Vector (const T &a)
 Convenience Constructor: initialize the first element.
 
 Vector (const T &a, const T &b)
 Convenience Constructor: initialize the first two elements.
 
 Vector (const T &a, const T &b, const T &c)
 Convenience Constructor: initialize the first three elements.
 
 Vector (const T &a, const T &b, const T &c, const T &d)
 Convenience Constructor: initialize the first four elements.
 
template<int CompType>
 Vector (const Vector &l, const Vector &r, const Operator< CompType > &)
 Computational constructor for binary operations on two vectors calls the Operator's ternary() member function for each element.
 
 Vector (const Vector &NV, const Sub &, const Sub &)
 Computational constructor for unary minus.
 
constexpr Vector (const Vector &v)
 Copy constructor.
 
 Vector (const Vector &v, const Operator<'-'> &)
 Unitary minus computational constructor Applies the unitary minus to each element.
 
template<typename InputType >
 Vector (const Vector< InputType, SIZE > &V)
 Type conversion constructor.
 
- Public Member Functions inherited from Eagle::FixedArray< T, n >
void expandMinMax (FixedArray &MinValues, FixedArray &MaxValues) const
 Expand a range given by MinValues,MaxValues to include the values of this array, done per component.
 
constexpr FixedArray () noexcept
 Default constructor.
 
constexpr FixedArray (const FixedArray< AType, N > &l, const FixedArray< BType, N > &r, const Operator< CompType > &)
 Computational constructor for binary operations on two fixed arrays, calls the Operator's ternary() member function for each element.
 
constexpr FixedArray (const FixedArray< T, M > &F, const T &DefaultValue)
 Construct array from another array type of variable length.
 
constexpr FixedArray (const FixedArray< T, N > &F)
 Automatic type conversion function.
 
constexpr FixedArray (const FixedArray< T, N > &F, const ConversionFunctor &CF, const FA_CONVERT &)
 Construct array from another array type of same length.
 
constexpr FixedArray (const std::initializer_list< InitType > &Init)
 Construct from a initialization array.
 
constexpr FixedArray (const T &a)
 Convenience Constructor: initialize the first element.
 
constexpr FixedArray (const T &a, const T &b)
 Convenience Constructor: initialize the first two elements.
 
 FixedArray (const T &a, const T &b, const T &c)
 Convenience Constructor: initialize the first three elements.
 
constexpr FixedArray (const T &a, const T &b, const T &c, const T &d)
 Convenience Constructor: initialize the first four elements.
 
constexpr FixedArray (const T &a, const T &b, const T &c, const T &d, const T &e)
 Convenience Constructor: initialize the first five elements.
 
constexpr T & get (int i)
 writable element access
 
constexpr const T & get (int i) const
 read-only element access
 
constexpr const FixedArray< T, subsize > * get_subarray () const
 Helper class for retrieve a subset of the current array.
 
constexpr const FixedArray< T, SIZE-1 > & get_subdim () const
 Mainly introduced because of Interpolate::operator[].
 
const FixedArray_tgetFixedArray () const noexcept
 convenience function for base classes
 
FixedArray_tgetFixedArray () noexcept
 convenience function for base classes
 
constexpr T getMax () const
 Compute the maximum element value of this array.
 
constexpr T getMin () const
 Compute the maximum element value of this array.
 
constexpr bool operator!= (const FixedArray< T, N > &F) const
 Compare two arrays.
 
constexpr bool operator== (const FixedArray< T, N > &F) const
 Compare two arrays.
 
constexpr T & operator[] (int i)
 writeable element access operator
 
constexpr const T & operator[] (int i) const
 read-only element access operator
 
constexpr T * ptr (int i=0) noexcept
 Return a pointer to the ith element, no range checking.
 
constexpr void set (const Value &x)
 Set all array elements to the same value.
 
void setFromArray (const T *x, int length=SIZE, int offset=0)
 Set all array elements to an array's element value.
 
void sort (FixedArray< int, N > &I) const
 Sort the elements of an array into the index array.
 

Friends

Vector operator* (const Scalar_t &V, const Vector &A)
 Scalar * Array.
 
Vector operator* (const Vector &A, const Scalar_t &V)
 Array * Scalar.
 
Vector operator+ (const Vector &A, const Vector &B)
 Array + Array.
 
Vector operator- (const Vector &A, const Vector &B)
 Array - Array.
 
Vector operator/ (const Vector &A, const Scalar_t &V)
 Array / Scalar.
 
std::ostream & operator<< (std::ostream &os, const Vector &v)
 Output operator of C++ I/O streams.
 

Additional Inherited Members

- Static Public Member Functions inherited from Eagle::FixedArray< T, n >
static constexpr FixedArray convert (const FixedArray< T, N > &F, const ConversionFunctor &CF)
 Perform a type conversion on a given fixed array into another basis type:
 
static constexpr dimension_t size ()
 The number of elements here.
 
- Protected Attributes inherited from Eagle::FixedArray< T, n >
data [SIZE]
 The actual data values, intentional no-initialization for data member, which increases performance on vector creation.
 

Detailed Description

template<class T, dimension_t n>
class Eagle::Vector< T, n >

A Vector is an fixed-size array (see class FixedArray) with vector space operations, i.e.

addition, subtraction and scalar multiplication. The class name Vector denotes any elements of a vector space and its functionality is not limited to vectors in the narrower meaning within differential geometry. As such, a Matrix or tensor of higher rank is derived from a Vector as well and inherits all vector space operations as provided by the Vector base class.

Various computational constructors are supported, which make use of the Operator<> template trait class.

Note
The same cautions as when using FixedArray's apply, i.e. copying of objects of class Vector should be avoided because it will require to copy all elements.
Parameters
NThe dimensionality of the vector, i.e. the number of elements.
TThe type of the elements which construct the vector.

Constructor & Destructor Documentation

◆ Vector() [1/3]

template<class T , dimension_t n>
template<typename Indicable >
Eagle::Vector< T, n >::Vector ( const Indicable &  I,
const AnyType  
)
inline

Construct from indicable object, i.e.

anything which can be indiced with an integer. Example are native arrays or Vector types instantiations on other numerical types.

double values[5];
Vector<4, double> V( values, AnyType() );
A Vector is an fixed-size array (see class FixedArray) with vector space operations,...
Definition Vector.hpp:46
Definition Operator.hpp:138

References Eagle::FixedArray< T, n >::data.

◆ Vector() [2/3]

template<class T , dimension_t n>
template<class AType , class ScalarType , int CompType>
Eagle::Vector< T, n >::Vector ( const FixedArray< AType, n > &  l,
const Operator< CompType > &  ,
const ScalarType &  scalar 
)
inline

Computational constructor from vector with scalar, calls the Operator's ternary() member function for each element and the scalar as its 3rd argument.

Note
The operator argument is the second argument here, not the last because when giving it as last it would lead to ambiguities with the alternative computational constructors

References Eagle::FixedArray< T, n >::data.

◆ Vector() [3/3]

template<class T , dimension_t n>
template<class AType , class ScalarType , int CompType>
Eagle::Vector< T, n >::Vector ( const Operator< CompType > &  ,
const ScalarType &  scalar,
const FixedArray< AType, n > &  v 
)
inline

Computational constructor from scalar with vector calls the Operator's ternary() member function for each element and the scalar as its 2nd argument.

Note
The operator argument is the first argument here, not the last because when giving it as last it would lead to ambiguities with the alternative computational constructors

References Eagle::FixedArray< T, n >::data.

Member Function Documentation

◆ operator=()

template<class T , dimension_t n>
template<class scalar >
Assignment< Vector, 0 > Eagle::Vector< T, n >::operator= ( const scalar &  x)
inline

Assign first element with scalar and use consecutive comma expressions for assignment of further elements As such a Vector may be assigned as.

V = 1.1, 2.2, 3.3, 4.4;