This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Deduction of Eigen return type

Tags: None
(comma "," separated)
mmoller
Registered Member
Posts
16
Karma
0

Deduction of Eigen return type

Thu Apr 07, 2016 3:19 pm
Dear all,

can Eigen deduce its (optimal) return type?

Assume the following code
Code: Select all

typedef Eigen::Array<double,20,1> vector_fixed;

vector_fixed v1,v2;
v1.fill(1.0);
v2.fill(2.0);

// Compute expression (not vector)
auto tmp = v1+v2;

// Create new vector
vector_fixed a(tmp);


In the last line, does the expression tmp contain all information to deduce the (optimal/natural) resulting type?

Best regards,
Matthias
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
I'm not sure to understand your question, but tmp knows that it best evaluate to a Array<double,20,1> as available by decltype(tmp)::PlainObject which is also the return type of tmp.eval().
mmoller
Registered Member
Posts
16
Karma
0

Re: Deduction of Eigen return type

Fri Apr 08, 2016 10:30 am
ggael wrote:I'm not sure to understand your question, but tmp knows that it best evaluate to a Array<double,20,1> as available by decltype(tmp)::PlainObject which is also the return type of tmp.eval().


This is exactly the function I was looking for. Thank's a lot.


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient