33 Matrix(uint16_t , uint16_t );
101 double &
at(uint32_t )
const;
102 double &
at(uint16_t , uint16_t )
const;
A class describing a Matrix object. Matrices are array of size (n,m) whre n and m are integer greater...
Definition: matrix.h:29
uint32_t n_elements
Definition: matrix.h:97
static Matrix rand(uint16_t, uint16_t)
Construct a matrix object of dimension n times m filled with random values sampled from 0....
Definition: matrix.cpp:544
friend Matrix operator/(const Matrix &, const double)
Overload operator / for division of Matrix by scalar.
Definition: matrix.cpp:369
Vector row(uint16_t) const
Extract row from Matrix.
Definition: matrix.cpp:410
Matrix & operator+=(const Matrix &)
Overload operator +=.
Definition: matrix.cpp:132
static Matrix zeros(uint16_t, uint16_t)
Construct a matrix object of dimension n times m filled with zeros.
Definition: matrix.cpp:520
Matrix & operator-=(const Matrix &)
Overload operator -=.
Definition: matrix.cpp:147
static Matrix matmul(const Matrix &, MATRIX_TRANSPOSE, const Matrix &, MATRIX_TRANSPOSE)
Compute the product of two matrices combined with their transposition.
Definition: matrix.cpp:613
double normFrob() const
Compute the Frobenius norm of a Matrix object. For a Matrix M of dimension , its Frobenius norm is gi...
Definition: matrix.cpp:487
void default_data()
Fill the data array with zeros.
Definition: matrix.cpp:705
Matrix()
Construct a Matrix object. Default constructor. Set number of rows and number of columns to 0....
Definition: matrix.cpp:9
uint16_t n_rows
Definition: matrix.h:95
bool is_square() const
Test if a matrix has a square shape.
Definition: matrix.cpp:401
static Matrix vandermonde(const Vector &, uint16_t)
Construct a Vandermonde matrix. See https://en.wikipedia.org/wiki/Vandermonde_matrix.
Definition: matrix.cpp:578
double & at(uint32_t) const
Helper to access the n-th stored value of a Matrix object.
Definition: matrix.cpp:672
friend bool operator==(const Matrix &, const Matrix &)
Overload of operator == Two matrices are equal if and only they have the same dimensions and the same...
Definition: matrix.cpp:176
static Matrix outer(const Vector &, const Vector &)
Overload operator * between two vectors to compute their outer product.
Definition: matrix.cpp:595
double normInf() const
Compute the norm-Infinity of a Matrix object. For a Matrix M of dimension , its norm-Infinity is give...
Definition: matrix.cpp:464
friend Matrix operator+(const Matrix &, const Matrix &)
Overload operator + for addition of Matrices.
Definition: matrix.cpp:281
uint16_t get_n_rows() const
Accessor to the number of rows.
Definition: matrix.cpp:61
double * data
Definition: matrix.h:98
Matrix operator-() const
Overload unary operator -.
Definition: matrix.cpp:160
Matrix transpose() const
Compute the transpose Matrix of a Matrix object.
Definition: matrix.cpp:502
uint32_t get_n_elements() const
Accessor to the number of elements.
Definition: matrix.cpp:77
virtual ~Matrix()
Destroy the Matrix object.
Definition: matrix.cpp:51
Vector col(uint16_t) const
Extract column from Matrix.
Definition: matrix.cpp:424
static Matrix hilbert(uint16_t, uint16_t)
Construct an Hilbert matrix.
Definition: matrix.cpp:560
double norm1() const
Compute the norm-1 of a Matrix object. For a Matrix M of dimension , its norm-1 is given by the maxim...
Definition: matrix.cpp:441
void show() const
Helper to display a Matrix object to the standart output stream.
Definition: matrix.cpp:693
static Matrix ones(uint16_t, uint16_t)
Construct a matrix object of dimension n times m filled with ones.
Definition: matrix.cpp:532
uint16_t get_n_cols() const
Accessor to the number of columns.
Definition: matrix.cpp:69
friend Matrix operator*(const Matrix &, const Matrix &)
Overload operator * for multiplication of Matrices.
Definition: matrix.cpp:198
friend std::ostream & operator<<(std::ostream &, const Matrix &)
Overload output stream operator for Matrix object.
Definition: matrix.cpp:384
Matrix & operator=(const Matrix &)
Overload assignement operator.
Definition: matrix.cpp:109
double & operator()(uint32_t) const
Overload operator (i)
Definition: matrix.cpp:99
uint16_t n_cols
Definition: matrix.h:96
A lightweight class describing a Vector object. Vectors are array with size n (>0) of doubles.
Definition: vector.h:25
MATRIX_TRANSPOSE
Enumeration of transposition operation for Matrix object, useful for fast multiplication.
Definition: matrix.h:19
@ TRANSPOSE
Definition: matrix.h:19
@ NO_TRANSPOSE
Definition: matrix.h:19
Header file for Vector class.