
I keep running into this problem:
import numpy.matlib as M x = M.rand(3,3) x[1,1] = M.nan x
matrix([[ 0.94425407, 0.02216611, 0.999475 ], [ 0.40444129, nan, 0.23264341], [ 0.24202372, 0.05344269, 0.37967564]])
x.max()
0.379675636032 <---- Wrong (for me)
x[1,1] = 0 x.max()
0.999474999444 <----- Beautiful! Look at all the tripple digits!
How do I add nanmax as a method of the matrix class? How would I replace max with nanmax? Would I have to do that in every module of my package if I want to access numpy.matlib as M instead of packagename.M?

Keith Goodman <kwgoodman <at> gmail.com> writes:
matrix([[ 0.94425407, 0.02216611, 0.999475 ], [ 0.40444129, nan, 0.23264341], [ 0.24202372, 0.05344269, 0.37967564]])
x.max()
0.379675636032 <---- Wrong (for me)
x[1,1] = 0 x.max()
0.999474999444 <----- Beautiful! Look at all the tripple digits!
Works as expected with python2.4/numpy1.0
Christian
participants (2)
-
Christian
-
Keith Goodman