#include <include/linalg/Matrix.hpp>
|
void | reshape (size_t, size_t)=delete |
| Reshaping a square matrix to a general matrix requires an explicit cast. More...
|
|
Matrix | reshaped (size_t, size_t)=delete |
| Reshaping a square matrix to a general matrix requires an explicit cast. More...
|
|
|
size_t | rows () const |
| Get the number of rows of the matrix. More...
|
|
size_t | cols () const |
| Get the number of columns of the matrix. More...
|
|
size_t | num_elems () const |
| Get the number of elements in the matrix: More...
|
|
Matrix | reshaped (size_t newrows, size_t newcols) const |
| Create a reshaped copy of the matrix. More...
|
|
|
double & | operator() (size_t row, size_t col) |
| Get the element at the given position in the matrix. More...
|
|
const double & | operator() (size_t row, size_t col) const |
| Get the element at the given position in the matrix. More...
|
|
double & | operator() (size_t index) |
| Get the element at the given position in the linearized matrix. More...
|
|
const double & | operator() (size_t index) const |
| Get the element at the given position in the linearized matrix. More...
|
|
|
void | fill (double value) |
| Fill the matrix with a constant value. More...
|
|
void | fill_identity () |
| Fill the matrix as an identity matrix (all zeros except the diagonal which is one). More...
|
|
void | fill_random (double min=0, double max=1, std::default_random_engine::result_type seed=std::default_random_engine::default_seed) |
| Fill the matrix with uniformly distributed random values. More...
|
|
|
double | normFro () const & |
| Compute the Frobenius norm of the matrix. More...
|
|
double | normFro () && |
| Compute the Frobenius norm of the matrix. More...
|
|
|
storage_t::iterator | begin () |
| Get the iterator to the first element of the matrix. More...
|
|
storage_t::const_iterator | begin () const |
| Get the iterator to the first element of the matrix. More...
|
|
storage_t::const_iterator | cbegin () const |
| Get the iterator to the first element of the matrix. More...
|
|
storage_t::iterator | end () |
| Get the iterator to the element past the end of the matrix. More...
|
|
storage_t::const_iterator | end () const |
| Get the iterator to the element past the end of the matrix. More...
|
|
storage_t::const_iterator | cend () const |
| Get the iterator to the element past the end of the matrix. More...
|
|
|
void | print (std::ostream &os, uint8_t precision=0, uint8_t width=0) const |
| Print a matrix. More...
|
|
void | print (Print &print, uint8_t precision=0, uint8_t width=0) const |
| Print a matrix. More...
|
|
size_t | printTo (Print &print) const override |
| Implements the Arduino Printable interface. More...
|
|
◆ storage_t
Container to store the elements of the matrix internally.
Definition at line 40 of file Matrix.hpp.
◆ SquareMatrix() [1/5]
◆ SquareMatrix() [2/5]
Create a square matrix of zeros.
Definition at line 581 of file Matrix.hpp.
◆ SquareMatrix() [3/5]
SquareMatrix |
( |
std::initializer_list< std::initializer_list< double >> |
init | ) |
|
Create a square matrix with the given values.
Definition at line 552 of file Matrix.cpp.
◆ SquareMatrix() [4/5]
Convert a general matrix to a square matrix.
Definition at line 557 of file Matrix.cpp.
◆ SquareMatrix() [5/5]
Convert a general matrix to a square matrix.
Definition at line 561 of file Matrix.cpp.
◆ operator=()
SquareMatrix & operator= |
( |
std::initializer_list< std::initializer_list< double >> |
init | ) |
|
Assign the given values to the square matrix.
Definition at line 565 of file Matrix.cpp.
◆ reshape()
void reshape |
( |
size_t |
, |
|
|
size_t |
|
|
) |
| |
|
delete |
Reshaping a square matrix to a general matrix requires an explicit cast.
◆ reshaped() [1/2]
Matrix reshaped |
( |
size_t |
, |
|
|
size_t |
|
|
) |
| |
|
delete |
Reshaping a square matrix to a general matrix requires an explicit cast.
◆ transpose_inplace() [1/2]
void transpose_inplace |
( |
Matrix & |
A | ) |
|
|
static |
Transpose the matrix in-place.
Definition at line 576 of file Matrix.cpp.
◆ transpose_inplace() [2/2]
void transpose_inplace |
( |
| ) |
|
|
inline |
Transpose the matrix in-place.
Definition at line 615 of file Matrix.hpp.
◆ ones() [1/2]
Create a square matrix filled with ones.
Definition at line 587 of file Matrix.cpp.
◆ zeros() [1/2]
Create a square matrix filled with zeros.
Definition at line 590 of file Matrix.cpp.
◆ constant() [1/2]
Create a square matrix filled with a constant value.
Definition at line 593 of file Matrix.cpp.
◆ identity() [1/2]
Create a square identity matrix.
Definition at line 596 of file Matrix.cpp.
◆ random() [1/2]
SquareMatrix random |
( |
size_t |
rows, |
|
|
double |
min = 0 , |
|
|
double |
max = 1 , |
|
|
std::default_random_engine::result_type |
seed = std::default_random_engine::default_seed |
|
) |
| |
|
static |
Create a matrix with uniformly distributed random values.
Definition at line 604 of file Matrix.cpp.
◆ rows()
◆ cols()
◆ num_elems()
size_t num_elems |
( |
| ) |
const |
|
inlineinherited |
◆ reshaped() [2/2]
Matrix reshaped |
( |
size_t |
newrows, |
|
|
size_t |
newcols |
|
) |
| const |
|
inherited |
Create a reshaped copy of the matrix.
- See also
- reshape
Definition at line 84 of file Matrix.cpp.
◆ operator()() [1/4]
double & operator() |
( |
size_t |
row, |
|
|
size_t |
col |
|
) |
| |
|
inherited |
Get the element at the given position in the matrix.
Definition at line 94 of file Matrix.cpp.
◆ operator()() [2/4]
const double & operator() |
( |
size_t |
row, |
|
|
size_t |
col |
|
) |
| const |
|
inherited |
Get the element at the given position in the matrix.
Definition at line 102 of file Matrix.cpp.
◆ operator()() [3/4]
double& operator() |
( |
size_t |
index | ) |
|
|
inlineinherited |
Get the element at the given position in the linearized matrix.
Definition at line 107 of file Matrix.hpp.
◆ operator()() [4/4]
const double& operator() |
( |
size_t |
index | ) |
const |
|
inlineinherited |
Get the element at the given position in the linearized matrix.
Definition at line 109 of file Matrix.hpp.
◆ clear_and_deallocate()
void clear_and_deallocate |
( |
| ) |
|
|
inherited |
Set the number of rows and columns to zero, and deallocate the storage.
Definition at line 114 of file Matrix.cpp.
◆ fill()
void fill |
( |
double |
value | ) |
|
|
inherited |
Fill the matrix with a constant value.
Definition at line 125 of file Matrix.cpp.
◆ fill_identity()
Fill the matrix as an identity matrix (all zeros except the diagonal which is one).
Definition at line 129 of file Matrix.cpp.
◆ fill_random()
void fill_random |
( |
double |
min = 0 , |
|
|
double |
max = 1 , |
|
|
std::default_random_engine::result_type |
seed = std::default_random_engine::default_seed |
|
) |
| |
|
inherited |
Fill the matrix with uniformly distributed random values.
Definition at line 136 of file Matrix.cpp.
◆ ones() [2/2]
Matrix ones |
( |
size_t |
rows, |
|
|
size_t |
cols |
|
) |
| |
|
staticinherited |
◆ zeros() [2/2]
Matrix zeros |
( |
size_t |
rows, |
|
|
size_t |
cols |
|
) |
| |
|
staticinherited |
◆ constant() [2/2]
Matrix constant |
( |
size_t |
rows, |
|
|
size_t |
cols, |
|
|
double |
value |
|
) |
| |
|
staticinherited |
◆ identity() [2/2]
Matrix identity |
( |
size_t |
rows, |
|
|
size_t |
cols |
|
) |
| |
|
staticinherited |
◆ random() [2/2]
Matrix random |
( |
size_t |
rows, |
|
|
size_t |
cols, |
|
|
double |
min = 0 , |
|
|
double |
max = 1 , |
|
|
std::default_random_engine::result_type |
seed = std::default_random_engine::default_seed |
|
) |
| |
|
staticinherited |
◆ swap_rows()
void swap_rows |
( |
size_t |
a, |
|
|
size_t |
b |
|
) |
| |
|
inherited |
Swap two rows of the matrix.
Definition at line 189 of file Matrix.cpp.
◆ swap_columns()
void swap_columns |
( |
size_t |
a, |
|
|
size_t |
b |
|
) |
| |
|
inherited |
Swap two columns of the matrix.
Definition at line 184 of file Matrix.cpp.
◆ operator==()
bool operator== |
( |
const Matrix & |
other | ) |
const |
|
inherited |
Check for equality of two matrices.
- Warning
- Uses exact comparison, which is often not appropriate for floating point numbers.
Definition at line 198 of file Matrix.cpp.
◆ operator!=()
bool operator!= |
( |
const Matrix & |
other | ) |
const |
|
inlineinherited |
Check for inequality of two matrices.
- Warning
- Uses exact comparison, which is often not appropriate for floating point numbers.
Definition at line 193 of file Matrix.hpp.
◆ normFro() [1/2]
double normFro |
( |
| ) |
const & |
|
inherited |
Compute the Frobenius norm of the matrix.
Implementation
}
double normFro() const &
Compute the Frobenius norm of the matrix.
static double dot_unchecked(const Matrix &a, const Matrix &b)
Compute the dot product of two vectors.
Definition at line 219 of file Matrix.cpp.
◆ normFro() [2/2]
Compute the Frobenius norm of the matrix.
Definition at line 228 of file Matrix.cpp.
◆ begin() [1/2]
storage_t::iterator begin |
( |
| ) |
|
|
inlineinherited |
◆ begin() [2/2]
storage_t::const_iterator begin |
( |
| ) |
const |
|
inlineinherited |
Get the iterator to the first element of the matrix.
Definition at line 215 of file Matrix.hpp.
◆ cbegin()
storage_t::const_iterator cbegin |
( |
| ) |
const |
|
inlineinherited |
Get the iterator to the first element of the matrix.
Definition at line 217 of file Matrix.hpp.
◆ end() [1/2]
storage_t::iterator end |
( |
| ) |
|
|
inlineinherited |
◆ end() [2/2]
storage_t::const_iterator end |
( |
| ) |
const |
|
inlineinherited |
Get the iterator to the element past the end of the matrix.
Definition at line 222 of file Matrix.hpp.
◆ cend()
storage_t::const_iterator cend |
( |
| ) |
const |
|
inlineinherited |
Get the iterator to the element past the end of the matrix.
Definition at line 224 of file Matrix.hpp.
◆ print() [1/2]
void print |
( |
std::ostream & |
os, |
|
|
uint8_t |
precision = 0 , |
|
|
uint8_t |
width = 0 |
|
) |
| const |
|
inherited |
Print a matrix.
- Parameters
-
os | The stream to print to. |
precision | The number of significant figures to print. (0 = auto) |
width | The width of each element (number of characters). (0 = auto) |
Definition at line 242 of file Matrix.cpp.
◆ print() [2/2]
void print |
( |
Print & |
print, |
|
|
uint8_t |
precision = 0 , |
|
|
uint8_t |
width = 0 |
|
) |
| const |
|
inherited |
Print a matrix.
- Parameters
-
print | The printer to print to. |
precision | The number of significant figures to print. (0 = auto) |
width | The width of each element (number of characters). (0 = auto) |
Definition at line 48 of file ArduinoMatrixPrinter.cpp.
◆ printTo()
size_t printTo |
( |
Print & |
print | ) |
const |
|
inlineoverrideinherited |
Implements the Arduino Printable interface.
Definition at line 259 of file Matrix.hpp.
◆ operator<<() [1/2]
std::ostream & operator<< |
( |
std::ostream & |
os, |
|
|
const Matrix & |
M |
|
) |
| |
|
related |
◆ operator<<() [2/2]
Print & operator<< |
( |
Print & |
p, |
|
|
const Matrix & |
M |
|
) |
| |
|
related |
◆ rows_
◆ cols_
◆ storage
The documentation for this class was generated from the following files: