[Numpy-discussion] Re: round_() problems

Robert Kern robert.kern at gmail.com
Tue Mar 28 21:51:02 EST 2006


Webb Sprague wrote:
> Hi all,
> 
> numpy.__version__ = 0.9.4
> 
> (After my svd question, I hope to follow up with something a tad less
> silly.  Unfortunately, this a lot vaguer.)
> 
> I am getting the following backtrace when I try to round a matrix, but
> I am not sure why (it works in other places...)  Has anyone seen this
> error before, any explanation?  Anyway to get more information for
> diagnosis?
> 
> The function the traceback hits only sets up an html table of rounded
> matrix items, and it works for some matrices.  There is a possibility
> the matrix I am feeding it is messed up, which is why I wanted to
> print it....
> 
> Thanks, feel free to cc me as I read the list as a digest.
> 
> Begin traceback:
> 
> (import numpy as N)
> 
>  File "/var/www/localhost/htdocs/larry/LcUtil.py", line 120, in mat2table
>     outStr += '' + str(N.round_(item,prec)) + ''
> 
>   File "/usr/lib/python2.4/site-packages/numpy/core/oldnumeric.py",
> line 461, in round_
>     a = absolute(multiply(a, 10.**decimals))
> 
> TypeError: unsupported operand type(s) for ** or pow(): 'float' and
> 'numpy.ndarray'

Well, I haven't found an input that reproduces the bug. Can you try to find a
(small) input that does fail and post that?

-- 
Robert Kern
robert.kern at gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco





More information about the NumPy-Discussion mailing list