C++: Get Size of Eigen::Matrix
Problem: I’m using the Eigen library in C++. I have a Matrix and want to check the size of it within my code. How can I do this?
Solution: The best way to go about this is to call the .rows() and .cols() functions on the Matrix. This will return the number of rows and columns in your matrix, respectively.
Here’s an example code snippet to show you how it might be implemented: