template<typename Derived>
class Eigen::MatrixBase< Derived >
Base class for all dense matrices, vectors, and expressions.
This class is the base that is inherited by all matrix, vector, and related expression types. Most of the Eigen API is contained in this class, and its base classes. Other important classes for the Eigen API are Matrix, and VectorwiseOp.
Note that some methods are defined in other modules such as the LU_Module LU module for all functions related to matrix inversions.
Template Parameters
Derived
is the derived type, e.g. a matrix type, or an expression, etc.
When writing a function taking Eigen objects as argument, if you want your function to take as argument any matrix, vector, or expression, just let it take a MatrixBase argument. As an example, here is a function printFirstRow which, given a matrix, vector, or expression x, prints the first row of x.
Pseudo expression representing a solving operation.
Definition Solve.h:63
This class can be extended with the help of the plugin mechanism described on the page TopicCustomizingEigen by defining the preprocessor symbol EIGEN_MATRIXBASE_PLUGIN.
This is the "in place" version of adjoint(): it replaces *this by its own transpose.
Thus, doing
m.adjointInPlace();
has the same effect on m as doing
m = m.adjoint().eval();
and is faster and also safer because in the latter line of code, forgetting the eval() results in a bug caused by aliasing.
Notice however that this method is only useful if you want to replace a matrix by its own adjoint. If you just need the adjoint of a matrix, use adjoint().
Note
if the matrix is not square, then *this must be a resizable matrix. This excludes (non-square) fixed-size matrices, block-expressions and maps.
Computation of matrix inverse and determinant, with invertibility check.
This is only for fixed-size square matrices of size up to 4x4.
Parameters
inverse
Reference to the matrix in which to store the inverse.
determinant
Reference to the variable in which to store the determinant.
invertible
Reference to the bool variable in which to store whether the matrix is invertible.
absDeterminantThreshold
Optional parameter controlling the invertibility check. The matrix will be declared invertible if the absolute value of its determinant is greater than this threshold.
Computation of matrix inverse, with invertibility check.
This is only for fixed-size square matrices of size up to 4x4.
Parameters
inverse
Reference to the matrix in which to store the inverse.
invertible
Reference to the bool variable in which to store whether the matrix is invertible.
absDeterminantThreshold
Optional parameter controlling the invertibility check. The matrix will be declared invertible if the absolute value of its determinant is greater than this threshold.
the cross product of *this and other using only the x, y, and z coefficients
The size of *this and other must be four. This function is especially useful when using 4D vectors instead of 3D ones to get advantage of SSE/AltiVec vectorization.
an expression of the DiagIndex-th sub or super diagonal of the matrix *this
*this is not required to be square.
The template parameter DiagIndex represent a super diagonal if DiagIndex > 0 and a sub diagonal otherwise. DiagIndex == 0 is equivalent to the main diagonal.
an expression of the DiagIndex-th sub or super diagonal of the matrix *this
*this is not required to be square.
The template parameter DiagIndex represent a super diagonal if DiagIndex > 0 and a sub diagonal otherwise. DiagIndex == 0 is equivalent to the main diagonal.
If the scalar type is complex numbers, then this function returns the hermitian (sesquilinear) dot product, conjugate-linear in the first variable and linear in the second variable.
\eigenvalues_module This function computes the eigenvalues with the help of the EigenSolver class (for real matrices) or the ComplexEigenSolver class (for complex matrices).
The eigenvalues are repeated according to their algebraic multiplicity, so there are as many eigenvalues as rows in the matrix.
The SelfAdjointView class provides a better algorithm for selfadjoint matrices.
the matrix or vector obtained by evaluating this expression.
Notice that in the case of a plain matrix or vector (not an expression) this function just returns a const reference, in order to avoid a useless copy.
Warning
Be carefull with eval() and the auto C++ keyword, as detailed in this page .
an expression of the identity matrix (not necessarily square).
The parameters rows and cols are the number of rows and of columns of the returned matrix. Must be compatible with this MatrixBase type.
This variant is meant to be used for dynamic-size matrix types. For fixed-size types, it is redundant to pass rows and cols as arguments, so Identity() should be used instead.
true if *this is approximately an unitary matrix, within the precision given by prec. In the case where the Scalar type is real numbers, a unitary matrix is an orthogonal matrix, whence the name.
Note
This can be used to check whether a family of vectors forms an orthonormal basis. Indeed, m.isUnitary() returns true if and only if the columns (equivalently, the rows) of m form an orthonormal basis.
an expression of the matrix product of *this and other without implicit evaluation.
The returned product will behave like any other expressions: the coefficients of the product will be computed once at a time as requested. This might be useful in some extremely rare cases when only a small and no coherent fraction of the result's coefficients have to be computed.
Warning
This version of the matrix product can be much much slower. So use it only if you know what you are doing and that you measured a true speed improvement.
the coefficient-wise norm of *this, that is, returns the p-th root of the sum of the p-th powers of the absolute values of the coefficients of *this. If p is the special value Eigen::Infinity, this function returns the norm, that is the maximum of the absolute values of the coefficients of *this.
Note
For matrices, this function does not compute the operator-norm. That is, if *this is a matrix, then its coefficients are interpreted as a 1D vector. Nonetheless, you can easily compute the 1-norm and -norm matrix operator norms using partial reductions .
a pseudo expression of *this with an operator= assuming no aliasing between *this and the source expression.
More precisely, noalias() allows to bypass the EvalBeforeAssignBit flag. Currently, even though several expressions may alias, only product expressions have this flag. Therefore, noalias() is only usefull when the source expression contains a matrix product.
On the other hand the following example will lead to a wrong result:
A.noalias() = A * B;
because the result matrix A is also an operand of the matrix product. Therefore, there is no alternative than evaluating A * B in a temporary, that is the default behavior when you write:
, for vectors, the l2 norm of *this, and for matrices the Frobenius norm. In both cases, it consists in the square root of the sum of the square of all the matrix entries. For vectors, this is also equals to the square root of the dot product of *this with itself.
\eigenvalues_module This function computes the L2 operator norm of a matrix, which is also known as the spectral norm. The norm of a matrix is defined to be
where the maximum is over all vectors and the norm on the right is the Euclidean vector norm. The norm equals the largest singular value, which is the square root of the largest eigenvalue of the positive semi-definite matrix .
The current implementation uses the eigenvalues of , as computed by SelfAdjointView::eigenvalues(), to compute the operator norm of a matrix. The SelfAdjointView class provides a better algorithm for selfadjoint matrices.
, for vectors, the squared l2 norm of *this, and for matrices the Frobenius norm. In both cases, it consists in the sum of the square of all the matrix entries. For vectors, this is also equals to the dot product of *this with itself.
the l2 norm of *this avoiding underflow and overflow. This version use a blockwise two passes algorithm: 1 - find the absolute largest coefficient s 2 - compute in a standard way
For architecture/scalar types supporting vectorization, this version is faster than blueNorm(). Otherwise the blueNorm() is much faster.
The size of *this must be at least 2. If the size is exactly 2, then the returned vector is a counter clock wise rotation of *this, i.e., (-y,x).normalized().