Re: [eigen] Problem with g++-4.4 -O2 and Eigen3

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi,
sorry, but no, adding the 1 and/or the noalias doesn't change anything.

Here are some more interesting matrix multiplication results. In short, 3x3 * 3x9 gives a mess, while 3x9 * 9x3 and 9x3 * 3x9 does not.

Best, Boris

Eigen::Matrix<double,3,9> J;
J.fill(1.0);

std::cout << J << std::endl;
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1

std::cout << Eigen::Matrix3d::Identity()*J << std::endl;
-1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1
wrong!

std::cout << J.transpose()*J << std::endl;
3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3
correct!

std::cout << J*J.transpose() << std::endl;
9 9 9
9 9 9
9 9 9
correct!

Best, Boris

On 05/29/2011 05:08 PM, Gael Guennebaud wrote:
ok, so just like before, the default value of the multiplicative
factor alpha gets transformed into a -1.... that's really crasy.

Does that change anything if explicitly put a multiplicative factor, e.g.:

C.noalias() = 1 * A * B;

Regarding the matrix size, this is because for matrices smaller than 8
we use another product implementation.


gael


On Sun, May 29, 2011 at 2:45 PM, Boris Lau
<lau@xxxxxxxxxxxxxxxxxxxxxxxxxx>  wrote:
Hi folks,

after updating Eigen to the newest version in the repository, I now compile
my code with Eigen including the "no inlining of the GEBP product kernel"
change by Gael.

However, still a simple matrix multiplication goes awfully wrong when using
-O2 in g++-4.4:

// a code snipped
Eigen::Matrix<double,3,9>  J;
J.fill(1.0);
Eigen::Matrix<double,3,9>  Jprime = Eigen::Matrix3d::Identity() * J;
std::cout<<  "J\n"<<  J<<  std::endl;
std::cout<<  "Jprime\n"<<  Jprime<<  std::endl;

// output
J
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
Jprime
-1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1

As for Hauke, this only occurs only when used deeper inside a project, in
the main function it works alright. The problem also occurs for a matrix
size of 3x8, and disappears for 3x7 and smaller. Using dynamic sizes does
not help.
I also could not find a working order of .o files during linking.

Maybe the no onlining fix didn't go far enough?

Boris

--
Boris Lau

Albert-Ludwigs-University Freiburg
Institute of Computer Science, Autonomous Intelligent Systems Group
Georges-Koehler-Allee 079, D-79110 Freiburg, Germany

Building 079, Room 1005
Phone: +49 761 203-8012 | Mobile: +49 174 9436758
http://www.informatik.uni-freiburg.de/~lau







--
Boris Lau

Albert-Ludwigs-University Freiburg
Institute of Computer Science, Autonomous Intelligent Systems Group
Georges-Koehler-Allee 079, D-79110 Freiburg, Germany

Building 079, Room 1005
Phone: +49 761 203-8012 | Mobile: +49 174 9436758
http://www.informatik.uni-freiburg.de/~lau



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/