Dense matrices in Eigen
#include <Eigen/Dense>
#include <iostream>
using MyDynamicMatrix = Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic>;
int main(int argc, char *argv[])
{
MyDynamicMatrix mdm = MyDynamicMatrix::Random(4,4);
std::cout << mdm << std::endl;
return 0;
}
• Eigen is a header only library, just include the
directory.
• We will see how to use CMake later.
• Dense matrices can be either dynamically
allocated or have a fixed size.
• Several types of scalar available, even
custom ones although not all are guaranteed
to be vectorized.
• Several ways to initialize a matrix, here we fill
it with random numbers.
• Row and Column vectors are simply normal
matrices with 1 row or 1 column.