[Numpy-discussion] I've just commited a fast-clip function

Stefan van der Walt stefan at sun.ac.za
Fri Mar 30 11:22:33 EDT 2007


On Thu, Mar 29, 2007 at 11:21:07PM -0600, Travis Oliphant wrote:
> I would appreciate it, if people could test out the new clip function 
> and conjugate method to make sure they are working well.  All tests 
> pass, but there are some things we are not testing for.  I need to still 
> add the clip tests from ticket #425 --- unless somebody beats me to it.

Record arrays also cause problems, i.e.

import numpy as N

rec = N.array([(1.0, 2.0, 3.0), (5.0, 4.0, 3.0)],
              dtype=[('x', '<f8'), ('y', '<f8'), ('z', '<f8')])
rec['x'].clip(0,0.5)
                    
results in

==3839== Invalid read of size 4
==3839==    at 0x462FEDA: PyArray_Return (arrayobject.c:1472)
==3839==    by 0x464163B: array_clip (arraymethods.c:1645)
==3839==    by 0x80C2EF1: PyEval_EvalFrameEx (in /usr/bin/python2.5)
==3839==    by 0x80C37F4: PyEval_EvalCodeEx (in /usr/bin/python2.5)
==3839==    by 0x80C3866: PyEval_EvalCode (in /usr/bin/python2.5)
==3839==    by 0x80E2EEB: PyRun_FileExFlags (in /usr/bin/python2.5)
==3839==    by 0x80E31A6: PyRun_SimpleFileExFlags (in /usr/bin/python2.5)
==3839==    by 0x8056C83: Py_Main (in /usr/bin/python2.5)

==3839==    at 0x462FEF9: PyArray_Return (arrayobject.c:1474)
==3839==    by 0x464163B: array_clip (arraymethods.c:1645)
==3839==    by 0x80C2EF1: PyEval_EvalFrameEx (in /usr/bin/python2.5)
==3839==    by 0x80C37F4: PyEval_EvalCodeEx (in /usr/bin/python2.5)
==3839==    by 0x80C3866: PyEval_EvalCode (in /usr/bin/python2.5)
==3839==    by 0x80E2EEB: PyRun_FileExFlags (in /usr/bin/python2.5)
==3839==    by 0x80E31A6: PyRun_SimpleFileExFlags (in /usr/bin/python2.5)
==3839==    by 0x8056C83: Py_Main (in /usr/bin/python2.5)
==3839==    by 0x8056251: main (in /usr/bin/python2.5)

Cheers
Stéfan



More information about the NumPy-Discussion mailing list