This represents a matrix of arbitrary size (hence the X in MatrixXd), in which every entry is a double (hence the d in MatrixXd).
Matrix < typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime >
typedef Matrix < float, 3, 1 > Vector3f;
typedef Matrix < double, Dynamic, Dynamic > MatrixXd;
All Eigen matrices default to column-major storage order.
rows(), cols() and size().
use fixed sizes for very small sizes where you can, and use dynamic sizes for larger sizes or where you have to.
Therefore, the instruction a = a.transpose() does not replace a with its transpose(except multiplication)
the dot() and cross() methods.
The Array class provides general-purpose arrays.
Furthermore, the Array class provides an easy way to perform coefficient-wise operations.
Array < typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime >
For element-wise product?
Matrix expressions have an .array() method that ‘converts’ them into array expressions.
Array expressions have a .matrix() method
Array: coefficient wise
Individual columns and rows are special cases of blocks. Eigen provides methods to easily address them: .col() and .row().
The finished() method is necessary here to get the actual matrix object once the comma initialization of our temporary submatrix is done.
Partial reductions are applied with colwise() or rowwise() .
The concept behind broadcasting is similar to partial reduction.
You can use a Map object just like any other Eigen type:
Aliasing occurs more naturally when trying to shrink a matrix
a = a.transpose(); // !!! do NOT do this !!!
mat.bottomRightCorner(2,2) = mat.topLeftCorner(2,2).eval();
Eigen provides the special-purpose function transposeInPlace() which replaces a matrix by its transpose.
If an xxxInPlace() function is available, then it is best to use it, because it indicates more clearly what you are doing.
Thus, if matA is a squared matrix, then the statement matA = matA * matA;
Aliasing occurs when the same matrix or array coefficients appear both on the left- and the right-hand side of an assignment operator.
If the storage order is not specified, then Eigen defaults to storing the entry in column-major.