maliput
Vector< N > Class Template Reference

Detailed Description

template<std::size_t N>
class maliput::math::Vector< N >

A N-dimensional vector.

Template Parameters
NIs the dimension of the vector.

#include <include/maliput/math/vector.h>

Inheritance diagram for Vector< N >:
[legend]

Public Member Functions

 Vector ()
 Constructs a null N-dimensional vector. More...
 
 Vector (std::initializer_list< double > values)
 Constructs a N-dimensional vector using initializing list;. More...
 
 Vector (std::array< double, N > values)
 Constructs a N-dimensional vector from a std::array object;. More...
 
Vector< N - 1 > reduce (size_t index) const
 Reduce the vector's dimension. More...
 
- Public Member Functions inherited from VectorBase< N, Vector< N > >
 VectorBase ()
 Constructs a null N-dimensional vector. More...
 
 VectorBase (std::array< double, N > values)
 Constructs an N-dimensional vector from a std::array object;. More...
 
 VectorBase (std::initializer_list< double > values)
 Constructs an N-dimensional vector using initializing list;. More...
 
 VectorBase (const VectorBase< N, Vector< N > > &other)=default
 Copy constructor. More...
 
 VectorBase (VectorBase< N, Vector< N > > &&other)=default
 Move constructor. More...
 
double dot (const VectorBase< N, Vector< N > > &vector) const
 
double norm () const
 
void normalize ()
 Divides each vector component by norm(). More...
 
Vector< N > normalized () const
 
std::size_t size () const
 
std::array< double, N > to_array () const
 
Vector< N > & operator= (const VectorBase< N, Vector< N > > &other)
 Assignment operator overload. More...
 
Vector< N > & operator= (const VectorBase< N, Vector< N > > &&other)
 Move assignment operator overload. More...
 
double operator[] (std::size_t index) const
 Constant subscripting array operator overload. More...
 
doubleoperator[] (std::size_t index)
 Subscripting array operator overload. More...
 
bool operator== (const VectorBase< N, Vector< N > > &vector) const
 Equality operator overload. More...
 
bool operator!= (const VectorBase< N, Vector< N > > &vector) const
 Inequality operator overload. More...
 
Vector< N > operator+ (const VectorBase< N, Vector< N > > &vector) const
 Add operator overload. More...
 
Vector< N > & operator+= (const VectorBase< N, Vector< N > > &vector)
 Add and assignment operator overload. More...
 
Vector< N > operator- (const VectorBase< N, Vector< N > > &vector) const
 Substract operator overload. More...
 
Vector< N > operator/ (double scalar) const
 Divide operator overload between a VectorBase<N, Derived> vector and a double. More...
 
std::string to_str () const
 

Additional Inherited Members

- Static Public Member Functions inherited from VectorBase< N, Vector< N > >
static Vector< N > Zero ()
 
static Vector< N > Ones ()
 
static Vector< N > FromStr (const std::string &vector_str)
 Parses vector_str that should come in the following format "{A, B, C, ...}" (white spaces could or could not be there). More...
 
- Static Public Attributes inherited from VectorBase< N, Vector< N > >
static constexpr std::size_t kDimension
 The dimension of the vector. More...
 
- Protected Attributes inherited from VectorBase< N, Vector< N > >
std::array< double, N > values_
 

Constructor & Destructor Documentation

◆ Vector() [1/3]

Vector ( )

Constructs a null N-dimensional vector.

◆ Vector() [2/3]

Vector ( std::initializer_list< double values)

Constructs a N-dimensional vector using initializing list;.

◆ Vector() [3/3]

Vector ( std::array< double, N >  values)

Constructs a N-dimensional vector from a std::array object;.

Member Function Documentation

◆ reduce()

Vector< N - 1 > reduce ( size_t  index) const

Reduce the vector's dimension.

Parameters
indexIs the number of element to remove.
Returns
A vector reduced by one dimension.
Exceptions
common::assertion_errorWhen index is out of range.
common::assertion_errorWhen N is less than 2.

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