问题
I am trying to index a matrix in indexes which follow an arithmetic sequence. According to the Eigen tutorial on the official website, I should use Eigen::seq(firstVal, lastVal, step) to generate this sequence. After calling this the error, as pasted in the title of this thread pops up.
I checked all the files of my local eigen folder, for the 'seq' method, but no luck. It wasn't anywhere. I guess this means that some file is missing, right?
Code goes smth like this.
Headers at the top
#include <iostream>
#include <string>
#include <chrono>
#include "Eigen/Dense"
#include "Eigen/Core"
#include <cmath>
#include <random>
m1(row, Eigen::seq(some_index*m1.cols(), some_index*m1.cols() + m1.cols()-1, step))= m2.block(row, 0, 1, m2.cols());
where of course, m1.cols() >> m2.cols()
Error output:
error: 'seq' is not a member of 'Eigen'
The expected result would be to get the row from matrix m2 (where m2.cols() < m1.cols()) and assign the row's values to certain indexes in the same row number of m1.
回答1:
After inspecting the official repo
https://bitbucket.org/eigen/eigen/src/default/
The required function is in the file Eigen/src/core/ArithmeticSequence.h
which is included in the general header Eigen/Core
already used in the snippet.
The issue seems to be that OP downloaded Eigen from a third-party repo not in sync with the main repo and the aforementioned file was missing.
I add this note for posterity: The latest stable release at the moment of writing is 3.3.7, released in 2018, (see http://eigen.tuxfamily.org/index.php?title=Main_Page), and does not include the file. So, if anybody else finds the same issue, please try to clone the official repo.
来源:https://stackoverflow.com/questions/57083605/error-while-compiling-eigen-program-error-seq-is-not-a-member-of-eigen