IOLink  IOL_v1.1.0_release
iolink::VectorX< T > Class Template Referencefinal

A dynamically sized arithmetic vector. More...

#include <iolink/VectorX.h>

Public Types

using ValueType = T
 
using Iterator = ValueType *
 
using ConstIterator = const ValueType *
 

Public Member Functions

 VectorX ()
 Creates an empty vector.
 
 VectorX (size_t size)
 Creates an unitialized vector. More...
 
 VectorX (std::initializer_list< ValueType > init)
 Creates a vector from an initialization list.
 
template<typename U >
 VectorX (const VectorX< U > &other)
 Build a vector from a vector storing another type. More...
 
 VectorX (const VectorX &other)
 
VectorXoperator= (const VectorX &other)
 
 VectorX (VectorX &&other) noexcept
 
VectorXoperator= (VectorX &&other) noexcept
 
size_t size () const
 Returns the size of the vector, which also correspond to vector number of dimension.
 
ValueType at (size_t index) const
 Access vector's value at given index.
 
void setAt (size_t index, ValueType value)
 Set value as given index.
 
ValueType & operator[] (size_t index)
 
ValueType operator[] (size_t index) const
 
Iterator begin () noexcept
 
ConstIterator begin () const noexcept
 
Iterator end () noexcept
 
ConstIterator end () const noexcept
 
bool operator== (const VectorX &other) const
 
bool operator!= (const VectorX &other) const
 
double squaredLength () const
 Returns the vector's norm, squared. More...
 
double length () const
 Returns the vector's norm. More...
 
void normalize ()
 Normalize the vector.
 
std::string toString () const
 
VectorX operator- () const
 
VectorXoperator+= (const VectorX &v)
 
VectorXoperator-= (const VectorX &v)
 
VectorX operator+ (const VectorX &v) const
 
VectorX operator- (const VectorX &v) const
 
VectorXoperator*= (ValueType value)
 
VectorXoperator/= (ValueType value)
 
VectorX operator* (ValueType s) const
 
VectorX operator/ (ValueType s) const
 
ValueType dot (const VectorX &v) const
 Dot product.
 
VectorX cross (const VectorX &v) const
 Cross product of two vectors. More...
 
VectorXoperator*= (const VectorX &v)
 
VectorXoperator/= (const VectorX &v)
 
VectorX operator* (const VectorX &v) const
 
VectorX operator/ (const VectorX &v) const
 
bool operator< (const VectorX &other) const
 
bool operator<= (const VectorX &other) const
 
bool operator> (const VectorX &other) const
 
bool operator>= (const VectorX &other) const
 

Static Public Member Functions

static VectorX createUniform (size_t size, ValueType value)
 Creates a vector filled with one value. More...
 

Friends

VectorX operator* (ValueType s, VectorX v)
 

Detailed Description

template<typename T>
class iolink::VectorX< T >

A dynamically sized arithmetic vector.

Constructor & Destructor Documentation

◆ VectorX() [1/2]

template<typename T >
iolink::VectorX< T >::VectorX ( size_t  size)
explicit

Creates an unitialized vector.

Parameters
sizeThe size of the vector.

◆ VectorX() [2/2]

template<typename T >
template<typename U >
iolink::VectorX< T >::VectorX ( const VectorX< U > &  other)
inlineexplicit

Build a vector from a vector storing another type.

Template Parameters
UThe type of the source vector.
Parameters
otherThe vector to convert.

Member Function Documentation

◆ createUniform()

template<typename T >
static VectorX iolink::VectorX< T >::createUniform ( size_t  size,
ValueType  value 
)
static

Creates a vector filled with one value.

Parameters
sizeThe size of the vector.
valueThe value used to fill the vector.

◆ cross()

template<typename T >
VectorX iolink::VectorX< T >::cross ( const VectorX< T > &  v) const

Cross product of two vectors.

Work only for vectors of size 3.

◆ length()

template<typename T >
double iolink::VectorX< T >::length ( ) const

Returns the vector's norm.

Specifically, it is the L1 norm that's computed here.

◆ squaredLength()

template<typename T >
double iolink::VectorX< T >::squaredLength ( ) const

Returns the vector's norm, squared.

Specifically, it is the L1 norm that's computed here.


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