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.
The required function is in the file Eigen/src/core/ArithmeticSequence.h which is included in the general header Eigen/Core
. So #include "Eigen/Core
will suffice. (As @CuriouslyRecurringThoughts pointed out).
However, to address the confusion in his answer: ArithmeticSequences
such as Seq
are planned for Eigen version 3.4.0 So they are not present in versions prior to this. When I write this, the latest official release is 3.3.9 which thus doesn't support ArithmeticSequences
.
If you look in the official repo, you will find that the file is also not present for release 3.3.9 and earlier. Right now, it is only included in the 3.4.0-rc1
and master
branch.
So to answer your question: You are most likely using an older version of Eigen and you will need to use Eigen 3.4.0-rc1
or later.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With