|
Geogram Version 1.9.7
A programming library of geometric algorithms
|
A matrix type. More...
#include <geogram/basic/matrix.h>
Public Types | |
| typedef Matrix< DIM, FT > | matrix_type |
| typedef FT | value_type |
Public Member Functions | |
| Matrix () | |
| Default constructor. | |
| Matrix (const FT *vals) | |
| Constructs a matrix from an array of values. | |
| Matrix (const std::initializer_list< std::initializer_list< FT > > &Mi) | |
| Constructs a matrix from 2d array of initializers. | |
| index_t | dimension () const |
| Gets the matrix dimension. | |
| void | load_zero () |
| Clears the matrix. | |
| void | load_identity () |
| Sets the matrix to identity. | |
| bool | is_identity () const |
| Tests whether a matrix is the identity matrix. | |
| FT & | operator() (index_t i, index_t j) |
| Gets a modifiable element. | |
| const FT & | operator() (index_t i, index_t j) const |
| Gets a non-modifiable element. | |
| matrix_type & | operator+= (const matrix_type &m) |
| Adds a matrix in place. | |
| matrix_type & | operator-= (const matrix_type &m) |
| Subtracts a matrix in place. | |
| matrix_type & | operator*= (FT val) |
| Multiplies by a scalar in place. | |
| matrix_type & | operator/= (FT val) |
| Divides by a scalar in place. | |
| matrix_type | operator+ (const matrix_type &m) const |
| Adds 2 matrices. | |
| matrix_type | operator- (const matrix_type &m) const |
| Subtracts 2 matrices. | |
| matrix_type | operator* (FT val) const |
| Multiplies a matrix by a scalar. | |
| matrix_type | operator/ (FT val) const |
| Divides a matrix by a scalar. | |
| matrix_type | operator* (const matrix_type &m) const |
| Multiplies 2 matrices. | |
| matrix_type | inverse () const |
| Computes the inverse matrix. | |
| bool | compute_inverse (matrix_type &result) const |
| Computes the inverse matrix. | |
| matrix_type | transpose () const |
| Computes the transposed matrix. | |
| const FT * | data () const |
| Gets non-modifiable matrix data. | |
| FT * | data () |
| Gets modifiable matrix data. | |
| void | get_lower_triangle (FT *store) const |
| Gets the lower triangle of the matrix. | |
Static Public Attributes | |
| static constexpr index_t | dim = DIM |
Related Symbols | |
(Note that these are not member symbols.) | |
| template<index_t DIM, class FT > | |
| std::ostream & | operator<< (std::ostream &output, const Matrix< DIM, FT > &m) |
| Writes a matrix to a stream. | |
| template<index_t DIM, class FT > | |
| std::istream & | operator>> (std::istream &input, Matrix< DIM, FT > &m) |
| Reads a matrix from a stream. | |
| template<index_t DIM, class FT > | |
| void | mult (const Matrix< DIM, FT > &M, const FT *x, FT *y) |
| Multiplies a matrix by a vector. | |
A matrix type.
Matrix implements a square matrix of dimension DIM. containing coefficients of type T. Type T is expected to be a numeric type. Matrix provides the classical matrix operations.
| FT | type of the matrix elements |
| DIM | dimension of the matrix |
| typedef Matrix<DIM, FT> GEO::Matrix< DIM, FT >::matrix_type |
| typedef FT GEO::Matrix< DIM, FT >::value_type |
|
inline |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Gets the lower triangle of the matrix.
Gets all the coefficients of the matrix under the diagonal (included) to array store, Array store must be large enough to contain (DIM * (DIM+1))/2 values.
| [in] | store | an array of at least (DIM * (DIM+1))/2 values |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Gets a modifiable element.
Gets element at row i and column j in the matrix. If indices are out of range, the function calls abort().
| [in] | i | row index of the element |
| [in] | j | column index of the element |
i, j).
|
inline |
Gets a non-modifiable element.
Gets element at row i and column j in the matrix. If indices are out of range, the function calls abort().
| [in] | i | row index of the element |
| [in] | j | column index of the element |
i, j).
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
related |
Multiplies a matrix by a vector.
Multiplies matrix M by vector x and stores the result in vector y. Vectors x and y are given as arrays of elements and must at least contain DIM elements, otherwise the result is undefined.
| [in] | M | a DIM x DIM matrix |
| [in] | x | the input vector |
| [in] | y | the result of the multiplication |
| FT | the type of the matrix elements |
| DIM | the dimension of the matrix |
|
staticconstexpr |