Error while compiling eigen program: error: 'seq' is not a member of 'Eigen'
Asked Answered
P

2

11

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.

Piscator answered 17/7, 2019 at 20:23 Comment(6)
Not an expert on Eigen, but looking at the repo, I think I found the function in bitbucket.org/eigen/eigen/raw/… . Do you have the file? Have you check the #define you have?Justajustemilieu
@Justajustemilieu this is strange! This file that you have sent a link to, is not part of the git repo of eigen, but it is part of the bitbucket repo. As e result it is not part of my files as well. I will try to change my sources and will see if it works out! Thanks!Piscator
It's part also of the github repo: github.com/eigenteam/eigen-git-mirror/blob/… , actually I found first the github repo, then I realized it was a mirror and I searched for the official repo. From which github repo did you get Eigen?Justajustemilieu
Oh snap! Yeah I used a third party mirror... Now I am getting some other errors, but I think this problem is solved, please comment below so that I can mark this thread as solved!Piscator
You mean that I should give an answer? Interestingly enough, though, the tar.gz available on the website do not provide the file.Justajustemilieu
@Justajustemilieu Yeah , apparently there are a ton of incorrect repos out there. I stumbled on some others with the same file missing.Piscator
J
11

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.

Justajustemilieu answered 17/7, 2019 at 21:51 Comment(4)
Backporting changes to 3.3.x would be quite cumbersome in many cases -- and generally, the stable branch mostly gets bug-fixes, but no new features. But yes, it has been a while since a new version of Eigen was released ... (btw: The official repo is a mercurial not a git repo)Forwarder
Thanks for the answer. I was having trouble using Eigen::all, which is pretty strange since I downloaded the .zip from the official website link of the latest release 3.3.7. After cloning another version from Github as you suggested, I was able to use this all operator.Ragout
So there is no way to slice arrays using operator() in the latest stable release of Eigen?Caputo
omg! Thanks for the answer! could have caused a lot of frustration.Stupor
N
5

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.

Nosewheel answered 14/4, 2021 at 14:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.