Question

I need to use the underlying arrays of several eigen matrices that could be RowMajor or ColumnMajor.

Is there any way to check which of the formats is used? (besides comparing the first column, with the first n elements of the row/column)

I found the isRowMajor as part of an Enum in the base class for Eigen, but I don't know how to access it from inside my code.

Was it helpful?

Solution

The following works for me (EigenMatrixType is anything derived from Eigen::MatrixBase)

EigenMatrixType M(...);   
std::cout<<"IsRowMajor?: "<<M.IsRowMajor

(edit: It seems to work also with SparseMatrix, even if i cannot find the enum in the the SparseMatrixBase documentation)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top