Skip to content

maxCoeff() returns -nan instead of max, while maxCoeff(&maxRow, &maxCol) works

Submitted by Karl

Assigned to Nobody

Link to original bugzilla bug (#564)

Description

I've got code that for reasons (well, errors i think) ends up leaving some "-nan" in a matrix I'm searching for max values in. But the two "maxCoeff(**)" calls return different values....
Not sure which version of Eigen is installed (one of the 3's I think) since I didn't do it.

When I call:

double mymax;
ArrayXXd smAry;
ArrayXXd::Index maxRow,maxCol;

mymax=smAry.maxCoeff();
mymax=smAry.maxCoeff(&maxRow, &maxCol);


smAry looks like (when output with cout<<smAry):
0 4 3 -nan
4 -nan 5 3
3 5 0 5
0 3 5 -nan

Output in mymax from first:
-nan
Output in mymax from 2nd command
5

Depends on

#1687 #1373 (closed)

Blocking

#814 (closed)

Edited by Rasmus Munk Larsen