26 Vector(
const std::vector<T>& vec);
29 Vector(
const T* vec,
const size_t& n);
32 Vector(
const size_t& n,
const T& value);
80 const T&
back()
const;
83 const T&
front()
const;
110 void resize(
const size_t n);
113 const size_t size()
const;
116 const std::vector<T>&
std()
const;
123 #include "Vector-inl.hh"
T mag2() const
Returns the square of the magnitude of the vector.
Definition: Vector-inl.hh:197
T dot(const Vector &vec) const
Returns the dot product with another vecror.
Definition: Vector-inl.hh:207
Vector operator/(const T &factor) const
Overload the vector ratio with a scalar.
Definition: Vector-inl.hh:134
Object that can host any type of data in a vector arrangement.
Definition: Vector.hh:17
T mag() const
Returns the magnitude of the vector.
Definition: Vector-inl.hh:192
const T & front() const
Returns the first element of the vector.
Definition: Vector-inl.hh:242
~Vector()
Destructor.
Definition: Vector-inl.hh:31
void operator+=(const Vector &vec)
Overload the vector sum.
Definition: Vector-inl.hh:65
void push_front(const T &element)
Adds element at the back.
Definition: Vector-inl.hh:262
const T & operator[](const size_t i) const
Overload the subscript operator, return a value.
Definition: Vector-inl.hh:170
std::vector< T > _vec
Underlying std::vector.
Definition: Vector.hh:120
const T & back() const
Returns the last element of the vector.
Definition: Vector-inl.hh:238
const size_t size() const
Returns dimension of the vector.
Definition: Vector-inl.hh:266
Vector cross(const Vector &vec) const
Returns the cross product with another vecror.
Definition: Vector-inl.hh:221
const std::vector< T > & std() const
Returns the vector as an std::vector.
Definition: Vector-inl.hh:270
void resize(const size_t n)
Resizes the vector to chosen dimension.
Definition: Vector-inl.hh:254
Vector operator+(const Vector &vec) const
Overload the vector sum.
Definition: Vector-inl.hh:51
void operator-=(const Vector &vec)
Overload the v substraction.
Definition: Vector-inl.hh:90
Vector()
Default constructor, initilizes an empty vector of dimension 0.
Definition: Vector-inl.hh:1
Vector & operator=(const Vector &vec)
Equality operator.
Definition: Vector-inl.hh:33
T operator*(const Vector &vec) const
Overload the vector product (dot product)
Definition: Vector-inl.hh:101
T norm() const
Returns the norm of the vector.
Definition: Vector-inl.hh:246
Vector operator-() const
Overload the unary minus for vector algebra.
Definition: Vector-inl.hh:41
void operator/=(const T &factor)
Overload the vector ratio with a scalar.
Definition: Vector-inl.hh:148
T norm2() const
Returns the square of the norm of the vector.
Definition: Vector-inl.hh:250
void push_back(const T &element)
Adds element at the back.
Definition: Vector-inl.hh:258
void operator*=(const T &factor)
Overload the vector product with a scalar.
Definition: Vector-inl.hh:126