From: Nadav H. <na...@vi...> - 2004-02-10 12:28:33
|
The repeat appears to accpt only short boolean array as repat counters: >>> A array([1, 2, 3]) >>> repeat(A, [1,1,1]) array([1, 2, 3]) >>> U =3D array([1,1,1], type=3DBool) >>> U array([1, 1, 1], type=3DBool) >>> repeat(A,U) # OK array([1, 2, 3]) >>> A =3D arange(100000) >>> U =3D ones(100000, type=3DBool) >>> AA =3D repeat(A,U) # U is too long --- an error is generated Traceback (most recent call last): File "<pyshell#90>", line 1, in -toplevel- AA =3D repeat(A,U) File "/usr/local/lib/python2.3/site-packages/numarray/generic.py", = line 1066, in repeat return _repeat(_nc.array(array), repeats) File "/usr/local/lib/python2.3/site-packages/numarray/generic.py", = line 1054, in _repeat newarray =3D array.__class__(shape=3Dnewshape, type=3Darray._type) ValueError: new_memory: invalid region size: -384. >>> U =3D ones(100000) # It is OK if U type is an integer >>> AA =3D repeat(A,U) >>> Nadav. |