![]() Registered Member ![]()
|
Hi all,
I'm testing some code on the latest version of eigen (3.1.2). I expected that "*=" operators would work with array types but it sometimes compiles and sometimes doesn't as shown in the examples below.
If I use VectorXd instead of RowVectorXd, everything compiles fine. Is this a limitation because RowVectorXd is 1 x Dynamic while ArrayXd is Dynamic x 1? I general I have not had problems assigning a RowVectorXd to a VectorXd or vice versa. Thanks! Raman |
![]() Moderator ![]()
|
The issue is indeed that ArrayXd is Dynamic x 1. Assigning a row vector to a column vector is allowed though (that's the only exception). That's why a = v; and v = a; work. However, I agree that a = v.array(); and v = a.matrix(); should compile!!
|
![]() Registered Member ![]()
|
Thanks for the clarification! I'm using row vectors in all my code and it'll be a mess to change them to column vectors. Unfortunately there isn't an Array type of size 1 x Dynamic. Actually the code compiles if I define "a" as ArrayXXd(1, 3), so I guess that's a workaround:
But surprisingly it also works if a is defined as ArrayXXd(3, 1). Thanks, Raman |
![]() Moderator ![]()
|
You can define a 1D row array yourself:
typedef Array<double,1,Dynamic> RowArrayXd; |
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]