|
| mat () |
| Default constructor.
|
|
template<typename Matrix > |
| mat (const Matrix &m) |
| Copy constructor.
|
|
template<typename T = Type> |
| mat (const std::initializer_list< std::initializer_list< T >> &rows) |
| Construct from a list of the rows.
|
|
template<typename Matrix > |
mat< Type, N, K > & | operator= (const Matrix &other) |
| Copy constructor.
|
|
void | make_zeroes () |
| Set all elements to zero.
|
|
template<typename Matrix > |
mat< Type, N, K > | operator+ (const Matrix &other) const |
| Matrix addition.
|
|
template<typename Matrix > |
mat< Type, N, K > | operator- (const Matrix &other) const |
| Matrix subtraction.
|
|
mat< Type, N, K > | operator* (Type scalar) const |
| Scalar multiplication.
|
|
mat< Type, N, K > | operator/ (Type scalar) const |
| Scalar division.
|
|
template<typename Vector > |
Vector | transform (const Vector &v) const |
| Transform a vector v by the matrix.
|
|
vec< Type, N > | transform (const vec< Type, K > &v) const |
| Transform a vector by the matrix.
|
|
vec< Type, N > | operator* (const vec< Type, K > &v) const |
| Transform a vector by the matrix.
|
|
template<unsigned int M> |
mat< Type, N, M > | mul (const mat< Type, K, M > &B) const |
| Matrix multiplication.
|
|
template<typename Matrix > |
Matrix | mul (const Matrix &B) const |
| Matrix multiplication by any matrix type.
|
|
template<typename Matrix > |
auto | operator* (const Matrix &B) const |
| Matrix multiplication.
|
|
template<typename Matrix > |
mat< Type, N, K > & | operator+= (const Matrix &other) |
| Matrix addition.
|
|
template<typename Matrix > |
mat< Type, N, K > & | operator-= (const Matrix &other) |
| Matrix subtraction.
|
|
mat< Type, N, K > & | operator*= (Type scalar) |
| Scalar multiplication.
|
|
mat< Type, N, K > & | operator/= (Type scalar) |
| Scalar division.
|
|
template<typename Matrix > |
mat< Type, N, K > & | operator*= (const Matrix &B) |
| Matrix multiplication.
|
|
mat< Type, N, K > & | transpose () |
| Transpose the matrix itself.
|
|
mat< Type, K, N > | transposed () const |
| Return the transposed matrix, without modifying the matrix itself.
|
|
Type & | at (unsigned int i, unsigned int j) |
| Access the element at the i-th row and j-th column.
|
|
const Type & | at (unsigned int i, unsigned int j) const |
| Access the element at the i-th row and j-th column.
|
|
Type & | operator() (unsigned int i, unsigned int j) |
| Access the element at the i-th row and j-th column.
|
|
const Type & | operator() (unsigned int i, unsigned int j) const |
| Get the element at the i-th row and j-th column.
|
|
Type | get (unsigned int i, unsigned int j) const |
| Get the element at the i-th row and j-th column.
|
|
auto | begin () |
| Get an iterator to the first element of the matrix.
|
|
auto | end () |
| Get an iterator to one plus the last element of the matrix.
|
|
auto | begin () const |
| Get a const iterator to the first element of the matrix.
|
|
auto | end () const |
| Get a const iterator to one plus the last element of the matrix.
|
|
TH_CONSTEXPR unsigned int | rows () const |
| Get the number of rows of the matrix.
|
|
TH_CONSTEXPR unsigned int | cols () const |
| Get the number of columns of the matrix.
|
|
unsigned int | size () const |
| Get the total number of elements of the matrix (rows * columns)
|
|
template<typename Matrix > |
bool | operator== (const Matrix &other) const |
| Check whether two matrices are equal element by element.
|
|
template<typename Matrix > |
bool | operator!= (const Matrix &other) const |
| Check whether two matrices are unequal element by element.
|
|
bool | is_square () const |
| Return whether the matrix is square.
|
|
bool | is_diagonal () const |
| Return whether the matrix is diagonal.
|
|
bool | is_symmetric () const |
| Return whether the matrix is symmetric.
|
|
real | density (real tolerance=1E-12) |
| Compute the density of the matrix, counting the proportion of non-zero (bigger in module than the given tolerance) elements with respect to the total number of elements. More...
|
|
real | sparsity (real tolerance=1E-12) |
| Compute the sparsity of the matrix, counting the proportion of zero (smaller in module than the given tolerance) elements with respect to the total number of elements. More...
|
|
Type | trace () |
| Compute the trace (sum of elements on the diagonal) of a square matrix.
|
|
Type | diagonal_product () |
| Compute the product of the diagonal elements of a square matrix.
|
|
Type | det () const |
| Compute the determinant of the matrix.
|
|
mat< Type, N, K > | inverse () const |
| Compute the inverse of a generic square matrix.
|
|
mat< Type, N, K > & | invert () |
| Invert a generic square matrix.
|
|
mat< Type, N, K > | resize (unsigned int n, unsigned int k) const |
| Compatibility function to allow for allocation or resizing of dynamic matrices. More...
|
|
std::string | to_string (std::string separator=", ", bool parenthesis=true) const |
| Convert the matrix to string representation.
|
|
| operator std::string () |
| Convert the matrix to string representation.
|
|
|
static mat< Type, N, K > | zeroes () |
| Get the null matrix.
|
|
static mat< Type, N, K > | identity () |
| Get the identity matrix.
|
|
static mat< Type, N, K > | diagonal (Type diag) |
| Get a diagonal matrix.
|
|
template<typename Vector = vec<real, N - 1>> |
static mat< Type, N, K > | translation (Vector &&t) |
| Get a 4x4 matrix which translates by {x, y, z}.
|
|
static mat< Type, N, K > | rotation_2d (real theta) |
| Get a matrix which rotates the 2D plane of <theta> radians.
|
|
static mat< Type, N, K > | rotation_3d_xaxis (real theta) |
| Get a matrix which rotates <theta> radians around the x axis.
|
|
static mat< Type, N, K > | rotation_3d_yaxis (real theta) |
| Get a matrix which rotates <theta> radians around the y axis.
|
|
static mat< Type, N, K > | rotation_3d_zaxis (real theta) |
| Get a matrix which rotates <theta> radians around the z axis.
|
|
template<typename Vector = vec<real, 3>> |
static mat< Type, N, K > | rotation_3d (real theta, Vector &&axis) |
| Get a matrix which rotates <theta> radians around the <axis> axis.
|
|
static mat< Type, N, K > | perspective (real left, real right, real bottom, real top, real near, real far) |
|
static mat< Type, N, K > | perspective_fov (real fov, real aspect, real near, real far) |
|
static mat< Type, N, K > | ortho (real left, real right, real bottom, real top, real near, real far) |
|
template<typename Vector1 , typename Vector2 , typename Vector3 > |
static mat< Type, 4, 4 > | look_at (const Vector1 &camera, const Vector2 &target, const Vector3 &up) |
| Return a 4x4 transformation matrix that points the field of view towards a given point from the <camera> point.
|
|
static mat< Type, N, K > | symplectic (unsigned int n=0, unsigned int k=0) |
| A symplectic NxN matrix, where \(N = 2K\) for some natural K.
|
|
template<typename Type = real, unsigned int N = 0, unsigned int K = 0>
class theoretica::mat< Type, N, K >
A generic matrix with a fixed number of rows and columns.
- Parameters
-
Type | The type of the elements |
N | The number of rows |
K | The number of columns |