30 Vector(
double * , uint16_t );
63 double norm(uint8_t );
66 double normp(uint8_t );
93 uint16_t partition(
int ,
int );
94 void quicksort(
int ,
int );
97 static void swap(
double *,
double * );
A lightweight class describing a Vector object. Vectors are array with size n (>0) of doubles.
Definition: vector.h:25
double & operator()(uint16_t) const
Access the n-th value of a Vector object. Same as operator [].
Definition: vector.cpp:98
static Vector zeros(uint16_t)
Construct a Vector object of length n filled with zeros.
Definition: vector.cpp:469
static Vector basis(uint16_t, uint16_t)
Construct vector of the canonical basis of .
Definition: vector.cpp:458
~Vector()
Destroy the Vector object.
Definition: vector.cpp:62
double norm1()
Compute the norm of a Vector object.
Definition: vector.cpp:379
friend bool operator==(const Vector &, const Vector &)
Overload of the equality operator for Vector objects. Two vectors are said to be equal if and only if...
Definition: vector.cpp:175
double norm2()
Compute the Euclidean norm of a Vector object.
Definition: vector.cpp:392
double & operator[](uint16_t) const
Access the n-th value of a Vector object.
Definition: vector.cpp:85
friend Vector operator/(const Vector &, const double)
Operator to divide a Vector by a scalar.
Definition: vector.cpp:325
friend Vector abs(const Vector &)
Elementwise absolute value of a vector.
Definition: vector.cpp:559
static Vector rand(uint16_t)
Construct a Vector object of length filled with random values sampled from 0. to 1.
Definition: vector.cpp:494
double norm(uint8_t)
A general method to compute the norm of a Vector object.
Definition: vector.cpp:356
static Vector randn(uint16_t)
Construct a Vector object of length filled with random values sampled from the Gaussian random numbe...
Definition: vector.cpp:508
Vector & operator+=(const Vector &)
Overload operator += for vectors objects.
Definition: vector.cpp:131
friend std::ostream & operator<<(std::ostream &, const Vector &)
Overload output stream operator for Vector object.
Definition: vector.cpp:340
Vector()
Construct a new Vector object. Default constructor. Return an empty vector of 0 dimension.
Definition: vector.cpp:10
friend double sum(const Vector &)
Compute the sum of the element of a vector.
Definition: vector.cpp:627
void sort()
Sort the vector with the quickSort algorithm.
Definition: vector.cpp:432
Vector operator-() const
Operator to get the opposite vector.
Definition: vector.cpp:159
friend Vector pow2(const Vector &)
Elementwise square of a vector.
Definition: vector.cpp:572
double normInf()
Compute the norm of a Vector object.
Definition: vector.cpp:419
friend Vector sqrt(const Vector &)
Elementwise square root of a vector.
Definition: vector.cpp:612
std::vector< double > to_std_vector()
Conversion to a standard library vector object.
Definition: vector.cpp:440
uint16_t get_dim() const
Get the dimension of a Vector object.
Definition: vector.cpp:72
static Vector ones(uint16_t)
Construct a Vector object of length n filled with ones.
Definition: vector.cpp:480
double normp(uint8_t)
Compute the norm of a Vector object.
Definition: vector.cpp:406
Vector & operator-=(const Vector &)
Overload operator -= for vectors objects.
Definition: vector.cpp:146
friend double prod(const Vector &)
Compute the product of the element of a vector.
Definition: vector.cpp:582
friend double operator*(const Vector &, const Vector &)
Dot product between vectors.
Definition: vector.cpp:195
friend Vector operator+(const Vector &, const Vector &)
Addition of two vector objects.
Definition: vector.cpp:238
Vector & operator=(const Vector &)
Overload the assignement operator. Acts like a copy constructor.
Definition: vector.cpp:109
static Vector linspace(double, double, uint16_t)
Construct a Vector object of length n filled with equally points spaced between t0 and t1 included.
Definition: vector.cpp:541