Consider the following code: ~~~ auto eye = MatrixXd::Identity(n, n); auto subeye_view = eye(irows, icols); // this compiles MatrixXd subeye_matrix = eye(irows, icols); // this DOES NOT compile ~~~ where `irows` and `icols` are some collection of indices. Please allow VectorXx and MatrixXx objects to be constructed from indexed views of vector and matrix expressions such as VectorXd::Ones, VectorXd::Zero, MatrixXd::Identity, etc.
Further info. If the indices irows and icols are of type VectorXi, then the following can be seen in the output from g++: Eigen/src/Core/CoreEvaluators.h:512:19: note: candidate template ignored: deduced conflicting types for parameter 'IndexType' ('int' vs. 'long') CoeffReturnType coeff(IndexType row, IndexType col) const After this, I decided to change the integer type of the indices from int to long. By having irows and icols of type: Eigen::Matrix<long, Eigen::Dynamic, 1> this fixed the compilation error. Thus, something in Eigen needs to be changed to support other integer types, and not only long. Hopefully this is something simple to do.
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1519.