[Numpy-discussion] RuntimeWarning: numpy.ndarray size changed

2012-04-11 Thread Nils Wagner
Hi all,

Can someone reproduce the following message ?

Python 2.7.2 (default, Aug 19 2011, 20:41:43) [GCC] on 
linux2
Type help, copyright, credits or license for more 
information.
 import numpy
/home/nwagner/local/lib64/python2.7/site-packages/numpy/random/__init__.py:91: 
RuntimeWarning: numpy.ndarray size changed, may indicate 
binary incompatibility
   from mtrand import *
   numpy.__version__
'1.7.0.dev-9aac543'
 

Nils

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Evaluate bivariate polynomials

2011-10-19 Thread Nils Wagner
Hi all,

how do I evaluate a bivariate polynomial

p(x,y)=c_0 + c_1 x + c_2 y +c_3 x**2 + c_4 x*y+ c_5 y**2 + 
c_6 x**3 + c_7 x**2*y + c_8 x*y**2+c_9*y**3 + \dots

in numpy ?

In case of univariate polynomials I can use np.polyval.

Any pointer would be appreciated.

Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] genfromtxt

2011-10-11 Thread Nils Wagner
Hi all,

How do I use genfromtxt to read a file with the following 
lines

  11  2.2592365264892578D+01
  22  2.2592365264892578D+01
  13  2.669845581055D+00
  33  2.2592365264892578D+01
  24  2.669845581055D+00
  44  2.2592365264892578D+01
  35  2.669845581055D+00
  55  2.2592365264892578D+01
  46  2.669845581055D+00
  66  2.2592365264892578D+01
  17  2.9814243316650391D+00
  77  1.7259031295776367D+01
  28  2.9814243316650391D+00
  88  1.7259031295776367D+01
...


names =(i,j,v)
A = 
np.genfromtxt('bmll.mtl',dtype=[('i','int'),('j','int'),('v','d')],names=names)
V = A[:]['v']

 V
array([ NaN,  NaN,  NaN,  NaN,  NaN,  NaN,  NaN,  NaN, 
 NaN,  NaN,  NaN,
 NaN,  NaN,  NaN,  NaN,  NaN,  NaN,  NaN,  NaN, 
 NaN,  NaN,  NaN,
 NaN,  NaN,  NaN,  NaN,  NaN,  NaN,  NaN,  NaN, 
 NaN,  NaN,  NaN,
 NaN,  NaN,  NaN])

yields NaN, while

convertfunc = lambda x: x.replace('D','E')
names =(i,j,v)
A = 
np.genfromtxt('bmll.mtl',dtype=[('i','int'),('j','int'),('v','|S24')],names=names,converters={v:convertfunc})
V = A[:]['v'].astype(float)
 V
array([ 22.59236526,  22.59236526,   2.6698, 
 22.59236526,
  2.6698,  22.59236526,   2.6698, 
 22.59236526,
  2.6698,  22.59236526,   2.98142433, 
 17.2590313 ,
  2.98142433,  17.2590313 ,   2.98142433, 
  2.98142433,
  2.6698,  22.59236526,   2.98142433, 
  2.98142433,
  2.6698,  22.59236526,   2.98142433, 
  2.98142433,
  2.6698,  22.59236526,   2.98142433, 
  2.98142433,
  2.6698,  22.59236526,   2.98142433, 
  2.6698,
 17.2590313 ,   2.98142433,   2.6698, 
 17.2590313 ])


works fine.

Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] numpy.test() failure

2011-09-14 Thread Nils Wagner
ERROR: test_polyfit (test_polynomial.TestDocs)
--
Traceback (most recent call last):
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/lib/tests/test_polynomial.py,
 
line 106, in test_polyfit
 weights = arange(8,1,-1)**2/7.0
NameError: global name 'arange' is not defined

==
FAIL: Tests polyfit
--
Traceback (most recent call last):
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/ma/tests/test_extras.py,
 
line 622, in test_polyfit
 assert_almost_equal(a, a_)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/ma/testutils.py, 
line 155, in assert_almost_equal
 err_msg=err_msg, verbose=verbose)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/ma/testutils.py, 
line 221, in assert_array_almost_equal
 header='Arrays are not almost equal')
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/ma/testutils.py, 
line 186, in assert_array_compare
 verbose=verbose, header=header)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/testing/utils.py, 
line 677, in assert_array_compare
 raise AssertionError(msg)
AssertionError:
Arrays are not almost equal

(mismatch 100.0%)
  x: array([ 4.25134878,  1.14131297,  0.20519666, 
 0.01701   ])
  y: array([ 1.9345248 ,  0.49711011,  0.10202554, 
 0.00928034])
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] ValueError: Unknown format code 'g' for object of type 'str'

2011-03-26 Thread Nils Wagner
 numpy.__version__
'2.0.0.dev-10db259'

==
ERROR: Test the str.format method with NumPy scalar types
--
Traceback (most recent call last):
   File 
/home/nwagner/local/lib64/python2.6/site-packages/nose-0.11.2.dev-py2.6.egg/nose/case.py,
 
line 183, in runTest
 self.test(*self.arg)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/testing/decorators.py,
 
line 146, in skipper_func
 return f(*args, **kwargs)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/core/tests/test_print.py,
 
line 223, in test_scalar_format
 assert_equal(fmat.format(val), 
fmat.format(valtype(val)),
ValueError: Unknown format code 'g' for object of type 
'str'

  
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] NumPy speed tests by NASA

2011-02-24 Thread Nils Wagner
On Thu, 24 Feb 2011 14:26:01 -0500
  Frédéric Bastien no...@nouiz.org wrote:
 Hi,
 
 To print the information you can do:
 
 python -c 'import numpy;numpy.__config__.show()'
 
 You can access the info directly with:
 
 numpy.distutils.__config__.blas_opt_info['library_dirs']]
 numpy.distutils.__config__.blas_opt_info['libraries']]
 numpy.distutils.__config__.blas_opt_info['include_dirs']]
 
 This is what I do in Theano.
 
Fred

You can do

 from numpy import show_config
 show_config()
atlas_threads_info:
 libraries = ['lapack', 'ptf77blas', 'ptcblas', 
'atlas']
 library_dirs = 
['/home/nwagner/src/ATLAS3.8.2/mybuild/lib']
 define_macros = [('ATLAS_INFO', '\\3.8.2\\')]
 language = f77
 include_dirs = 
['/home/nwagner/src/ATLAS3.8.2/include']
blas_opt_info:
 libraries = ['ptf77blas', 'ptcblas', 'atlas']
 library_dirs = 
['/home/nwagner/src/ATLAS3.8.2/mybuild/lib']
 define_macros = [('ATLAS_INFO', '\\3.8.2\\')]
 language = c
 include_dirs = 
['/home/nwagner/src/ATLAS3.8.2/include']
atlas_blas_threads_info:
 libraries = ['ptf77blas', 'ptcblas', 'atlas']
 library_dirs = 
['/home/nwagner/src/ATLAS3.8.2/mybuild/lib']
 define_macros = [('ATLAS_INFO', '\\3.8.2\\')]
 language = c
 include_dirs = 
['/home/nwagner/src/ATLAS3.8.2/include']
lapack_opt_info:
 libraries = ['lapack', 'ptf77blas', 'ptcblas', 
'atlas']
 library_dirs = 
['/home/nwagner/src/ATLAS3.8.2/mybuild/lib']
 define_macros = [('ATLAS_INFO', '\\3.8.2\\')]
 language = f77
 include_dirs = 
['/home/nwagner/src/ATLAS3.8.2/include']
lapack_mkl_info:
   NOT AVAILABLE
blas_mkl_info:
   NOT AVAILABLE
mkl_info:
   NOT AVAILABLE

 
 On Tue, Feb 22, 2011 at 7:05 PM, Eli Stevens (Gmail)
 wickedg...@gmail.com wrote:
 On Tue, Feb 22, 2011 at 1:48 PM, Gael Varoquaux
 gael.varoqu...@normalesup.org wrote:
 Probably because the numpy binary that the author was 
using was compiled
 without a blas implementation, and just using numpy's 
internal
 lapack_lite. This is a common problem in real life.

 Is there an easy way to check from within numpy if it's 
using a blas
 iplementation or not?

 Thanks,
 Eli
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy.test() Program received signal SIGABRT, Aborted.

2010-12-02 Thread Nils Wagner
On Fri, 3 Dec 2010 00:42:16 -0700
  Charles R Harris charlesr.har...@gmail.com wrote:
 On Fri, Dec 3, 2010 at 12:29 AM, Nils Wagner
 nwag...@iam.uni-stuttgart.dewrote:
 
 Hi all,

 I have installed the latest version of numpy.

  numpy.__version__
 '2.0.0.dev-6aacc2d'


 
 I don't see that here or on the buildbots. There was a 
problem with
 segfaults that was fixed in commit
 c0e1cf27b55dfd5ahttps://github.com/numpy/numpy/commit/c0e1cf27b55dfd5aa4b1674a8c1b6ac38c36Can
 you check that your installation is clean, etc. Also, 
what platform
 are
 you running on?

I have removed the build directory.
Is it also neccessary to remove numpy in thr installation 
directory ?
  
/data/home/nwagner/local/lib/python2.5/site-packages/

Platform

2.6.18-92.el5 #1 SMP Tue Jun 10 18:51:06 EDT 2008 x86_64 
x86_64 x86_64 GNU/Linux

  
Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy.test() Program received signal SIGABRT, Aborted.

2010-12-02 Thread Nils Wagner
On Fri, 03 Dec 2010 08:47:32 +0100
  Nils Wagner nwag...@iam.uni-stuttgart.de wrote:
 On Fri, 3 Dec 2010 00:42:16 -0700
  Charles R Harris charlesr.har...@gmail.com wrote:
 On Fri, Dec 3, 2010 at 12:29 AM, Nils Wagner
 nwag...@iam.uni-stuttgart.dewrote:
 
 Hi all,

 I have installed the latest version of numpy.

  numpy.__version__
 '2.0.0.dev-6aacc2d'


 
 I don't see that here or on the buildbots. There was a 
problem with
 segfaults that was fixed in commit
 c0e1cf27b55dfd5ahttps://github.com/numpy/numpy/commit/c0e1cf27b55dfd5aa4b1674a8c1b6ac38c36Can
 you check that your installation is clean, etc. Also, 
what platform
 are
 you running on?
 
 I have removed the build directory.
 Is it also neccessary to remove numpy in thr 
installation 
 directory ?
  
 /data/home/nwagner/local/lib/python2.5/site-packages/
 
 Platform
 
 2.6.18-92.el5 #1 SMP Tue Jun 10 18:51:06 EDT 2008 x86_64 
 x86_64 x86_64 GNU/Linux
 
  
 Nils
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

  
I have also removed the numpy directory within 
/data/home/nwagner/local/lib/python2.5/site-packages/.
Now all tests pass.
Ran 3080 tests in 12.288s

OK (KNOWNFAIL=4, SKIP=1)
nose.result.TextTestResult run=3080 errors=0 failures=0

How is the build process implemented on the build bots ?

Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy.test() errors

2010-11-23 Thread Nils Wagner
On Tue, 23 Nov 2010 16:39:13 +0100
  Gerrit Holl gerrit.h...@gmail.com wrote:
 2010/11/23 Stéfan van der Walt ste...@sun.ac.za:
 On Tue, Nov 23, 2010 at 9:28 AM, Nils Wagner
 nwag...@iam.uni-stuttgart.de wrote:
 /data/home/nwagner/local/lib/python2.5/site-packages/numpy/lib/npyio.py,
 line 66, in seek_gzip_factory
     g.name = f.name
 AttributeError: GzipFile instance has no attribute 
'name'

 This one is mine--the change was made to avoid a 
deprecationwarning.
 Which version of Python are you using?
 
 I hope 2.5, as his site-packages directory is in 
lib/python2.5 :)
 

Exactly.
 Nils


  

  
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] numpy.test() errors

2010-11-22 Thread Nils Wagner
Hi all,

There are some new test errors

==
ERROR: Test with missing and filling values
--
Traceback (most recent call last):
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/lib/tests/test_io.py,
 
line 947, in test_user_filling_values
 test = np.genfromtxt(StringIO(data), **kwargs)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/lib/npyio.py, 
line 1285, in genfromtxt
 key = names.index(key)
AttributeError: 'tuple' object has no attribute 'index'

==
ERROR: test_user_missing_values (test_io.TestFromTxt)
--
Traceback (most recent call last):
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/lib/tests/test_io.py,
 
line 931, in test_user_missing_values
 **basekwargs)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/lib/npyio.py, 
line 1657, in mafromtxt
 return genfromtxt(fname, **kwargs)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/lib/npyio.py, 
line 1285, in genfromtxt
 key = names.index(key)
AttributeError: 'tuple' object has no attribute 'index'

==
ERROR: test_io.test_gzip_load
--
Traceback (most recent call last):
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/nose-0.11.1-py2.5.egg/nose/case.py,
 
line 183, in runTest
 self.test(*self.arg)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/lib/tests/test_io.py,
 
line 1255, in test_gzip_load
 assert_array_equal(np.load(f), a)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/lib/npyio.py, 
line 327, in load
 fid = seek_gzip_factory(file)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/lib/npyio.py, 
line 66, in seek_gzip_factory
 g.name = f.name
AttributeError: GzipFile instance has no attribute 'name'

--
Ran 3066 tests in 12.458s

FAILED (KNOWNFAIL=4, errors=3)
nose.result.TextTestResult run=3066 errors=3 failures=0


 numpy.__version__
'2.0.0.dev-12d0200'

Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] numpy.test() segfaults '2.0.0.dev8716'

2010-10-20 Thread Nils Wagner
test_duplicate_field_names_assign 
(test_regression.TestRegression) ...

FF
Program received signal SIGSEGV, Segmentation fault.
0x77b3077a in ?? () from 
/usr/lib64/libpython2.6.so.1.0
(gdb) bt
#0  0x77b3077a in ?? () from 
/usr/lib64/libpython2.6.so.1.0
#1  0x77b2ea3f in _PyArg_ParseTuple_SizeT ()
from /usr/lib64/libpython2.6.so.1.0
#2  0x762ce02e in VOID_getitem (ip=0x1583150 , 
ap=0x175f160)
 at numpy/core/src/multiarray/arraytypes.c.src:565
#3  0x762e64eb in array_toscalar (self=0x175f160,
 args=value optimized out) at 
numpy/core/src/multiarray/methods.c:554
#4  0x77b2165c in PyEval_EvalFrameEx ()
from /usr/lib64/libpython2.6.so.1.0
#5  0x77b26251 in PyEval_EvalCodeEx ()
from /usr/lib64/libpython2.6.so.1.0
#6  0x77b2103d in PyEval_EvalFrameEx ()
from /usr/lib64/libpython2.6.so.1.0
#7  0x77b26431 in PyEval_EvalCodeEx ()
from /usr/lib64/libpython2.6.so.1.0
#8  0x77af3db2 in ?? () from 
/usr/lib64/libpython2.6.so.1.0
#9  0x77ae7cb2 in PyObject_Call () from 
/usr/lib64/libpython2.6.so.1.0
#10 0x77b1fd26 in PyEval_CallObjectWithKeywords ()
from /usr/lib64/libpython2.6.so.1.0
#11 0x762c2184 in array_str (self=value optimized 
out)
 at numpy/core/src/multiarray/arrayobject.c:393
#12 0x77b002e8 in _PyObject_Str () from 
/usr/lib64/libpython2.6.so.1.0
#13 0x77b003ea in PyObject_Str () from 
/usr/lib64/libpython2.6.so.1.0
---Type return to continue, or q return to quit---q
Quit
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Schedule for 1.5.1?

2010-10-07 Thread Nils Wagner
On Thu, 7 Oct 2010 09:06:55 + (UTC)
  Pauli Virtanen p...@iki.fi wrote:
 Thu, 07 Oct 2010 16:34:46 +0800, Ralf Gommers wrote:
 [clip]
 A 1.5.1 release soon would be good. All the issues above 
are already
 committed, is there anything else that needs to go in? 
If not, I think
 an RC by the end of next week (10/17) and release by the 
end of the
 month should be possible.
 
 Sounds good to me.
 
 I don't remember any other critical bugs being 
present, but I can go 
 through the tickets during next WE in case there are 
some low-hanging 
 fruits.
 
   Pauli
 
  
However, there is an everlasting ticket opened 2 years ago

http://projects.scipy.org/numpy/ticket/937

Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] bug in ceil()

2010-10-06 Thread Nils Wagner
On Wed, 06 Oct 2010 19:55:00 +0200
  Christian Fischer cfisc...@itm.uni-stuttgart.de wrote:
 Hi All,
 
 I use numpy 1.4.1 on Debian squeeze amd64.
 
 I noticed that ceil() is not working properly.
 
 If the input to ceil() is a float I expect a float to be 
returned but for inputs
 in (-1.0, 0.0) the result is of type integer.
 
 In [65]: np.__version__
 Out[65]: '1.4.1'
 
 In [66]: np.ceil(-1.1)
 Out[66]: -1.0
 
 In [67]: np.ceil(-0.734)
 Out[67]: -0
 
 In [68]: np.ceil(-0.256)
 Out[68]: -0
 
 In [69]: np.ceil(-0.0)
 Out[69]: -0
 
 In [70]: np.ceil(0.2)
 Out[70]: 1.0
 
 Best wishes
 Christian
 
  
It's a float

 type(numpy.ceil(-0.4))
type 'numpy.float64'
 numpy.ceil(-0.4)
-0

Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] python setup.py bdist --format=rpm

2010-06-08 Thread Nils Wagner
Hi all,

I tried to build a rpm of numpy using

python setup.py bdist --format=rpm

removing 'numpy-2.0.0.dev8460' (and everything under it)
copying dist/numpy-2.0.0.dev8460.tar.gz - 
build/bdist.linux-x86_64/rpm/SOURCES
building RPMs
rpm -ba --define _topdir 
/data/home/nwagner/svn/numpy/build/bdist.linux-x86_64/rpm 
--clean build/bdist.linux-x86_64/rpm/SPECS/numpy.spec
-ba: unknown option
error: command 'rpm' failed with exit status 1

How can I fix the problem ?

Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Calling routines from a Fortran library using python

2010-03-11 Thread Nils Wagner
On Mon, 22 Feb 2010 22:18:23 +0900
  David Cournapeau courn...@gmail.com wrote:
 On Mon, Feb 22, 2010 at 10:01 PM, Nils Wagner
 nwag...@iam.uni-stuttgart.de wrote:
 

 ar x test.a
 gfortran -shared *.o -o libtest.so -lg2c

 to build a shared library. The additional option -lg2c 
was
 necessary due to an undefined symbol: s_cmp
 
 You should avoid the -lg2c option at any cost if 
compiling with
 gfortran. I am afraid that you got a library compiled 
with g77. If
 that's the case, you should use g77 and not gfortran. 
You cannot mix
 libraries built with one with libraries with another.
 

 Now I am able to load the shared library

 from ctypes import *
 my_lib = CDLL('test.so')

 What are the next steps to use the library functions
 within python ?
 
 You use it as you would use a C library:
 
 http://python.net/crew/theller/ctypes/tutorial.html
 
 But the fortran ABI, at least for code built with g77 
and gfortran,
 pass everything by reference. To make sure to pass the 
right
 arguments, I strongly suggest to double check with the 
.h you
 received.
 
 cheers,
 
 David
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

Hi all,

I tried to run the following script.
The result is a segmentation fault.
Did I use byref correctly ?

from ctypes import *
my_dsio = CDLL('libdsio20_gnu4.so')  # loading dynamic 
link libraries
#
# FORTRAN : CALL DSIO(JUNCAT,FDSCAT,IERR)
# 
# int 
I,J,K,N,IDE,IA,IE,IERR,JUNIT,JUNCAT,NDATA,NREC,LREADY,ONE=1;
# WordBUF[100],HEAD[30];
# char*PATH,*STRING;
# char*PGNAME,*DATE,*TIME,*TEXT;
# int LHEAD=30;
#
# C   : DSIO(JUNCAT,FDSCAT,IERR,strlen(FDSCAT));
#


IERR= c_int()
FDSCAT  = c_char_p('dscat.ds')
JUNCAT  = c_int()
LDSNCAT = c_int(len(FDSCAT.value))
print
print 'LDSNCAT', LDSNCAT.value
print 'FDSCAT' , FDSCAT.value  , len(FDSCAT.value)

my_dsio.dsio(byref(JUNCAT),byref(FDSCAT),byref(IERR),byref(LDSNCAT)) 
# segmentation fault
print IERR.value


Any idea ?

  Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Calling routines from a Fortran library using python

2010-03-11 Thread Nils Wagner
On Thu, 11 Mar 2010 13:42:43 +0100
  Dag Sverre Seljebotn da...@student.matnat.uio.no 
wrote:
 Nils Wagner wrote:
 On Thu, 11 Mar 2010 13:01:33 +0100
   Dag Sverre Seljebotn da...@student.matnat.uio.no 
 wrote:
   
 Nils Wagner wrote:
 
 On Mon, 22 Feb 2010 22:18:23 +0900
   David Cournapeau courn...@gmail.com wrote:
   
   
 On Mon, Feb 22, 2010 at 10:01 PM, Nils Wagner
 nwag...@iam.uni-stuttgart.de wrote:

 
 
 ar x test.a
 gfortran -shared *.o -o libtest.so -lg2c

 to build a shared library. The additional option -lg2c 
 was
 necessary due to an undefined symbol: s_cmp
   
   
 You should avoid the -lg2c option at any cost if 
 compiling with
 gfortran. I am afraid that you got a library compiled 
 with g77. If
 that's the case, you should use g77 and not gfortran. 
 You cannot mix
 libraries built with one with libraries with another.

 
 
 Now I am able to load the shared library

 from ctypes import *
 my_lib = CDLL('test.so')

 What are the next steps to use the library functions
 within python ?
   
   
 You use it as you would use a C library:

 http://python.net/crew/theller/ctypes/tutorial.html

 But the fortran ABI, at least for code built with g77 
 and gfortran,
 pass everything by reference. To make sure to pass the 
 right
 arguments, I strongly suggest to double check with the 
 .h you
 received.

 cheers,

 David
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion
 
 
 Hi all,

 I tried to run the following script.
 The result is a segmentation fault.
 Did I use byref correctly ?

 from ctypes import *
 my_dsio = CDLL('libdsio20_gnu4.so')  # loading 
 dynamic 
 link libraries
 #
 # FORTRAN : CALL DSIO(JUNCAT,FDSCAT,IERR)
 # 
 # int 
 I,J,K,N,IDE,IA,IE,IERR,JUNIT,JUNCAT,NDATA,NREC,LREADY,ONE=1;
 # WordBUF[100],HEAD[30];
 # char*PATH,*STRING;
 # char*PGNAME,*DATE,*TIME,*TEXT;
 # int LHEAD=30;
 #
 # C   : DSIO(JUNCAT,FDSCAT,IERR,strlen(FDSCAT));
 #


 IERR= c_int()
 FDSCAT  = c_char_p('dscat.ds')
 JUNCAT  = c_int()
 LDSNCAT = c_int(len(FDSCAT.value))
 print
 print 'LDSNCAT', LDSNCAT.value
 print 'FDSCAT' , FDSCAT.value  , len(FDSCAT.value)

 my_dsio.dsio(byref(JUNCAT),byref(FDSCAT),byref(IERR),byref(LDSNCAT)) 
 # segmentation fault
 print IERR.value


 Any idea ?
   
   
 You shouldn't have byref on FDSCAT nor LDSNCAT, as 
 explained by this line:

 # C   : DSIO(JUNCAT,FDSCAT,IERR,strlen(FDSCAT));

 Dag Sverre
 
   

 Sorry, I am newbie to C. What is the correct way ?

   
 
 my_dsio.dsio(byref(JUNCAT),FDSCAT,byref(IERR),LDSNCAT) 
 
 Dag


Great. It works like a charme.
How can I translate the following C-code into Python ?
I don't know how to handle HEAD and memcpy ?
Any pointer would be appreciated.

Thanks in advance.


   typedef union {
int i;
float   f;
charc[4];
} Word;

   int   
 I,J,K,N,IDE,IA,IE,IERR,JUNIT,JUNCAT,NDATA,NREC,LREADY,ONE=1;
   Word   BUF[100],HEAD[30];

   for (I=5;ILHEAD;I++)
HEAD[I].i = 0;
   HEAD[ 0].i =   1;
   HEAD[ 1].i =  LHEAD + NDATA*7;
   HEAD[ 2].i =  LHEAD;
   HEAD[ 3].i =  NDATA;
   HEAD[ 4].i =   7;
   memcpy (HEAD[ 7].c,DSIO,4);
   memcpy (HEAD[ 8].c,TEST,4);
   memcpy (HEAD[ 9].c,NPCO,4);
   memcpy (HEAD[10].c,,4);
   memcpy (HEAD[11].c,DSIO,4);
   HEAD[20].i =   1;
   HEAD[21].i =  NDATA;
   STRING = MM  RAD;
   DSEINH(STRING,HEAD[24].i,ONE,
 strlen(STRING));
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] NumPy SciPy with Snow Leopard 64-bit Py-2.6.4

2010-03-01 Thread Nils Wagner
On Mon, 1 Mar 2010 15:49:52 -0500
  josef.p...@gmail.com wrote:
 On Mon, Mar 1, 2010 at 3:23 PM, Tom Loredo 
lor...@astro.cornell.edu wrote:

 Just wanted to report qualified success installing NumPy 
 SciPy under
 a 64-bit build of Python-2.6.4 (universal framework) on 
OS X 10.6.2
 (current Snow Leopard).  I am using the current SVN 
checkouts
 (numpy r8270, scipy r6250).

 NumPy has installed successfully for some time now and 
the current
 SVN maintains this:

 numpy.test()
 ..
 Ran 2521 tests in 8.518s
 OK (KNOWNFAIL=4, SKIP=1)

 SciPy has been causing me problems for weeks with 
segfaults with
 IFFT tests, as reported on scipy-dev (no one ever 
responded to
 this so I made no progress in diagnosing it):

 http://mail.scipy.org/pipermail/scipy-dev/2010-February/013921.html

 However, r6250 now runs scipy.test() without segfault, 
though with
 22 errors and 2 failures.  The full tests give:

 scipy.test('full')
 ..
 Ran 4982 tests in 652.478s
 FAILED (KNOWNFAIL=13, SKIP=27, errors=22, failures=6)

 I am not familiar with what many of the tests are 
covering, so I
 cannot assess the severity of all the errors and 
failures.  Some
 of them seem to be bugs in the tests (e.g., use of an 
unexpected
 keyword new in several histogram tests);
 
 np.histogram(rvs,histsupp,new=True)
 
 this still needs to be changed in scipy.stats, because 
new keyword has
 been removed in numpy trunk 2 weeks ago.
 
 Josef
 
 others are innocuous
 (e.g., missing PIL, which I haven't installed yet). 
 I've posted
 the report here:

 http://www.pastie.org/848651

 I'd appreciate comments on which issues are nontrivial 
and
 deserve attention to as a SciPy user.  E.g., the first 
error
 is in an lapack test and involves a ValueError where 
infs or
 NaNs appear where they shouldn't.  Is this a bug in the 
test,
 or does it indicate a 64-bit issue that is making 
inf/NaN
 appear where it shouldn't?  E.g., there are arpack 
errors,
 but I don't know what the Error info=-8 message 
signifies.
 Other arpack errors are due to large solution 
mismatches,
 which I presume are serious and deserve attention.

 Thanks,
 Tom Loredo



Last but not least there is an annoying bug lurking around 
for 17 months
http://projects.scipy.org/numpy/ticket/937
  
Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Calling routines from a Fortran library using python

2010-02-23 Thread Nils Wagner
On Mon, 22 Feb 2010 22:18:23 +0900
  David Cournapeau courn...@gmail.com wrote:
 On Mon, Feb 22, 2010 at 10:01 PM, Nils Wagner
 nwag...@iam.uni-stuttgart.de wrote:
 

 ar x test.a
 gfortran -shared *.o -o libtest.so -lg2c

 to build a shared library. The additional option -lg2c 
was
 necessary due to an undefined symbol: s_cmp
 
 You should avoid the -lg2c option at any cost if 
compiling with
 gfortran. I am afraid that you got a library compiled 
with g77. If
 that's the case, you should use g77 and not gfortran. 
You cannot mix
 libraries built with one with libraries with another.
 

 Now I am able to load the shared library

 from ctypes import *
 my_lib = CDLL('test.so')

 What are the next steps to use the library functions
 within python ?
 
 You use it as you would use a C library:
 
 http://python.net/crew/theller/ctypes/tutorial.html
 
 But the fortran ABI, at least for code built with g77 
and gfortran,
 pass everything by reference. To make sure to pass the 
right
 arguments, I strongly suggest to double check with the 
.h you
 received.
 
 cheers,
 
 David
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

Just to play it safe

Consider

extern void dsio(int* const,const char* const,
 int* const,const size_t);
extern void dsrhed  (const int* const,const int* 
const,void* const,
 const int* const,const int* const,int* const,
 int* const,int* const,int* const,int* const,
 int* const,int* const,int* const);
  


from ctypes import *
my_lib = CDLL('libtest.so')

How do I call the functions within python
I mean what arguments are needed ?

my_lib.dsio()

my_lib.dsrhed(   )

Thank you very much for your help.

Cheers,
Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Calling routines from a Fortran library using python

2010-02-22 Thread Nils Wagner
On Thu, 18 Feb 2010 22:29:39 +0900
  David Cournapeau courn...@gmail.com wrote:
 On Thu, Feb 18, 2010 at 10:22 PM, Nils Wagner
 nwag...@iam.uni-stuttgart.de wrote:
 On Thu, 18 Feb 2010 11:55:07 +0100
  Matthieu Brucher matthieu.bruc...@gmail.com wrote:
 Ok I have extracted the *.o files from the static
library.

 Applying the file command to the object files yields

 ELF 64-bit LSB relocatable, AMD x86-64, version 1
(SYSV),
 not stripped

 What's that supposed to mean ?

 It means that each object file is an object file
compiled with -fPIC,
 so you just have to make a shared library (gfortran
-shared *.o -o
 libmysharedlibrary.so)

 Then, you can try to open the library with ctypes. If
something is
 lacking, you may have to add -lsome_library to the
gfortran line.

 Matthieu
 --
 Information System Engineer, Ph.D.
 Blog: http://matt.eifelle.com
 LinkedIn: http://www.linkedin.com/in/matthieubrucher

 O.k. I tried

 gfortran -shared *.o -o libmysharedlibrary.so

 /usr/bin/ld: dxop.o: relocation R_X86_64_32 against `a
 local symbol' can not be used when making a shared 
object;
 recompile with -fPIC
 
 The message is pretty explicit: it is not compiled with 
-fPIC, there
 is nothing you can do, short of requesting a shared 
library from the
 software vendor.
 
 David
  
Hi,

Meanwhile I received a static library (including -fPIC 
support) from the software vendor.
Now I have used

ar x test.a
gfortran -shared *.o -o libtest.so -lg2c

to build a shared library. The additional option -lg2c was 
necessary due to an undefined symbol: s_cmp

Now I am able to load the shared library

from ctypes import *
my_lib = CDLL('test.so')

What are the next steps to use the library functions 
within python ?

Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Calling routines from a Fortran library using python

2010-02-22 Thread Nils Wagner
On Mon, 22 Feb 2010 22:18:23 +0900
  David Cournapeau courn...@gmail.com wrote:
 On Mon, Feb 22, 2010 at 10:01 PM, Nils Wagner
 nwag...@iam.uni-stuttgart.de wrote:
 

 ar x test.a
 gfortran -shared *.o -o libtest.so -lg2c

 to build a shared library. The additional option -lg2c 
was
 necessary due to an undefined symbol: s_cmp
 
 You should avoid the -lg2c option at any cost if 
compiling with
 gfortran. I am afraid that you got a library compiled 
with g77. If
 that's the case, you should use g77 and not gfortran. 
You cannot mix
 libraries built with one with libraries with another.
 

g77 -shared *.o -o libtest.so -lg2c

failed with

/usr/lib/64/gcc-lib/x86_64-suse-linux/3.3.5/../../../../x86_64-suse-linux/bin/ld:
 
cannot find -lgcc_s

IIRC that is a known bug related to SuSE .

Are you aware of a solution ?

Cheers,
 Nils



 Now I am able to load the shared library

 from ctypes import *
 my_lib = CDLL('test.so')

 What are the next steps to use the library functions
 within python ?
 
 You use it as you would use a C library:
 
 http://python.net/crew/theller/ctypes/tutorial.html
 
 But the fortran ABI, at least for code built with g77 
and gfortran,
 pass everything by reference. To make sure to pass the 
right
 arguments, I strongly suggest to double check with the 
.h you
 received.
 
 cheers,
 
 David
  
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] numpy.test() failures in 2.0.0.dev8233

2010-02-21 Thread Nils Wagner

==
FAIL: 
test_multiarray.TestNewBufferProtocol.test_export_endian
--
Traceback (most recent call last):
   File 
/home/nwagner/local/lib64/python2.6/site-packages/nose-0.11.2.dev-py2.6.egg/nose/case.py,
 
line 183, in runTest
 self.test(*self.arg)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/core/tests/test_multiarray.py,
 
line 1582, in test_export_endian
 assert y.format in 'l'
AssertionError

==
FAIL: 
test_multiarray.TestNewBufferProtocol.test_export_record
--
Traceback (most recent call last):
   File 
/home/nwagner/local/lib64/python2.6/site-packages/nose-0.11.2.dev-py2.6.egg/nose/case.py,
 
line 183, in runTest
 self.test(*self.arg)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/core/tests/test_multiarray.py,
 
line 1561, in test_export_record
 assert y.format == 
'T{b:a:=h:b:=l:c:=q:d:B:e:=H:f:=L:g:=Q:h:=d:i:=d:j:=g:k:4s:l:=4w:m:3x:n:?:o:}'
AssertionError

==
FAIL: 
test_multiarray.TestNewBufferProtocol.test_export_simple_1d
--
Traceback (most recent call last):
   File 
/home/nwagner/local/lib64/python2.6/site-packages/nose-0.11.2.dev-py2.6.egg/nose/case.py,
 
line 183, in runTest
 self.test(*self.arg)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/core/tests/test_multiarray.py,
 
line 1514, in test_export_simple_1d
 assert y.format == '=l'
AssertionError

==
FAIL: 
test_multiarray.TestNewBufferProtocol.test_export_subarray
--
Traceback (most recent call last):
   File 
/home/nwagner/local/lib64/python2.6/site-packages/nose-0.11.2.dev-py2.6.egg/nose/case.py,
 
line 183, in runTest
 self.test(*self.arg)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/core/tests/test_multiarray.py,
 
line 1576, in test_export_subarray
 assert y.itemsize == 16
AssertionError

--
Ran 2519 tests in 21.494s

FAILED (KNOWNFAIL=4, failures=4)
nose.result.TextTestResult run=2519 errors=0 failures=4


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Request for testing

2010-02-21 Thread Nils Wagner
On Sun, 21 Feb 2010 03:30:31 -0700
  Charles R Harris charlesr.har...@gmail.com wrote:
 Hi All,
 
 I would be much obliged if some folks would run the 
attached script and
 report the output, numpy version, and python version. It 
just runs
 np.isinf(np.inf), which raises an invalid value 
warning with current
 numpy. As far as I can see the function itself hasn't 
changed since
 numpy1.3, yet numpy1.3  python2.5 gives no such 
warning.
 
 Chuck

python -i isinf.py
2.0.0.dev8233
2.6.2

  
import numpy as np
import warnings
import platform
print np.__version__
print platform.python_version()
warnings.simplefilter('always')
np.seterr(invalid='print')
print (np.isinf(np.inf))

Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy.test() failures in 2.0.0.dev8233

2010-02-21 Thread Nils Wagner
On Sun, 21 Feb 2010 13:22:41 +0200
  Pauli Virtanen p...@iki.fi wrote:
 Hi,
 
 Please remind me what platform you are running on. Also, 
please update
 and re-run the tests, and check the output from
 
 import numpy as np
 from numpy.core.multiarray import memorysimpleview as 
memoryview
 
 dt = [('a', np.int8), ('b', np.int16),
  ('c', np.int32), ('d', np.int64),
  ('e', np.uint8), ('f', np.uint16),
  ('g', np.uint32), ('h', np.uint64),
  ('i', np.float), ('j', np.double),
  ('k', np.longdouble), ('l', 'S4'),
  ('m', 'U4'), ('n', 'V3'), ('o', '?')]
 x = np.array([(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 '', '', '   ', True)], dtype=dt)
 print memoryview(x).format
 
 x = np.array([1,2,3], dtype='i4')
 print memoryview(x).format
 
 x = np.array(([[1,2],[3,4]],), dtype=[('a', (int, 
(2,2)))])
 print memoryview(x).format
 print memoryview(x).itemsize
 
 
 

T{b:a:=h:b:=i:c:=l:d:B:e:=H:f:=I:g:=L:h:=d:i:=d:j:=g:k:4s:l:=4w:m:3x:n:?:o:}
i
T{(2,2)=l:a:}
32
Linux-2.6.31.12-0.1-default-x86_64-with-SuSE-11.2-x86_64
2.0.0.dev8235

Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Calling routines from a Fortran library using python

2010-02-18 Thread Nils Wagner
Hi all,

I have a static  library (*.a) compiled by gfortran but no 
source files.
How can I call routines from that library using python ?

Any pointer would be appreciated.

Thanks in advance.

  Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Calling routines from a Fortran library using python

2010-02-18 Thread Nils Wagner
On Thu, 18 Feb 2010 18:32:18 +0900
  David Cournapeau da...@silveregg.co.jp wrote:
 Nils Wagner wrote:
 Hi all,
 
 I have a static  library (*.a) compiled by gfortran but 
no 
 source files.
 How can I call routines from that library using python ?
 
 Is there any kind of interface (.h, etc...) ? If this is 
a proprietary 
 library, there has to be something so that it can be 
called from C, and 
 anything that can be called from C can be called from 
python. If you 
 don't know at least the functions signatures, it will be 
very difficult 
 (you would have to disassemble the code to find how the 
functions are 
 called, etc...).
 
 cheers,
 
 David
  
Hi David,

you are right. It's a proprietary library.
I found a header file (*.h) including prototype 
declarations of externally callable procedures.

How can I proceed ?

Thank you again.

Cheers,

Nils

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Calling routines from a Fortran library using python

2010-02-18 Thread Nils Wagner
On Thu, 18 Feb 2010 10:15:51 + (UTC)
  Neil Crighton neilcrigh...@gmail.com wrote:
 Nils Wagner nwagner at iam.uni-stuttgart.de writes:
 
 Hi David,
 
 you are right. It's a proprietary library.
 I found a header file (*.h) including prototype 
 declarations of externally callable procedures.
 
 How can I proceed ?
 
 Apparently you can use ctypes to access fortran 
libraries. See the first
 paragraph of:
 
 http://www.sagemath.org/doc/numerical_sage/ctypes.html
 
 You may have to convert the .a library to a .so library.
 
 
 Neil
  
How do I convert the .a library to a .so library ?

Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Calling routines from a Fortran library using python

2010-02-18 Thread Nils Wagner
On Thu, 18 Feb 2010 19:21:03 +0900
  David Cournapeau da...@silveregg.co.jp wrote:
 Nils Wagner wrote:
 On Thu, 18 Feb 2010 18:32:18 +0900
   David Cournapeau da...@silveregg.co.jp wrote:
 Nils Wagner wrote:
 Hi all,

 I have a static  library (*.a) compiled by gfortran but 
 no 
 source files.
 How can I call routines from that library using python ?
 Is there any kind of interface (.h, etc...) ? If this is 
 a proprietary 
 library, there has to be something so that it can be 
 called from C, and 
 anything that can be called from C can be called from 
 python. If you 
 don't know at least the functions signatures, it will be 
 very difficult 
 (you would have to disassemble the code to find how the 
 functions are 
 called, etc...).

 cheers,

 David
   
 Hi David,
 
 you are right. It's a proprietary library.
 I found a header file (*.h) including prototype 
 declarations of externally callable procedures.
 
 How can I proceed ?
 
 Exactly as you would do for a C library (ctypes, cython, 
by hand, swig, 
 etc...). Once you have the header (plus the C-Fortran 
ABI convention, 
 which depend on your compilers and platforms), it is 
exactly as calling 
 a C function in a C library,
 
 cheers,
 
 David
  
To be honest that's over my head. I mean I have never used 
C before.
Where can I find a step-by-step example for my task ?

Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Calling routines from a Fortran library using python

2010-02-18 Thread Nils Wagner
On Thu, 18 Feb 2010 19:30:10 +0900
  David Cournapeau da...@silveregg.co.jp wrote:
 Nils Wagner wrote:
 
 How do I convert the .a library to a .so library ?
 
 You first uncompress the .a into a temporary 
directory, with ar x on 
 Linux. Then, you group the .o together with gfortran 
-shared 
 $LIST_OF_OBJECT + a few options. You can also look at 
how Atlas does it 
 in its makefile.
 
 As Matthieu mentioned, if the .o are not compiled with 
-fPIC, you are 
 screwed on 64 bits architectures (unless you statically 
link numpy in 
 your python interpreter, but I doubt you want to go that 
road). It would 
 be somewhat surprising if your vendor did not shared 
libraries 
 available, though.
 
 cheers,
 
 David

Ok I have extracted the *.o files from the static library.

Applying the file command to the object files yields

ELF 64-bit LSB relocatable, AMD x86-64, version 1 (SYSV), 
not stripped

What's that supposed to mean ?

Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Calling routines from a Fortran library using python

2010-02-18 Thread Nils Wagner
On Thu, 18 Feb 2010 11:55:07 +0100
  Matthieu Brucher matthieu.bruc...@gmail.com wrote:
 Ok I have extracted the *.o files from the static 
library.

 Applying the file command to the object files yields

 ELF 64-bit LSB relocatable, AMD x86-64, version 1 
(SYSV),
 not stripped

 What's that supposed to mean ?
 
 It means that each object file is an object file 
compiled with -fPIC,
 so you just have to make a shared library (gfortran 
-shared *.o -o
 libmysharedlibrary.so)
 
 Then, you can try to open the library with ctypes. If 
something is
 lacking, you may have to add -lsome_library to the 
gfortran line.
 
 Matthieu
 -- 
 Information System Engineer, Ph.D.
 Blog: http://matt.eifelle.com
 LinkedIn: http://www.linkedin.com/in/matthieubrucher
  
O.k. I tried

gfortran -shared *.o -o libmysharedlibrary.so

/usr/bin/ld: dxop.o: relocation R_X86_64_32 against `a 
local symbol' can not be used when making a shared object; 
recompile with -fPIC
dscpde.o: could not read symbols: Bad value

Any idea ?

Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Calling routines from a Fortran library using python

2010-02-18 Thread Nils Wagner
On Thu, 18 Feb 2010 15:32:12 +0100
  Dag Sverre Seljebotn da...@student.matnat.uio.no 
wrote:
 David Cournapeau wrote:
 On Thu, Feb 18, 2010 at 10:22 PM, Nils Wagner
 nwag...@iam.uni-stuttgart.de wrote:
   
 On Thu, 18 Feb 2010 11:55:07 +0100
  Matthieu Brucher matthieu.bruc...@gmail.com wrote:
 
 Ok I have extracted the *.o files from the static
 library.

 Applying the file command to the object files yields

 ELF 64-bit LSB relocatable, AMD x86-64, version 1
 (SYSV),
 not stripped

 What's that supposed to mean ?
 
 It means that each object file is an object file
 compiled with -fPIC,
 so you just have to make a shared library (gfortran
 -shared *.o -o
 libmysharedlibrary.so)

 Then, you can try to open the library with ctypes. If
 something is
 lacking, you may have to add -lsome_library to the
 gfortran line.

 Matthieu
 --
 Information System Engineer, Ph.D.
 Blog: http://matt.eifelle.com
 LinkedIn: http://www.linkedin.com/in/matthieubrucher
   
 O.k. I tried

 gfortran -shared *.o -o libmysharedlibrary.so

 /usr/bin/ld: dxop.o: relocation R_X86_64_32 against `a
 local symbol' can not be used when making a shared 
object;
 recompile with -fPIC
 

 The message is pretty explicit: it is not compiled with 
-fPIC, there
 is nothing you can do, short of requesting a shared 
library from the
 software vendor.
   
 Well, I think one can make a static executable with C or 
Cython and 
 embed the Python interpreter. But it is pretty 
complicated stuff, and 
 requesting a shared library is vastly preferable.
 
 Dag Sverre
 
  
Can you shed light on your approach ?

Nils



___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Floating exception

2010-01-21 Thread Nils Wagner
On Thu, 21 Jan 2010 10:04:56 +0900
  David Cournapeau da...@silveregg.co.jp wrote:
 Nils Wagner wrote:
 Hi all,
 
 I found a strange problem when I try to import numpy
 
 python -v
 import numpy
 ...
 dlopen(/data/home/nwagner/local/lib/python2.5/site-packages/numpy/core/multiarray.so,
  
 2);
 Floating exception
   
 Any idea ?
 
 Could you get a traceback (ideally making sure numpy is 
built with debug 
 symbols - having -g in both CFLAGS and LDFLAGS) ?
 
 Having it happening inside the dlopen call is a bit 
weird, I can't see 
 what could cause it,
 
 cheers,
 
 David

Hi David,

Thank you for your response.
I switched from CentOS 4.2 to CentOS 5.2
Here is the output of

gdb python
run -v
# 
/data/home/nwagner/local/lib/python2.5/site-packages/site.pyc 
has bad magic
...

What is the meaning of 'bad magic' ?

Should I start with a clean 
/data/home/nwagner/local/lib/python2.5/site-packages ?

Cheers,
Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Floating exception

2010-01-21 Thread Nils Wagner
On Thu, 21 Jan 2010 23:35:29 +0900
  David Cournapeau courn...@gmail.com wrote:
 On Thu, Jan 21, 2010 at 8:36 PM, Nils Wagner
 nwag...@iam.uni-stuttgart.de wrote:
 On Thu, 21 Jan 2010 10:04:56 +0900
  David Cournapeau da...@silveregg.co.jp wrote:
 Nils Wagner wrote:
 Hi all,

 I found a strange problem when I try to import numpy

 python -v
 import numpy
 ...
 dlopen(/data/home/nwagner/local/lib/python2.5/site-packages/numpy/core/multiarray.so,
 2);
 Floating exception

 Any idea ?

 Could you get a traceback (ideally making sure numpy is
built with debug
 symbols - having -g in both CFLAGS and LDFLAGS) ?

 Having it happening inside the dlopen call is a bit
weird, I can't see
 what could cause it,

 cheers,

 David

 Hi David,

 Thank you for your response.
 I switched from CentOS 4.2 to CentOS 5.2
 Here is the output of

 gdb python
 run -v
 #
 /data/home/nwagner/local/lib/python2.5/site-packages/site.pyc
 has bad magic
 ...

 What is the meaning of 'bad magic' ?
 
 It seems that the bad magic is coming from python, which 
would most
 likely mean the site.pyc bytecode is not compatible with 
the run
 python. This is independent of your problem I think,
 
 David

O.k. here is some more information ...

# can't create 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/core/info.pyc
dlopen(/data/home/nwagner/local/lib/python2.5/site-packages/numpy/core/multiarray.so,
 
2);

Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread 182894183648 (LWP 22301)]
0x00350e8074d7 in do_lookup_x () from 
/lib64/ld-linux-x86-64.so.2
(gdb) bt
#0  0x00350e8074d7 in do_lookup_x () from 
/lib64/ld-linux-x86-64.so.2
#1  0x00350e80789e in _dl_lookup_symbol_x () from 
/lib64/ld-linux-x86-64.so.2
#2  0x00350e808c70 in _dl_relocate_object () from 
/lib64/ld-linux-x86-64.so.2
#3  0x00350f7f7ac8 in dl_open_worker () from 
/lib64/tls/libc.so.6
#4  0x00350e80aab0 in _dl_catch_error () from 
/lib64/ld-linux-x86-64.so.2
#5  0x00350f7f845a in _dl_open () from 
/lib64/tls/libc.so.6
#6  0x00350fc01054 in dlopen_doit () from 
/lib64/libdl.so.2

Any idea ?

 Nils
  
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Floating exception

2010-01-20 Thread Nils Wagner
Hi all,

I found a strange problem when I try to import numpy

python -v
 import numpy
...
dlopen(/data/home/nwagner/local/lib/python2.5/site-packages/numpy/core/multiarray.so,
 
2);
Floating exception
  
Any idea ?

Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] svn log and blank entries

2010-01-15 Thread Nils Wagner
Hi all,

An svn log  CHANGELOG in svn/numpy yields some blank 
entries
Is that intended ?



r8055 | ariver | 2010-01-15 03:02:30 +0100 (Fr, 15 Jan 
2010) | 1 line

_

r8054 | ariver | 2010-01-15 02:57:56 +0100 (Fr, 15 Jan 
2010) | 1 line

_

r8053 | ariver | 2010-01-15 02:51:02 +0100 (Fr, 15 Jan 
2010) | 1 line

_
  
Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] ipython

2010-01-15 Thread Nils Wagner
Hi all,

I tried to install ipython via bzr
If I run iypthon I get
ipython
Traceback (most recent call last):
   File /home/nwagner/local/bin/ipython, line 4, in 
module
 from IPython.core.ipapp import launch_new_instance
ImportError: No module named ipapp


Any idea ?

  Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] numpy.test() failures

2009-12-07 Thread Nils Wagner
 numpy.__version__
'1.5.0.dev7980'


FAIL: test_buffer_hashlib (test_regression.TestRegression)
--
Traceback (most recent call last):
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/core/tests/test_regression.py,
 
line 1246, in test_buffer_hashlib
 assert_equal(md5(x).hexdigest(), 
'2a1dd1e1e59d0a384c26951e316cd7e6')
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/testing/utils.py, 
line 307, in assert_equal
 raise AssertionError(msg)
AssertionError:
Items are not equal:
  ACTUAL: 'aa341a15f5ade44faafbe190f98c2587'
  DESIRED: '2a1dd1e1e59d0a384c26951e316cd7e6'

--
Ran 2485 tests in 14.328s

FAILED (KNOWNFAIL=5, failures=1)
nose.result.TextTestResult run=2485 errors=0 failures=1
  
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] boolean arrays

2009-11-26 Thread Nils Wagner
Hi all,

is the following behaviour correct

 a = array(([True,True],[True,True]))
 b = array(([False,False],[False,False]))

 a+b
array([[ True,  True],
[ True,  True]])

I have expected False.

Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] boolean arrays

2009-11-26 Thread Nils Wagner
On Thu, 26 Nov 2009 15:14:04 +0100
  Fabrice Silva si...@lma.cnrs-mrs.fr wrote:
 Le jeudi 26 novembre 2009 à 14:44 +0100, Gael Varoquaux 
a écrit :
 On Thu, Nov 26, 2009 at 02:43:14PM +0100, Fabrice Silva 
wrote:
  Le jeudi 26 novembre 2009 à 18:26 +0200, Nadav Horesh 
a écrit :
   It is obvious to me that True+False == True,. Why do 
you think it should
   be False?
 
  I would understand it is not obvious that '+' stands 
for logical 'or',
  and '*' for logical 'and'...
 
 In Bool's algebra, this is the common convention. The 
reason being that
 only 'or' can correspond to the additive law of an 
algebra: its null
 element is absorbant for 'and'.
 
 In other words, if you map '+' and '*' to the opposite, 
you'll get
 suprising behaviors.
 
 I fully agree with you. My point was to complete Nadav's 
comment with
 potentially missing information, trying to figrue why 
Nils was expected
False...
 
 -- 
Fabrice Silva si...@lma.cnrs-mrs.fr
 LMA UPR CNRS 7051
  

Sorry, I mixed up '+' and ''

 a = array(([True,True],[True,True]))
 b = array(([False,False],[False,False]))
 a  b
array([[False, False],
[False, False]], dtype=bool)

Cheers,

  Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] NameError: global name 'matrix' is not defined

2009-09-16 Thread Nils Wagner
Ran 2235 tests in 25.593s

FAILED (KNOWNFAIL=1, errors=28, failures=1)
nose.result.TextTestResult run=2235 errors=28 failures=1
 import numpy
 numpy.__version__
'1.4.0.dev7400'

==
ERROR: test_basic (test_defmatrix.TestAlgebra)
--
Traceback (most recent call last):
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/core/tests/test_defmatrix.py,
 
line 190, in test_basic
 mA = matrix(A)
NameError: global name 'matrix' is not defined

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] NameError: global name 'matrix' is not defined

2009-09-16 Thread Nils Wagner
On Wed, 16 Sep 2009 11:41:15 -0500
  Robert Kern robert.k...@gmail.com wrote:
 On Wed, Sep 16, 2009 at 11:39, Nils 
Wagnernwag...@iam.uni-stuttgart.de wrote:
 Ran 2235 tests in 25.593s

 FAILED (KNOWNFAIL=1, errors=28, failures=1)
 nose.result.TextTestResult run=2235 errors=28 
failures=1
 import numpy
 numpy.__version__
 '1.4.0.dev7400'

 ==
 ERROR: test_basic (test_defmatrix.TestAlgebra)
 --
 Traceback (most recent call last):
   File
 /home/nwagner/local/lib64/python2.6/site-packages/numpy/core/tests/test_defmatrix.py,
 line 190, in test_basic
     mA = matrix(A)
 NameError: global name 'matrix' is not defined
 
 Clean out old files before reinstalling.
 
 -- 
 Robert Kern

Thank you very much. Works for me ...

rm -rf 
/home/nwagner/local/lib64/python2.6/site-packages/numpy

Ran 2196 tests in 16.713s

OK (KNOWNFAIL=1)
nose.result.TextTestResult run=2196 errors=0 failures=0
  
Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Ticket 1216

2009-09-11 Thread Nils Wagner
Hi all,

Ticket http://projects.scipy.org/numpy/ticket/1216 can be 
closed.

Cheers,

   Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] DumbArray, LoadArray, Numeric -- numpy

2009-07-28 Thread Nils Wagner
Hi all,

how can I import arrays in numpy which are stored by 
DumpArray in the old Numeric package ?

Nils
  
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] New test failures

2009-07-28 Thread Nils Wagner
 numpy.__version__
'1.4.0.dev7270'
Python 2.5.1 on 64-bit box


==
FAIL: 
test_umath.TestComplexFunctions.test_precisions_consistent
--
Traceback (most recent call last):
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/nose-0.10.4-py2.5.egg/nose/case.py,
 
line 182, in runTest
 self.test(*self.arg)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/core/tests/test_umath.py,
 
line 545, in test_precisions_consistent
 assert_almost_equal(fcf, fcd, decimal=6, 
err_msg='fch-fcd %s'%f)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/testing/utils.py, 
line 383, in assert_almost_equal
 DESIRED: %s\n % (str(actual), str(desired)))
AssertionError: Items are not equal:
ACTUAL: (0.666239+1.06128j)
DESIRED: (0.666239432493+1.06127506191j)


==
FAIL: test_csingle (test_linalg.TestEig)
--
Traceback (most recent call last):
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/linalg/tests/test_linalg.py,
 
line 39, in test_csingle
 self.do(a, b)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/linalg/tests/test_linalg.py,
 
line 94, in do
 assert_almost_equal(dot(a, evectors), 
multiply(evectors, evalues))
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/linalg/tests/test_linalg.py,
 
line 23, in assert_almost_equal
 old_assert_almost_equal(a, b, decimal=decimal, **kw)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/testing/utils.py, 
line 383, in assert_almost_equal
 DESIRED: %s\n % (str(actual), str(desired)))
AssertionError: Items are not equal:
ACTUAL: [[-0.28785625-0.21230127j  2.13664055+3.62986112j]
  [ 0.20296739+0.16528448j  4.73750353+6.42351294j]]
DESIRED: [[-0.28785625-0.21230127j 
 2.13664031+3.62986112j]
  [ 0.20296741+0.16528448j  4.73750353+6.42351341j]]


==
FAIL: test_csingle (test_linalg.TestPinv)
--
Traceback (most recent call last):
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/linalg/tests/test_linalg.py,
 
line 39, in test_csingle
 self.do(a, b)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/linalg/tests/test_linalg.py,
 
line 124, in do
 assert_almost_equal(dot(a, a_ginv), 
identity(asarray(a).shape[0]))
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/linalg/tests/test_linalg.py,
 
line 23, in assert_almost_equal
 old_assert_almost_equal(a, b, decimal=decimal, **kw)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/testing/utils.py, 
line 383, in assert_almost_equal
 DESIRED: %s\n % (str(actual), str(desired)))
AssertionError: Items are not equal:
ACTUAL: [[  1.0024e+00 +2.38418579e-07j 
 -5.96046448e-08 +0.e+00j]
  [  5.36441803e-07 +3.57627869e-07j   9.9821e-01 
+0.e+00j]]
DESIRED: [[ 1.  0.]
  [ 0.  1.]]


==
FAIL: test_csingle (test_linalg.TestSVD)
--
Traceback (most recent call last):
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/linalg/tests/test_linalg.py,
 
line 39, in test_csingle
 self.do(a, b)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/linalg/tests/test_linalg.py,
 
line 100, in do
 assert_almost_equal(a, dot(multiply(u, s), vt))
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/linalg/tests/test_linalg.py,
 
line 23, in assert_almost_equal
 old_assert_almost_equal(a, b, decimal=decimal, **kw)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/testing/utils.py, 
line 383, in assert_almost_equal
 DESIRED: %s\n % (str(actual), str(desired)))
AssertionError: Items are not equal:
ACTUAL: [[ 1.+2.j  2.+3.j]
  [ 3.+4.j  4.+5.j]]
DESIRED: [[ 1.0012+2.0024j 
 2.0024+3.0024j]
  [ 3.0048+4.0048j  4.0048+5.j]]


--
Ran 2179 tests in 67.754s

FAILED (KNOWNFAIL=1, failures=4)
nose.result.TextTestResult run=2179 errors=0 failures=4
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] numpy/core/code_generators/../src/multiarray/iterators.c:1778:could not find function name

2009-07-21 Thread Nils Wagner
Hi all,

I cannot build numpy from svn.
...

   adding 
'build/src.linux-x86_64-2.5/numpy/core/include/numpy/numpyconfig.h' 
to sources.
executing numpy/core/code_generators/generate_numpy_api.py
numpy/core/code_generators/../src/multiarray/iterators.c 
1778
Traceback (most recent call last):
   File setup.py, line 186, in module
 setup_package()
   File setup.py, line 179, in setup_package
 configuration=configuration )
   File 
/data/home/nwagner/svn/numpy/numpy/distutils/core.py, 
line 184, in setup
 return old_setup(**new_attr)
   File 
/data/home/nwagner/local/lib/python2.5/distutils/core.py, 
line 151, in setup
 dist.run_commands()
   File 
/data/home/nwagner/local/lib/python2.5/distutils/dist.py, 
line 974, in run_commands
 self.run_command(cmd)
   File 
/data/home/nwagner/local/lib/python2.5/distutils/dist.py, 
line 994, in run_command
 cmd_obj.run()
   File 
/data/home/nwagner/svn/numpy/numpy/distutils/command/install.py, 
line 49, in run
 r = old_install.run(self)
   File 
/data/home/nwagner/local/lib/python2.5/distutils/command/install.py, 
line 506, in run
 self.run_command('build')
   File 
/data/home/nwagner/local/lib/python2.5/distutils/cmd.py, 
line 333, in run_command
 self.distribution.run_command(command)
   File 
/data/home/nwagner/local/lib/python2.5/distutils/dist.py, 
line 994, in run_command
 cmd_obj.run()
   File 
/data/home/nwagner/svn/numpy/numpy/distutils/command/build.py, 
line 37, in run
 old_build.run(self)
   File 
/data/home/nwagner/local/lib/python2.5/distutils/command/build.py, 
line 112, in run
 self.run_command(cmd_name)
   File 
/data/home/nwagner/local/lib/python2.5/distutils/cmd.py, 
line 333, in run_command
 self.distribution.run_command(command)
   File 
/data/home/nwagner/local/lib/python2.5/distutils/dist.py, 
line 994, in run_command
 cmd_obj.run()
   File 
/data/home/nwagner/svn/numpy/numpy/distutils/command/build_src.py, 
line 130, in run
 self.build_sources()
   File 
/data/home/nwagner/svn/numpy/numpy/distutils/command/build_src.py, 
line 147, in build_sources
 self.build_extension_sources(ext)
   File 
/data/home/nwagner/svn/numpy/numpy/distutils/command/build_src.py, 
line 250, in build_extension_sources
 sources = self.generate_sources(sources, ext)
   File 
/data/home/nwagner/svn/numpy/numpy/distutils/command/build_src.py, 
line 307, in generate_sources
 source = func(extension, build_dir)
   File numpy/core/setup.py, line 484, in generate_api
 h_file, c_file, doc_file = 
m.generate_api(os.path.join(build_dir, header_dir))
   File 
numpy/core/code_generators/generate_numpy_api.py, line 
185, in generate_api
 do_generate_api(targets, sources)
   File 
numpy/core/code_generators/generate_numpy_api.py, line 
194, in do_generate_api
 numpyapi_list = genapi.get_api_functions('NUMPY_API', 
sources[0])
   File numpy/core/code_generators/genapi.py, line 267, 
in get_api_functions
 functions.extend(find_functions(f, tagname))
   File numpy/core/code_generators/genapi.py, line 220, 
in find_functions
 'could not find function name')
genapi.ParseError: 
numpy/core/code_generators/../src/multiarray/iterators.c:1778:could 
not find function name
  
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy/core/code_generators/../src/multiarray/iterators.c:1778:could not find function name

2009-07-21 Thread Nils Wagner
On Tue, 21 Jul 2009 15:05:02 +0900
  David Cournapeau da...@ar.media.kyoto-u.ac.jp wrote:
 Nils Wagner wrote:
 Hi all,

 I cannot build numpy from svn.
   
 
 Yes, I don't know why I did not caught this error on my 
machine. In any
 case, it is fixed in r7175.
 
 cheers,
 
 David

Great. Works for me.

   Nils

numpy.test()
==
ERROR: Failure: ImportError (No module named 
multiarray_tests)
--
Traceback (most recent call last):
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/nose-0.10.4-py2.5.egg/nose/loader.py,
 
line 364, in loadTestsFromName
 addr.filename, addr.module)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/nose-0.10.4-py2.5.egg/nose/importer.py,
 
line 39, in importFromPath
 return self.importFromDir(dir_path, fqname)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/nose-0.10.4-py2.5.egg/nose/importer.py,
 
line 84, in importFromDir
 mod = load_module(part_fqname, fh, filename, desc)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/core/tests/test_multiarray.py,
 
line 7, in module
 from numpy.core.multiarray_tests import 
test_neighborhood_iterator
ImportError: No module named multiarray_tests

--
Ran 2028 tests in 10.917s

FAILED (KNOWNFAIL=1, errors=1)
  
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] String manipulation

2009-07-21 Thread Nils Wagner
On Mon, 20 Jul 2009 12:44:23 -0700
  Christopher Barker chris.bar...@noaa.gov wrote:
 Nils Wagner wrote:
 How can I split the second line in such a way that I get
 
 ['-1.00E+00', '-1.00E+00', '-1.00E+00', 
 '-1.00E+00', '1.25E+00', '1.25E+00']
 
 instead of
 
 ['-1.00E+00-1.00E+00-1.00E+00-1.00E+00', 
 '1.25E+00', '1.25E+00']
 
 It looks like you have fixed-length fields. 

Yes. See
http://www.sdrl.uc.edu/universal-file-formats-for-modal-analysis-testing-1/file-format-storehouse/unv_0734.htm/

The naive
way do do this is simple string slicing:
 
 def line2array1(line, field_len=10):
 nums = []
 i = 0
 while i  len(line):
 nums.append(float(line[i:i+field_len]))
 i += field_len
 return np.array(nums)
 
 Then I saw the nifty list comprehension posted by 
Alan(?), which led me to the one (long) liner:
 
 def line2array2(line, field_len=10):
 return np.array(map(float, 
[line[i*field_len:(i+1)*field_len] for i 
 in range(len(line)/field_len)]))
 
 But it seems I should be able to do this using numpy 
arrays manipulating the data as characters. However, I 
had a little trouble getting a string into a numpy array 
as characters. This didn't work:
 
 In [55]: s
 Out[55]: 
'-1.00E+00-1.00E+00-1.00E+00-1.00E+00 
1.25E+00 1.25E+00'
 
 In [57]: np.array(s, 'S13')
 Out[57]:
 array('-1.00E+00',
   dtype='|S13')
 
 so I tried single characters:
 
 In [56]: np.array(s, 'S1')
 Out[56]:
 array('-',
   dtype='|S1')
 
 I still only got the first one.
 
 closer, but not quite:
 
 In [61]: np.array(tuple(s), 'S13')
 Out[61]:
 array(['-', '1', '.', '0', '0', '0', '0', '0', '0', 'E', 
'+', '0', '0',
'-', '1', '.', '0', '0', '0', '0', '0', '0', 'E', 
'+', '0', '0',
'-', '1', '.', '0', '0', '0', '0', '0', '0', 'E', 
'+', '0', '0',
'-', '1', '.', '0', '0', '0', '0', '0', '0', 'E', 
'+', '0', '0',
' ', '1', '.', '2', '5', '0', '0', '0', '0', 'E', 
'+', '0', '0',
' ', '1', '.', '2', '5', '0', '0', '0', '0', 'E', 
'+', '0', '0'],
   dtype='|S13')
 
 So I ended up with this:
 s_array = np.array(tuple(line), 
dtype='S1').view(dtype='S%i'%field_len)
 
 which seems uglier than it should be, but did lead so 
this one-liner:
 
 np.array(tuple(line),dtype='S1').view(dtype='S%i'%field_len).astype(np.float)
 
 
 Is there a cleaner way to do this?
 
 (test code attached)
 
 -Chris
 

Fixed-length fields are quite common e.g. in the area of 
Finite Element pre/postprocessing.
Therefore It would be nice to have a function like 
line2array in numpy.
Comments ?

Nils
  
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] String manipulation

2009-07-21 Thread Nils Wagner
On Tue, 21 Jul 2009 02:56:28 -0400
  Pierre GM pgmdevl...@gmail.com wrote:
 
 On Jul 21, 2009, at 2:42 AM, Nils Wagner wrote:

 Fixed-length fields are quite common e.g. in the area of
 Finite Element pre/postprocessing.
 Therefore It would be nice to have a function like
 line2array in numpy.
 Comments ?
 
 Er, there's already something like that:
 np.lib._iotools.LineSplitter
 
 Initialize it with either a character or an integer as 
delimiter, and  
 call your instance with a string as input. When you use 
an integer as  
 delimiter, it corresponds to the length of your field.
 eg:
  s = '-1.00E+00-1.00E+00 
1.00E+00-1.00E+00'
  conv = np.lib._iotools.LineConverter(13)
  np.array(conv(s))
 array(['-1.00E+00', '-1.00E+00', '1.00E+00', 
'-1.00E 
 +00'],
   dtype='|S13')
  np.array([float(_) for _ in conv(s)])
 array([-1., -1.,  1., -1.])
 
 Note that LineSplitter is already used in np.genfromtxt:
  import StringIO
  np.genfromtxt(StringIO.StringIO(s),delimiter=13)
 array([-1., -1.,  1., -1.])
 
  
Great. I didn't know about that.

Your examples are very useful.

IMHO the examples should be added to

http://www.scipy.org/Cookbook/InputOutput

to attract interest.

Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] String manipulation

2009-07-20 Thread Nils Wagner
On Mon, 11 May 2009 10:48:14 -0400
  Alan G Isaac ais...@american.edu wrote:
 On 5/11/2009 8:36 AM Nils Wagner apparently wrote:
 I would like to split strings made of digits after eight 
 characters each.
 
 
 [l[i*8:(i+1)*8] for i in range(len(l)/8)]
 
 Alan Isaac
 
 ___
 Numpy-discussion mailing list
 Numpy-discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

  1.00E+00 0.00E+00 1.00E+00 1.00E+00 
1.00E+00 1.00E+00
-1.00E+00-1.00E+00-1.00E+00-1.00E+00 
1.25E+00 1.25E+00
  
ifile = open('mydata','r')
lines = ifile.readlines()
for line in lines:
   print line.split()

How can I split the second line in such a way that I get

['-1.00E+00', '-1.00E+00', '-1.00E+00', 
'-1.00E+00', '1.25E+00', '1.25E+00']

instead of

['-1.00E+00-1.00E+00-1.00E+00-1.00E+00', 
'1.25E+00', '1.25E+00']

Thanks in advance

Nils
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Universal file format

2009-07-17 Thread Nils Wagner
Hi all,

Is there a Python tool to read and write files in the 
so-called universal format ?
I found a Matlab implementation

http://www.mathworks.com/matlabcentral/fileexchange/6395

Any pointer would be appreciated.

Thanks in advance

  Nils

  

http://www.sdrl.uc.edu/universal-file-formats-for-modal-analysis-testing-1
http://zone.ni.com/devzone/cda/tut/p/id/4463
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] roots and high-order polynomial

2009-07-06 Thread Nils Wagner
On Mon, 06 Jul 2009 16:53:42 +0200
  Fabrice Silva si...@lma.cnrs-mrs.fr wrote:
 Le lundi 06 juillet 2009 à 08:16 -0600, Charles R Harris 
a écrit :
 
 Double precision breaks down at about degree 25  if 
things are well
 scaled, so that is suspicious in itself. Also, the 
companion matrix
 isn't Hermitean so that property of the roots isn't 
preserved by the
 algorithm. If it were Hermitian then eigh would be used 
instead of
 eig. That said, there are other ways of computing 
polynomial roots
 that might preserve the Hermitean property, but I don't 
know that that
 would solve your problem. 
 
 I think there is a misunderstanding: I was referring to 
the fact the
 solution had to be real or complex conjugate, and not 
that the companion
 matrix would be a hermitian matrix (which it isn't due 
to its
 construction). 

IIRC, the coefficients of your polynomial are complex.
So, you cannot guarantee that the roots are complex 
conjugate pairs.

Nils

 Something I forgot to tell is that the roots are complex
 eigenfrequencies of a physical system, the real and 
imaginary parts
 expressing the damping and the frequency, respectively. 
If a positive
 frequency is solution then the opposite negative is 
solution too but
 with the «same-signed» damping.
 
 
 
 The problem is floating point round off error in 
representing the
 coefficients. Even if you know the coefficients exactly 
they can't
 generally be represented exactly in double precision. 
Any
 computational roundoff error just adds to that. If the 
coefficients
 were all integers I would have more confidence in the no 
error claim.
 
 Where do the coefficients come from? Perhaps there are 
options there.
 
 Here is the construction:
 the coefficients are obtained from a modal analysis of a 
subsystem of a
 bigger system. A quantity called impedance depending of 
a variable X is
 the result of the combination of several terms:
 Z(X) = C1/(X-X1)+C1*/(X-X1*)+...+CN/(X-XN)+CN*/(X-XN*)
 where * denotes the complex conjugate.
 I have to get the solutions X of an equation 
Ze(X)=N(X)/D(X) with N and
 D are very-low order polynomial (orders 1 and 2). An 
alternative of
 using iterative root finding (for example with 
scipy.optimize.fsolve) is
 to expand the equation as a polynomial of order close to 
2N.
 I do understand this approach might seem non-obvious but 
it is rather
 efficient for a low value of N (10)...
 -- 
Fabrice Silva
 Laboratory of Mechanics and Acoustics - CNRS
 31 chemin Joseph Aiguier, 13402 Marseille, France.
 
  
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] roots and high-order polynomial

2009-07-03 Thread Nils Wagner
On Fri, 03 Jul 2009 11:48:45 +0200
  Fabrice Silva si...@lma.cnrs-mrs.fr wrote:
 Hello
 Has anyone looked at the behaviour of the (polynomial) 
roots function
 for high-order polynomials ? I have an application which 
internally
 searches for the roots of a polynomial. It works nicely 
for order less
 than 20, and then has an erratic behaviour for upper 
values...
 
You will need multiprecision arithmetic in that case.
It's an ill-conditioned problem.

 I looked into the source and I wondered that roots is 
based on the
 eigenvalues of the companion matrix. For high-order, 
this latter is
 rather sparse. Would it improve anything to compute the 
eigenvalues
 using sparse solvers?

No.
  
Cheers,
Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] permutation symbol

2009-07-01 Thread Nils Wagner
On Tue, 30 Jun 2009 13:51:15 -0600
  Charles R Harris charlesr.har...@gmail.com wrote:
 On Tue, Jun 30, 2009 at 12:26 PM, Nils Wagner
 nwag...@iam.uni-stuttgart.dewrote:
 
 On Tue, 30 Jun 2009 11:10:39 -0600
   Charles R Harris charlesr.har...@gmail.com wrote:
  On Tue, Jun 30, 2009 at 10:56 AM, Charles R Harris 
  charlesr.har...@gmail.com wrote:
 
 
 
  On Tue, Jun 30, 2009 at 10:40 AM, Nils Wagner 
  nwag...@iam.uni-stuttgart.de wrote:
 
  On Tue, 30 Jun 2009 10:27:05 -0600
   Charles R Harris charlesr.har...@gmail.com wrote:
   On Tue, Jun 30, 2009 at 5:11 AM, Nils Wagner
   nwag...@iam.uni-stuttgart.dewrote:
  
   On Tue, 30 Jun 2009 11:22:34 +0200
Nils Wagner nwag...@iam.uni-stuttgart.de 
wrote:
  
Hi all,
  
   How can I build the following product with numpy
  
   q_i = \varepsilon_{ijk} q_{kj}
  
   where  \varepsilon_{ijk} denotes the permutation
 symbol.
  
   Nils
  
Sorry for replying to myself.
   The permutation symbol is also known as the
 Levi-Civita
  symbol.
   I found an explicit expression at
   http://en.wikipedia.org/wiki/Levi-Civita_symbol
  
   How do I build the product of the Levi-Civita 
symbol
  \varepsilon_{ijk} and
   the two dimensional array
   q_{kj}, i,j,k = 1,2,3 ?
  
  
   Write it out explicitly. It essentially
 antisymmetrizes
  q and the three off
   diagonal elements can then be treated as a vector.
  Depending on how q is
   formed and the resulting vector is used there may 
be
  other things you can do
   when you use it in a more general expression. If 
this
 is
  part of a general
   calculation there might be other ways of 
expressing
 it.
  
   Chuck
 
  Hi Chuck,
 
  Thank you for your response.
  The problem at hand is described in a paper by 
Angeles
  namely equation (17c) in
  Automatic computation of the screw parameters of
  rigid-body motions.
  Part I: Finitely-separated positions
  Journal of Dynamic systems, Measurement and Control,
 Vol.
  108 (1986) pp. 32-38
 
 
  You can solve this problem using quaternions also, in
 which case it reduces
  to an eigenvalue problem. You will note that such 
things
 as PCA are used in
  the papers that reference the cited work so you can't
 really get around that
  bit of inefficiency.
 
 
  Here's a reference to the quaternion approach:
  
http://people.csail.mit.edu/bkph/papers/Absolute_Orientation.pdf.
 You can
  get the translation part from the motion of the
 centroid.
 
  If you are into abstractions you will note that the
 problem reduces to
  minimising a quadratic form in the quaternion
 components. The rest is just
  algebra ;)
 
  Chuck

 It turns out that the product is simply an invariant of 
a
 3 \times 3 matrix.

 from numpy import array, zeros, identity
 from numpy.linalg import norm


 def vect(A):
  linear invariant of a 3 x 3 matrix 
 tmp = zeros(3,float)
 tmp[0] = 0.5*(A[2,1]-A[1,2])
 tmp[1] = 0.5*(A[0,2]-A[2,0])
 tmp[2] = 0.5*(A[1,0]-A[0,1])

 return tmp
 
 
 Out of curiosity, where did the .5 come from? It is not 
normally part of the
 Levi-Civita symbol.
 
 Chuck
  
Hi Chuck,

It's my fault. The components of the invariant q are given 
by

q_i = 0.5 \varepsilon_{ijk} q_{kj}

Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] make html

2009-07-01 Thread Nils Wagner
Hi all,

I am using

 numpy.__version__
'1.4.0.dev7094'

make html yields

/home/nwagner/svn/numpy/doc/source/reference/generated/numpy.trunc.rst:: 
WARNING: document isn't included in any toctree
done
preparing documents... done
Exception occurred:  2%] reference/generalized_ufuncs 
   ures
   File 
/home/nwagner/local/lib64/python2.6/site-packages/Sphinx-0.6.1-py2.6.egg/sphinx/environment.py,
 
line 921, in get_toc_for
 toc = self.tocs[docname].deepcopy()
KeyError: 'reference/generalized_ufuncs'
The full traceback has been saved in 
/tmp/sphinx-err-wlA8vA.log, if you want to report the 
issue to the author.
Please also report this if it was a user error, so that a 
better error message can be provided next time.
Send reports to sphinx-...@googlegroups.com. Thanks!
make: *** [html] Fehler 1


Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] permutation symbol

2009-06-30 Thread Nils Wagner
  Hi all,

How can I build the following product with numpy

q_i = \varepsilon_{ijk} q_{kj}

where  \varepsilon_{ijk} denotes the permutation symbol.

Nils

http://mathworld.wolfram.com/PermutationSymbol.html
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] permutation symbol

2009-06-30 Thread Nils Wagner

On Tue, 30 Jun 2009 11:22:34 +0200
 Nils Wagner nwag...@iam.uni-stuttgart.de wrote:

 Hi all,

How can I build the following product with numpy

q_i = \varepsilon_{ijk} q_{kj}

where  \varepsilon_{ijk} denotes the permutation symbol.

Nils
 
Sorry for replying to myself.
The permutation symbol is also known as the Levi-Civita 
symbol.
I found an explicit expression at 
http://en.wikipedia.org/wiki/Levi-Civita_symbol


How do I build the product of the Levi-Civita symbol 
\varepsilon_{ijk} and the two dimensional array

q_{kj}, i,j,k = 1,2,3 ?

Nils

from numpy import zeros

def levi_civita():
 Levi-Civita symbol 
http://en.wikipedia.org/wiki/Levi-Civita_symbol

eps = zeros((3,3,3),float)

for i in range(1,4):

for j in range(1,4):

for k in range(1,4):


eps[i-1,j-1,k-1] = -((i-j)**2%3)*((i-k)**2%3)*((j-k)**2%3)*((j-(i%3)-0.5)**2-5/4.)

return eps.astype(int)

eps = levi_civita()
print eps
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] permutation symbol

2009-06-30 Thread Nils Wagner
On Tue, 30 Jun 2009 10:27:05 -0600
  Charles R Harris charlesr.har...@gmail.com wrote:
 On Tue, Jun 30, 2009 at 5:11 AM, Nils Wagner
 nwag...@iam.uni-stuttgart.dewrote:
 
 On Tue, 30 Jun 2009 11:22:34 +0200
  Nils Wagner nwag...@iam.uni-stuttgart.de wrote:

  Hi all,

 How can I build the following product with numpy

 q_i = \varepsilon_{ijk} q_{kj}

 where  \varepsilon_{ijk} denotes the permutation symbol.

 Nils

  Sorry for replying to myself.
 The permutation symbol is also known as the Levi-Civita 
symbol.
 I found an explicit expression at
 http://en.wikipedia.org/wiki/Levi-Civita_symbol

 How do I build the product of the Levi-Civita symbol 
\varepsilon_{ijk} and
 the two dimensional array
 q_{kj}, i,j,k = 1,2,3 ?

 
 Write it out explicitly. It essentially antisymmetrizes 
q and the three off
 diagonal elements can then be treated as a vector. 
Depending on how q is
 formed and the resulting vector is used there may be 
other things you can do
 when you use it in a more general expression. If this is 
part of a general
 calculation there might be other ways of expressing it.
 
 Chuck
  
Hi Chuck,

Thank you for your response.
The problem at hand is described in a paper by Angeles
namely equation (17c) in
Automatic computation of the screw parameters of 
rigid-body motions.
Part I: Finitely-separated positions
Journal of Dynamic systems, Measurement and Control, Vol. 
108 (1986) pp. 32-38

  I am looking for a pythonic implementation of the 
algorithm.
  
Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] permutation symbol

2009-06-30 Thread Nils Wagner
On Tue, 30 Jun 2009 11:10:39 -0600
  Charles R Harris charlesr.har...@gmail.com wrote:
 On Tue, Jun 30, 2009 at 10:56 AM, Charles R Harris 
 charlesr.har...@gmail.com wrote:
 


 On Tue, Jun 30, 2009 at 10:40 AM, Nils Wagner 
 nwag...@iam.uni-stuttgart.de wrote:

 On Tue, 30 Jun 2009 10:27:05 -0600
  Charles R Harris charlesr.har...@gmail.com wrote:
  On Tue, Jun 30, 2009 at 5:11 AM, Nils Wagner
  nwag...@iam.uni-stuttgart.dewrote:
 
  On Tue, 30 Jun 2009 11:22:34 +0200
   Nils Wagner nwag...@iam.uni-stuttgart.de wrote:
 
   Hi all,
 
  How can I build the following product with numpy
 
  q_i = \varepsilon_{ijk} q_{kj}
 
  where  \varepsilon_{ijk} denotes the permutation 
symbol.
 
  Nils
 
   Sorry for replying to myself.
  The permutation symbol is also known as the 
Levi-Civita
 symbol.
  I found an explicit expression at
  http://en.wikipedia.org/wiki/Levi-Civita_symbol
 
  How do I build the product of the Levi-Civita symbol
 \varepsilon_{ijk} and
  the two dimensional array
  q_{kj}, i,j,k = 1,2,3 ?
 
 
  Write it out explicitly. It essentially 
antisymmetrizes
 q and the three off
  diagonal elements can then be treated as a vector.
 Depending on how q is
  formed and the resulting vector is used there may be
 other things you can do
  when you use it in a more general expression. If this 
is
 part of a general
  calculation there might be other ways of expressing 
it.
 
  Chuck

 Hi Chuck,

 Thank you for your response.
 The problem at hand is described in a paper by Angeles
 namely equation (17c) in
 Automatic computation of the screw parameters of
 rigid-body motions.
 Part I: Finitely-separated positions
 Journal of Dynamic systems, Measurement and Control, 
Vol.
 108 (1986) pp. 32-38


 You can solve this problem using quaternions also, in 
which case it reduces
 to an eigenvalue problem. You will note that such things 
as PCA are used in
 the papers that reference the cited work so you can't 
really get around that
 bit of inefficiency.

 
 Here's a reference to the quaternion approach:
 http://people.csail.mit.edu/bkph/papers/Absolute_Orientation.pdf. 
You can
 get the translation part from the motion of the 
centroid.
 
 If you are into abstractions you will note that the 
problem reduces to
 minimising a quadratic form in the quaternion 
components. The rest is just
 algebra ;)
 
 Chuck

It turns out that the product is simply an invariant of a 
3 \times 3 matrix.

from numpy import array, zeros, identity
from numpy.linalg import norm


def vect(A):
  linear invariant of a 3 x 3 matrix 
 tmp = zeros(3,float)
 tmp[0] = 0.5*(A[2,1]-A[1,2])
 tmp[1] = 0.5*(A[0,2]-A[2,0])
 tmp[2] = 0.5*(A[1,0]-A[0,1])

 return tmp

Q = array([[0,0,-1],[-1,0,0],[0,1,0]])

q = vect(Q)
print q
  

Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] permutation symbol

2009-06-30 Thread Nils Wagner
On Tue, 30 Jun 2009 11:30:51 -0700 (PDT)
  David Goldsmith d_l_goldsm...@yahoo.com wrote:
 
 Great, Nils!  Now, can you generalize it to N-D for us? 
;-)
 
 DG
  
Just curious - Do you have any application for N-D case in 
mind ?

Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Test bug in reduceat with structured arrays copied for speed.

2009-06-19 Thread Nils Wagner
Hi all,

Is this a known failure ?
I am using 1.4.0.dev7069

==
FAIL: Test bug in reduceat with structured arrays copied 
for speed.
--
Traceback (most recent call last):
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/nose-0.10.4-py2.5.egg/nose/case.py,
 
line 182, in runTest
 self.test(*self.arg)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/core/tests/test_umath.py,
 
line 700, in test_reduceat
 assert_array_almost_equal(h1, h2)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/testing/utils.py, 
line 537, in assert_array_almost_equal
 header='Arrays are not almost equal')
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/testing/utils.py, 
line 395, in assert_array_compare
 raise AssertionError(msg)
AssertionError:
Arrays are not almost equal

(mismatch 100.0%)
  x: array([  4.61621844e+24,   4.61621844e+24, 
  4.61621844e+24,
  4.61621844e+24], dtype=float32)
  y: array([  700.,   800.,  1000.,  7500.], 
dtype=float32)

--
Ran 2065 tests in 200.909s

FAILED (KNOWNFAIL=1, failures=1)
  
Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] numpy port to Jython

2009-06-17 Thread Nils Wagner
Hi all,

Is there a port of numpy/scipy to Jython ?

Any pointer would be appreciated.

Thanks in advance

Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy port to Jython

2009-06-17 Thread Nils Wagner
On Wed, 17 Jun 2009 15:00:23 -0400
  David Warde-Farley d...@cs.toronto.edu wrote:
 On 17-Jun-09, at 2:18 PM, Nils Wagner wrote:
 
 Is there a port of numpy/scipy to Jython ?

 Any pointer would be appreciated.
 
Folks have successfully gotten it working from IronPython 
(the .NET  
 CLR) via Ironclad ( http://code.google.com/p/ironclad/ 
)... not Jython  
 though.
 
 David

David,

Thank you for your reply.
Unfortunately, Ironclad currently only works on 32-bit 
Windows ...
  
Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] skiprows option in loadtxt

2009-05-20 Thread Nils Wagner
Hi all,

Is the value of skiprows in loadtxt restricted to values
in [0-10] ?
  
It doesn't work for skiprows=11.

Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] skiprows option in loadtxt

2009-05-20 Thread Nils Wagner
On Wed, 20 May 2009 10:16:08 -0500
  Ryan May rma...@gmail.com wrote:
 On Wed, May 20, 2009 at 10:04 AM, Nils Wagner
 nwag...@iam.uni-stuttgart.dewrote:
 
 Hi all,

 Is the value of skiprows in loadtxt restricted to values
 in [0-10] ?

 It doesn't work for skiprows=11.
 
 
 Works for me:
 
 s = '\n'.join(map(str,range(20)))
 from StringIO import StringIO
 np.loadtxt(StringIO(s), skiprows=11)
 
 The last line yields, as expected:
  array([ 11.,  12.,  13.,  14.,  15.,  16.,  17.,  18., 
 19.])
 
 This is with 1.4.0.dev6983.  Can we see code and data 
file?
 
 Ryan
 
 -- 
 Ryan May
 Graduate Research Assistant
 School of Meteorology
 University of Oklahoma
 Sent from Norman, Oklahoma, United States

Hi all,

My fault. Sorry for the noise.

Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] linear algebra help

2009-05-16 Thread Nils Wagner
On Sat, 16 May 2009 16:01:00 +0300
  Quilby qui...@gmail.com wrote:
 Hi-
 This is what I need to do-
 
 I have this equation-
 
 Ax = y
 
 Where A is a rational m*n matrix (m=n), and x and y are 
vectors of
 the right size. I know A and y, I don't know what x is 
equal to. I
 also know that there is no x where Ax equals exactly y. 
I want to find
 the vector x' such that Ax' is as close as possible to 
y. Meaning that
 (Ax' - y) is as close as possible to (0,0,0,...0).
 
 I know that I need to use either the lstsq function:
 http://www.scipy.org/doc/numpy_api_docs/numpy.linalg.linalg.html#lstsq
 
 or the svd function:
 http://www.scipy.org/doc/numpy_api_docs/numpy.linalg.linalg.html#svd
 
 I don't understand the documentation at all. Can someone 
please show
 me how to use these functions to solve my problem.
 
 Thanks a lot!!!
 
 -quilby
 ___
 Numpy-discussion mailing list
 Numpy-discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion
  
I guess you meant a rectangular matrix
http://mathworld.wolfram.com/RectangularMatrix.html

from numpy.random import rand, seed
from numpy import dot, shape
from numpy.linalg import lstsq, norm
seed(1)
m = 10
n = 20
A = rand(m,n) # random matrix
b = rand(m)   # rhs
x,residues,rank,s = lstsq(A,b)

print 'Singular values',s
print 'Numerical rank of A',rank
print 'Solution',x

r=dot(A,x)-b
print 'residual',norm(r)

Cheers,
 Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] List of arrays

2009-05-11 Thread Nils Wagner
Hi all,

How can I convert a list of arrays into one array ?
  
Nils

 data
[array([  40. ,  285.6,   45. ,  285.3,   50. ,  285.1, 
  55. ,  284.8]), array([  60. ,  284.5,   65. ,  282.8, 
  70. ,  281.1,   75. ,  280. ]), array([  80. ,  278.8, 
  85. ,  278.1,   90. ,  277.4,   95. ,  276.9]), array([ 
100. ,  276.3,  105. ,  276.1,  110. ,  275.9,  115. , 
 275.7]), array([ 120. ,  275.5,  125. ,  275.2,  130. , 
 274.8,  135. ,  274.5]), array([ 140. ,  274.1,  145. , 
 273.7,  150. ,  273.2,  155. ,  272.7]), array([ 160. , 
 272.2,  165. ,  272.1,  170. ,  272. ,  175. ,  271.8]), 
array([ 180. ,  271.6,  185. ,  271. ,  190. ,  270.3, 
 195. ,  269.5]), array([ 200. ,  268.5,  205. ,  267.4, 
 210. ,  266.1,  215. ,  263.5]), array([ 220. ,  260.1, 
 225. ,  256.1,  230. ,  249.9,  235. ,  239.3]), array([ 
238.7,  186.2,  240.,  160. ,  245. ,  119.7,  250. , 
 111.3])]

newdata=array([ 40. ,  285.6,   45. ,  285.3,   50. , 
 285.1, 55. ,  284.8, 60. ,  284.5,   65. ,  282.8, ..., 
 111.3])

Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] List of arrays

2009-05-11 Thread Nils Wagner
On Mon, 11 May 2009 06:54:45 -0400
  Alan G Isaac ais...@american.edu wrote:
 On 5/11/2009 6:28 AM Nils Wagner apparently wrote:
 How can I convert a list of arrays into one array ?
 
 Do you mean one long array, so that ``concatenate``
 is appropriate, or a 2d array, in which case you
 can just use ``array``.
 
 But your example looks like you should preallocate the
 larger array and fill it as the data arrive,
 if that's possible.
 
 Alan Isaac
 
Hi Alan,

concatenate works fine for me.

The problem is that the arrays within the list vary in 
length.

Thank you very much.

Nils
  
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] String manipulation

2009-05-11 Thread Nils Wagner
Hi all,

Please consider two strings
   
 line_a
'12345678abcdefgh12345678'
 line_b
'12345678 abcdefgh 12345678'
 line_b.split()
['12345678', 'abcdefgh', '12345678']

Is it possible to split line_a such that the output
is

['12345678', 'abcdefgh', '12345678']

Nils

  
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] FAIL: Test bug in reduceat with structured arrays

2009-05-11 Thread Nils Wagner
Hi all,

Can someone reproduce the following failure ?
I am using
 numpy.__version__
'1.4.0.dev6983'

==
FAIL: Test bug in reduceat with structured arrays copied 
for speed.
--
Traceback (most recent call last):
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/nose-0.10.4-py2.5.egg/nose/case.py,
 
line 182, in runTest
 self.test(*self.arg)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/core/tests/test_umath.py,
 
line 664, in test_reduceat
 assert np.all(h1 == h2)
AssertionError

Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] String manipulation

2009-05-11 Thread Nils Wagner
On Mon, 11 May 2009 14:25:46 +0200
  Francesc Alted fal...@pytables.org wrote:
 A Monday 11 May 2009, Nils Wagner escrigué:
 Hi all,

 Please consider two strings

  line_a

 '12345678abcdefgh12345678'

  line_b

 '12345678 abcdefgh 12345678'

  line_b.split()

 ['12345678', 'abcdefgh', '12345678']

 Is it possible to split line_a such that the output
 is

 ['12345678', 'abcdefgh', '12345678']
 
 Mmh, your question is a bit too generic. 

Indeed.
I would like to split strings made of digits after eight 
characters each.

 line_a
'11.122.233.3'

 line_b
'11.1 22.2 33.3'
  
 line_b.split()
['11.1', '22.2', '33.3']

How can I accomplish that ?

Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] FAIL: Test bug in reduceat with structured arrays

2009-05-11 Thread Nils Wagner
On Mon, 11 May 2009 14:05:13 + (UTC)
  Pauli Virtanen p...@iki.fi wrote:
 Mon, 11 May 2009 14:06:07 +0200, Nils Wagner kirjoitti:
 Can someone reproduce the following failure ? I am using
 numpy.__version__
 '1.4.0.dev6983'
 
 ==
 FAIL: Test bug in reduceat with structured arrays copied 
for speed.
 --
 [clip]
 
 Buildbot can't. I'd suggest removing your build/ 
directory and 
 rebuilding, to see if it's caused by some file not 
rebuilding properly.
 
 Otherwise, what is the platform you are using?
 
 -- 
 Pauli Virtanen
  

Everytime I rebuild numpy I remove the build directory 
before.

CentOS release 4.6 x86_64 Python 2.5.1

Nils

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] cannot build numpy from trunk

2009-05-05 Thread Nils Wagner
...
In file included from 
numpy/core/src/multiarray/ctors.c:16,
  from 
numpy/core/src/multiarray/multiarraymodule_onefile.c:13:
numpy/core/src/multiarray/ctors.h: At top level:
numpy/core/src/multiarray/ctors.h:68: warning: conflicting 
types for ‘byte_swap_vector’
numpy/core/src/multiarray/ctors.h:68: error: static 
declaration of ‘byte_swap_vector’ follows non-static 
declaration
numpy/core/src/multiarray/scalarapi.c:640: error: previous 
implicit declaration of ‘byte_swap_vector’ was here
error: Command /usr/bin/gcc -fno-strict-aliasing -DNDEBUG 
-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 
-fstack-protector -funwind-tables 
-fasynchronous-unwind-tables -g -fwrapv -fPIC 
-Inumpy/core/include 
-Ibuild/src.linux-x86_64-2.6/numpy/core/include/numpy 
-Inumpy/core/src/multiarray -Inumpy/core/src/umath 
-Inumpy/core/include -I/usr/include/python2.6 
-Ibuild/src.linux-x86_64-2.6/numpy/core/src/multiarray 
-Ibuild/src.linux-x86_64-2.6/numpy/core/src/umath -c 
numpy/core/src/multiarray/multiarraymodule_onefile.c -o 
build/temp.linux-x86_64-2.6/numpy/core/src/multiarray/multiarraymodule_onefile.o
 
failed with exit status 1
  

Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] cannot build numpy from trunk

2009-05-05 Thread Nils Wagner
On Tue, 5 May 2009 10:04:11 -0600
  Charles R Harris charlesr.har...@gmail.com wrote:
 On Tue, May 5, 2009 at 9:50 AM, Nils Wagner 
nwag...@iam.uni-stuttgart.dewrote:
 
 ...
 In file included from
 numpy/core/src/multiarray/ctors.c:16,
  from
 numpy/core/src/multiarray/multiarraymodule_onefile.c:13:
 numpy/core/src/multiarray/ctors.h: At top level:
 numpy/core/src/multiarray/ctors.h:68: warning: 
conflicting
 types for ‘byte_swap_vector’
 numpy/core/src/multiarray/ctors.h:68: error: static
 declaration of ‘byte_swap_vector’ follows non-static
 declaration
 numpy/core/src/multiarray/scalarapi.c:640: error: 
previous
 implicit declaration of ‘byte_swap_vector’ was here
 error: Command /usr/bin/gcc -fno-strict-aliasing 
-DNDEBUG
 -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2
 -fstack-protector -funwind-tables
 -fasynchronous-unwind-tables -g -fwrapv -fPIC
 -Inumpy/core/include
 -Ibuild/src.linux-x86_64-2.6/numpy/core/include/numpy
 -Inumpy/core/src/multiarray -Inumpy/core/src/umath
 -Inumpy/core/include -I/usr/include/python2.6
 -Ibuild/src.linux-x86_64-2.6/numpy/core/src/multiarray
 -Ibuild/src.linux-x86_64-2.6/numpy/core/src/umath -c
 numpy/core/src/multiarray/multiarraymodule_onefile.c -o

 build/temp.linux-x86_64-2.6/numpy/core/src/multiarray/multiarraymodule_onefile.o
 failed with exit status 1

 
 What happens if you delete the build directory first?
 
 Chuck

I have done that before ;-)
  
  Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] cannot build numpy from trunk

2009-05-05 Thread Nils Wagner
On Tue, 5 May 2009 12:44:31 -0600
  Charles R Harris charlesr.har...@gmail.com wrote:
 On Tue, May 5, 2009 at 10:12 AM, Nils Wagner
 nwag...@iam.uni-stuttgart.dewrote:
 
 On Tue, 5 May 2009 10:04:11 -0600
  Charles R Harris charlesr.har...@gmail.com wrote:
  On Tue, May 5, 2009 at 9:50 AM, Nils Wagner
 nwag...@iam.uni-stuttgart.dewrote:
 
  ...
  In file included from
  numpy/core/src/multiarray/ctors.c:16,
   from
  
numpy/core/src/multiarray/multiarraymodule_onefile.c:13:
  numpy/core/src/multiarray/ctors.h: At top level:
  numpy/core/src/multiarray/ctors.h:68: warning:
 conflicting
  types for ‘byte_swap_vector’
  numpy/core/src/multiarray/ctors.h:68: error: static
  declaration of ‘byte_swap_vector’ follows non-static
  declaration
  numpy/core/src/multiarray/scalarapi.c:640: error:
 previous
  implicit declaration of ‘byte_swap_vector’ was here
  error: Command /usr/bin/gcc -fno-strict-aliasing
 -DNDEBUG
  -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2
  -fstack-protector -funwind-tables
  -fasynchronous-unwind-tables -g -fwrapv -fPIC
  -Inumpy/core/include
  -Ibuild/src.linux-x86_64-2.6/numpy/core/include/numpy
  -Inumpy/core/src/multiarray -Inumpy/core/src/umath
  -Inumpy/core/include -I/usr/include/python2.6
  
-Ibuild/src.linux-x86_64-2.6/numpy/core/src/multiarray
  -Ibuild/src.linux-x86_64-2.6/numpy/core/src/umath -c
  numpy/core/src/multiarray/multiarraymodule_onefile.c 
-o
 
 
 build/temp.linux-x86_64-2.6/numpy/core/src/multiarray/multiarraymodule_onefile.o
  failed with exit status 1
 
 
  What happens if you delete the build directory first?
 
  Chuck

 I have done that before ;-)

 
 Is this from the latest svn?
 
 Chuck

r6955 | cdavid | 2009-05-05 13:10:29 +0200 (Di, 05. Mai 
2009) | 1 line

Put buffer protocol in separate file.
  

Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] stop criterion for an alternating signal

2009-05-04 Thread Nils Wagner

Hi all,

How can I define a stop criterion for an alternating 
series ?


Any pointer would be appreciated.

Nils


from numpy import loadtxt, arange
from pylab import plot, show

A = loadtxt('alternate.dat')
m = len(A)

x = arange(0,m)
plot(x,A)
show()



alternate.dat
Description: MPEG movie
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] stop criterion for an alternating signal

2009-05-04 Thread Nils Wagner
On Mon, 4 May 2009 10:52:59 -0600
  Charles R Harris charlesr.har...@gmail.com wrote:
 On Mon, May 4, 2009 at 10:48 AM, Nils Wagner
 nwag...@iam.uni-stuttgart.dewrote:
 
 Hi all,

 How can I define a stop criterion for an alternating 
series ?

 Any pointer would be appreciated.

 
 Where does the series come from and what are you trying 
to do?
 
 Chuck
  
The data come from an iterative process.
I am looking for convergence criteria.
It should be possible to stop the process after 10-15 
iterations.

Nils
  
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] String manipulation

2009-04-23 Thread Nils Wagner
Hi all,

How can I obtain the position of the minus sign within the
following string ?

 liste[1]
'1.5-te'


Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy.test() errors r6862

2009-04-13 Thread Nils Wagner
On Sun, 12 Apr 2009 12:56:46 -0600
  Charles R Harris charlesr.har...@gmail.com wrote:
 On Sun, Apr 12, 2009 at 12:52 PM, Charles R Harris 
 charlesr.har...@gmail.com wrote:
 


 On Sun, Apr 12, 2009 at 12:17 PM, Nils Wagner 
 nwag...@iam.uni-stuttgart.de wrote:

 ==
 ERROR: test suite
 --
 Traceback (most recent call last):
   File

 /home/nwagner/local/lib64/python2.6/site-packages/nose-0.10.4-py2.6.egg/nose/suite.py,
 line 154, in run
 self.setUp()
   File

 /home/nwagner/local/lib64/python2.6/site-packages/nose-0.10.4-py2.6.egg/nose/suite.py,
 line 180, in setUp
 if not self:
   File

 /home/nwagner/local/lib64/python2.6/site-packages/nose-0.10.4-py2.6.egg/nose/suite.py,
 line 65, in __nonzero__
 test = self.test_generator.next()
   File

 /home/nwagner/local/lib64/python2.6/site-packages/nose-0.10.4-py2.6.egg/nose/loader.py,
 line 221, in generate
 for test in g():
   File

 /home/nwagner/local/lib64/python2.6/site-packages/numpy/lib/tests/test_format.py,
 line 440, in test_memmap_roundtrip
 shape=arr.shape, fortran_order=fortran_order)
   File
 /home/nwagner/local/lib64/python2.6/site-packages/numpy/lib/format.py,
 line 484, in open_memmap
 mode=mode, offset=offset)
   File
 /home/nwagner/local/lib64/python2.6/site-packages/numpy/core/memmap.py,
 line 231, in __new__
 mm = mmap.mmap(fid.fileno(), bytes, access=acc,
 offset=offset)
 error: [Errno 22] Invalid argument

 ==
 ERROR: test_mmap (test_io.TestSaveLoad)
 --
 Traceback (most recent call last):
   File

 /home/nwagner/local/lib64/python2.6/site-packages/numpy/testing/decorators.py,
 line 169, in knownfailer
 return f(*args, **kwargs)
   File

 /home/nwagner/local/lib64/python2.6/site-packages/numpy/lib/tests/test_io.py,
 line 92, in test_mmap
 self.roundtrip(a, file_on_disk=True,
 load_kwds={'mmap_mode': 'r'})
   File

 /home/nwagner/local/lib64/python2.6/site-packages/numpy/lib/tests/test_io.py,
 line 100, in roundtrip
 RoundtripTest.roundtrip(self, np.save, *args,
 **kwargs)
   File

 /home/nwagner/local/lib64/python2.6/site-packages/numpy/lib/tests/test_io.py,
 line 67, in roundtrip
 arr_reloaded = np.load(load_file, **load_kwds)
   File
 /home/nwagner/local/lib64/python2.6/site-packages/numpy/lib/io.py,
 line 193, in load
 return format.open_memmap(file, mode=mmap_mode)
   File
 /home/nwagner/local/lib64/python2.6/site-packages/numpy/lib/format.py,
 line 484, in open_memmap
 mode=mode, offset=offset)
   File
 /home/nwagner/local/lib64/python2.6/site-packages/numpy/core/memmap.py,
 line 231, in __new__
 mm = mmap.mmap(fid.fileno(), bytes, access=acc,
 offset=offset)
 error: [Errno 22] Invalid argument

 --
 Ran 1889 tests in 12.656s

 FAILED (KNOWNFAIL=1, errors=2)


 Hmm, I'll guess that the problem is this:

 *offset* must be a multiple of the 
ALLOCATIONGRANULARITY.

 This conflicts with the current intent of offset. Looks 
like we need to fix
 up the patch to use the  nearest multiple of 
ALLOCATIONGRANULARITY and then
 offset the usual way. Or, since ALLOCATIONGRANULARITY is 
likely to be
 platform dependent, maybe we should just revert the 
patch.

 
 Can you import mmap, then do a dir(mmap) and see if 
 ALLOCATIONGRANULARITY
 is available?
 
 TIA,
 
 Chuck

Hi Chuck,

 import mmap
 dir (mmap)
['ACCESS_COPY', 'ACCESS_READ', 'ACCESS_WRITE', 
'ALLOCATIONGRANULARITY', 'MAP_ANON', 'MAP_ANONYMOUS', 
'MAP_DENYWRITE', 'MAP_EXECUTABLE', 'MAP_PRIVATE', 
'MAP_SHARED', 'PAGESIZE', 'PROT_EXEC', 'PROT_READ', 
'PROT_WRITE', '__doc__', '__file__', '__name__', 
'__package__', 'error', 'mmap']


All tests pass with '1.4.0.dev6864'. Thank you very much.

Cheers,
 Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] survey of freely available software for the solution of linear algebra problems

2009-04-13 Thread Nils Wagner
FWIW,

From: Jack Dongarra donga...@cs.utk.edu
Date: Tue, 7 Apr 2009 12:00:01 -0400
Subject: Survey of linear algebra software

We have updated the survey of freely available software 
for the solution of
linear algebra problems. Send us comments if you see a 
problem.

http://www.netlib.org/utk/people/JackDongarra/la-sw.html

Regards,

Jack and Hatem
  
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] numpy.test() errors r6862

2009-04-12 Thread Nils Wagner
==
ERROR: test suite
--
Traceback (most recent call last):
   File 
/home/nwagner/local/lib64/python2.6/site-packages/nose-0.10.4-py2.6.egg/nose/suite.py,
 
line 154, in run
 self.setUp()
   File 
/home/nwagner/local/lib64/python2.6/site-packages/nose-0.10.4-py2.6.egg/nose/suite.py,
 
line 180, in setUp
 if not self:
   File 
/home/nwagner/local/lib64/python2.6/site-packages/nose-0.10.4-py2.6.egg/nose/suite.py,
 
line 65, in __nonzero__
 test = self.test_generator.next()
   File 
/home/nwagner/local/lib64/python2.6/site-packages/nose-0.10.4-py2.6.egg/nose/loader.py,
 
line 221, in generate
 for test in g():
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/lib/tests/test_format.py,
 
line 440, in test_memmap_roundtrip
 shape=arr.shape, fortran_order=fortran_order)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/lib/format.py, 
line 484, in open_memmap
 mode=mode, offset=offset)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/core/memmap.py, 
line 231, in __new__
 mm = mmap.mmap(fid.fileno(), bytes, access=acc, 
offset=offset)
error: [Errno 22] Invalid argument

==
ERROR: test_mmap (test_io.TestSaveLoad)
--
Traceback (most recent call last):
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/testing/decorators.py,
 
line 169, in knownfailer
 return f(*args, **kwargs)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/lib/tests/test_io.py, 
line 92, in test_mmap
 self.roundtrip(a, file_on_disk=True, 
load_kwds={'mmap_mode': 'r'})
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/lib/tests/test_io.py, 
line 100, in roundtrip
 RoundtripTest.roundtrip(self, np.save, *args, 
**kwargs)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/lib/tests/test_io.py, 
line 67, in roundtrip
 arr_reloaded = np.load(load_file, **load_kwds)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/lib/io.py, 
line 193, in load
 return format.open_memmap(file, mode=mmap_mode)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/lib/format.py, 
line 484, in open_memmap
 mode=mode, offset=offset)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/core/memmap.py, 
line 231, in __new__
 mm = mmap.mmap(fid.fileno(), bytes, access=acc, 
offset=offset)
error: [Errno 22] Invalid argument

--
Ran 1889 tests in 12.656s

FAILED (KNOWNFAIL=1, errors=2)
  

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] cannot build numpy from trunk

2009-04-05 Thread Nils Wagner
Hi all,

I cannot build numpy from trunk

compile options: '-Inumpy/core/src -Inumpy/core/include 
-I/usr/include/python2.6 -c'
gcc: _configtest.c
_configtest.c:1: warning: conflicting types for built-in 
function ‘asin’
_configtest.c:2: warning: conflicting types for built-in 
function ‘cos’
_configtest.c:3: warning: conflicting types for built-in 
function ‘log’
_configtest.c:4: warning: conflicting types for built-in 
function ‘fabs’
_configtest.c:5: warning: conflicting types for built-in 
function ‘tanh’
_configtest.c:6: warning: conflicting types for built-in 
function ‘atan’
_configtest.c:7: warning: conflicting types for built-in 
function ‘acos’
_configtest.c:8: warning: conflicting types for built-in 
function ‘floor’
_configtest.c:9: warning: conflicting types for built-in 
function ‘fmod’
_configtest.c:10: warning: conflicting types for built-in 
function ‘sqrt’
_configtest.c:11: warning: conflicting types for built-in 
function ‘cosh’
_configtest.c:12: warning: conflicting types for built-in 
function ‘modf’
_configtest.c:13: warning: conflicting types for built-in 
function ‘sinh’
_configtest.c:14: warning: conflicting types for built-in 
function ‘frexp’
_configtest.c:15: warning: conflicting types for built-in 
function ‘exp’
_configtest.c:16: warning: conflicting types for built-in 
function ‘tan’
_configtest.c:17: warning: conflicting types for built-in 
function ‘ceil’
_configtest.c:18: warning: conflicting types for built-in 
function ‘log10’
_configtest.c:19: warning: conflicting types for built-in 
function ‘sin’
_configtest.c:20: warning: conflicting types for built-in 
function ‘ldexp’
/usr/bin/gcc _configtest.o -o _configtest
_configtest.o: In function `main':
/home/nwagner/svn/numpy/_configtest.c:44: undefined 
reference to `sin'
/home/nwagner/svn/numpy/_configtest.c:45: undefined 
reference to `cos'
/home/nwagner/svn/numpy/_configtest.c:46: undefined 
reference to `tan'
/home/nwagner/svn/numpy/_configtest.c:47: undefined 
reference to `sinh'
/home/nwagner/svn/numpy/_configtest.c:48: undefined 
reference to `cosh'
/home/nwagner/svn/numpy/_configtest.c:49: undefined 
reference to `tanh'
/home/nwagner/svn/numpy/_configtest.c:50: undefined 
reference to `fabs'
/home/nwagner/svn/numpy/_configtest.c:51: undefined 
reference to `floor'
/home/nwagner/svn/numpy/_configtest.c:52: undefined 
reference to `ceil'
/home/nwagner/svn/numpy/_configtest.c:53: undefined 
reference to `sqrt'
/home/nwagner/svn/numpy/_configtest.c:54: undefined 
reference to `log10'
/home/nwagner/svn/numpy/_configtest.c:55: undefined 
reference to `log'
/home/nwagner/svn/numpy/_configtest.c:56: undefined 
reference to `exp'
/home/nwagner/svn/numpy/_configtest.c:57: undefined 
reference to `asin'
/home/nwagner/svn/numpy/_configtest.c:58: undefined 
reference to `acos'
/home/nwagner/svn/numpy/_configtest.c:59: undefined 
reference to `atan'
/home/nwagner/svn/numpy/_configtest.c:60: undefined 
reference to `fmod'
collect2: ld returned 1 exit status
_configtest.o: In function `main':
/home/nwagner/svn/numpy/_configtest.c:44: undefined 
reference to `sin'
/home/nwagner/svn/numpy/_configtest.c:45: undefined 
reference to `cos'
/home/nwagner/svn/numpy/_configtest.c:46: undefined 
reference to `tan'
/home/nwagner/svn/numpy/_configtest.c:47: undefined 
reference to `sinh'
/home/nwagner/svn/numpy/_configtest.c:48: undefined 
reference to `cosh'
/home/nwagner/svn/numpy/_configtest.c:49: undefined 
reference to `tanh'
/home/nwagner/svn/numpy/_configtest.c:50: undefined 
reference to `fabs'
/home/nwagner/svn/numpy/_configtest.c:51: undefined 
reference to `floor'
/home/nwagner/svn/numpy/_configtest.c:52: undefined 
reference to `ceil'
/home/nwagner/svn/numpy/_configtest.c:53: undefined 
reference to `sqrt'
/home/nwagner/svn/numpy/_configtest.c:54: undefined 
reference to `log10'
/home/nwagner/svn/numpy/_configtest.c:55: undefined 
reference to `log'
/home/nwagner/svn/numpy/_configtest.c:56: undefined 
reference to `exp'
/home/nwagner/svn/numpy/_configtest.c:57: undefined 
reference to `asin'
/home/nwagner/svn/numpy/_configtest.c:58: undefined 
reference to `acos'
/home/nwagner/svn/numpy/_configtest.c:59: undefined 
reference to `atan'
/home/nwagner/svn/numpy/_configtest.c:60: undefined 
reference to `fmod'
collect2: ld returned 1 exit status
failure.
removing: _configtest.c _configtest.o
Traceback (most recent call last):
   File setup.py, line 172, in module
 setup_package()
   File setup.py, line 165, in setup_package
 configuration=configuration )
   File /home/nwagner/svn/numpy/numpy/distutils/core.py, 
line 184, in setup
 return old_setup(**new_attr)
   File /usr/lib64/python2.6/distutils/core.py, line 
152, in setup
 dist.run_commands()
   File /usr/lib64/python2.6/distutils/dist.py, line 
975, in run_commands
 self.run_command(cmd)
   File /usr/lib64/python2.6/distutils/dist.py, line 
995, in run_command
 cmd_obj.run()
   File 
/home/nwagner/svn/numpy/numpy/distutils/command/install.py, 
line 49, in 

[Numpy-discussion] manipulating lists

2009-03-24 Thread Nils Wagner
Hi all,

How can I extract the numbers from the following list

['', '-1.878722E-08,', '3.835992E-11', 
'1.192970E-03,-5.080192E-06']

It is easy to extract

 liste[1]
'-1.878722E-08,'
 liste[2]
'3.835992E-11'

but

 liste[3]
'1.192970E-03,-5.080192E-06'

How can I accomplish that ?

Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] manipulating lists

2009-03-24 Thread Nils Wagner
On Tue, 24 Mar 2009 10:27:18 -0400
  josef.p...@gmail.com wrote:
 On Tue, Mar 24, 2009 at 10:14 AM, Nils Wagner
 nwag...@iam.uni-stuttgart.de wrote:
 Hi all,

 How can I extract the numbers from the following list

 ['', '-1.878722E-08,', '3.835992E-11',
 '1.192970E-03,-5.080192E-06']

 It is easy to extract

 liste[1]
 '-1.878722E-08,'
 liste[2]
 '3.835992E-11'

 but

 liste[3]
 '1.192970E-03,-5.080192E-06'

 How can I accomplish that ?

 
 in python I would do this:
 
 ss=['', '-1.878722E-08,', 
'3.835992E-11','1.192970E-03,-5.080192E-06']
 li = []
 for j in ss:
   for ii in j.split(','):   # assumes , is delimiter
   try: li.append(float(ii));
   except ValueError: pass
 li
 [-1.87872199e-008, 3.83599203e-011, 
0.00119297,
 -5.08019199e-006]
 np.array(li)
 array([ -1.87872200e-08,   3.83599200e-11, 
  1.19297000e-03,
-5.08019200e-06])
 
 Josef
  
Thank you. Works like a charm.

Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] test failure in numpy trunk

2009-03-24 Thread Nils Wagner
On Tue, 24 Mar 2009 11:20:53 -0600
  Charles R Harris charlesr.har...@gmail.com wrote:
 2009/3/24 Darren Dale dsdal...@gmail.com
 
 Hello,

 I just performed an svn update, deleted my old build/ 
and
 site-packages/numpy*, reinstalled, and I see a new test 
failure on a 64 bit
 linux machine:

 ==
 FAIL: 
test_umath.TestComplexFunctions.test_loss_of_precision_longcomplex
 --
 Traceback (most recent call last):
   File 
/usr/lib64/python2.6/site-packages/nose/case.py, line 
182, in
 runTest
 self.test(*self.arg)
   File 
/usr/lib64/python2.6/site-packages/numpy/testing/decorators.py,
 line 169, in knownfailer
 return f(*args, **kwargs)
   File 
/usr/lib64/python2.6/site-packages/numpy/core/tests/test_umath.py,
 line 557, in test_loss_of_precision_longcomplex
 self.check_loss_of_precision(np.longcomplex)
   File 
/usr/lib64/python2.6/site-packages/numpy/core/tests/test_umath.py,
 line 510, in check_loss_of_precision
 check(x_series, 2*eps)
   File 
/usr/lib64/python2.6/site-packages/numpy/core/tests/test_umath.py,
 line 497, in check
 'arctanh')
 AssertionError: (135, 3.4039637354191726288e-09, 
3.9031278209478159624e-18,
 'arctanh')

 
 What machine is it?
 
 Chuck

I can reproduce the failure.
Linux linux-mogv 2.6.27.19-3.2-default #1 SMP 2009-02-25 
15:40:44 +0100 x86_64 x86_64 x86_64 GNU/Linux

cat /proc/cpuinfo
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model   : 15
model name  : Intel(R) Pentium(R) Dual  CPU  T3200  @ 
2.00GHz
stepping: 13
cpu MHz : 1000.000
cache size  : 1024 KB
physical id : 0
siblings: 2
core id : 0
cpu cores   : 2
apicid  : 0
initial apicid  : 0
fpu : yes
fpu_exception   : yes
cpuid level : 10
wp  : yes
flags   : fpu vme de pse tsc msr pae mce cx8 apic 
sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr 
sse sse2 ss ht tm pbe syscall nx lm constant_tsc 
arch_perfmon pebs bts rep_good nopl pni monitor ds_cpl est 
tm2 ssse3 cx16 xtpr lahf_lm
bogomips: 3996.80
clflush size: 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

processor   : 1
vendor_id   : GenuineIntel
cpu family  : 6
model   : 15
model name  : Intel(R) Pentium(R) Dual  CPU  T3200  @ 
2.00GHz
stepping: 13
cpu MHz : 1000.000
cache size  : 1024 KB
physical id : 0
siblings: 2
core id : 1
cpu cores   : 2
apicid  : 1
initial apicid  : 1
fpu : yes
fpu_exception   : yes
cpuid level : 10
wp  : yes
flags   : fpu vme de pse tsc msr pae mce cx8 apic 
sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr 
sse sse2 ss ht tm pbe syscall nx lm constant_tsc 
arch_perfmon pebs bts rep_good nopl pni monitor ds_cpl est 
tm2 ssse3 cx16 xtprlahf_lm
bogomips: 3996.82
clflush size: 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

==
FAIL: 
test_umath.TestComplexFunctions.test_loss_of_precision_longcomplex
--
Traceback (most recent call last):
   File 
/home/nwagner/local/lib64/python2.6/site-packages/nose-0.10.4-py2.6.egg/nose/case.py,
 
line 182, in runTest
 self.test(*self.arg)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/testing/decorators.py,
 
line 169, in knownfailer
 return f(*args, **kwargs)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/core/tests/test_umath.py,
 
line 557, in test_loss_of_precision_longcomplex
 self.check_loss_of_precision(np.longcomplex)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/core/tests/test_umath.py,
 
line 510, in check_loss_of_precision
 check(x_series, 2*eps)
   File 
/home/nwagner/local/lib64/python2.6/site-packages/numpy/core/tests/test_umath.py,
 
line 497, in check
 'arctanh')
AssertionError: (135, 3.4039637354191726288e-09, 
3.9031278209478159624e-18, 'arctanh')

--
Ran 2031 tests in 15.923s

FAILED (KNOWNFAIL=1, failures=1)
nose.result.TextTestResult run=2031 errors=0 failures=1
  
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for 64 bits machine

2009-03-20 Thread Nils Wagner
On Fri, 20 Mar 2009 11:09:49 +0100
  Vincent Thierion vincent.thier...@ema.fr wrote:
 Hello,
 
 Is there an easy way to build numpy on remote 64 bits 
machines on which I
 don't have any roots privilege ?

python setup.py install --prefix=$HOME/local

  Nils

  
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] dot product

2009-03-10 Thread Nils Wagner
Hi all,
  
The dot product can be defined for two vectors x and y by
x·y=|x||y| \cos(\theta),

where theta is the angle between the vectors and |x| is 
the norm.

Now assume that we have arrays(matrices)

X = [x_1, ..., x_m]

Y = [y_1, ..., y_s]

m  s

Is there a built-in function to compute the following
matrix

for i in arange(0,m):
 for j in arange(0,s):
 MAC[i,j] = 
dot(X[:,i],Y[:,j])**2/(dot(X[:,i],X[:,i])*dot(Y[:,j],Y[:,j]))
  
Each element of the matrix represents the corresponding 
angle squared.

Nils
   
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] AttributeError: 'str' object has no attribute 'seek'

2009-03-02 Thread Nils Wagner
Hi all,

I encountered a problem wrt loadtxt.

Traceback (most recent call last):
   File mac.py, line 9, in module
 mac = 
loadtxt('mac_diff.pmat.gz',skiprows=27,comments='!',usecols=(0,2,4),dtype='|S40')
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/lib/io.py, 
line 384, in loadtxt
 fh = seek_gzip_factory(fname)
   File 
/data/home/nwagner/local/lib/python2.5/site-packages/numpy/lib/io.py, 
line 51, in seek_gzip_factory
 f.seek = new.instancemethod(seek, f)
AttributeError: 'str' object has no attribute 'seek'

 numpy.__version__
'1.3.0.dev6520'

Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] AttributeError: 'str' object has no attribute 'seek'

2009-03-02 Thread Nils Wagner
On Mon, 2 Mar 2009 22:08:22 +0200
  Stéfan van der Walt ste...@sun.ac.za wrote:
 Nils,
 
 2009/3/2 Nils Wagner nwag...@iam.uni-stuttgart.de:
 I encountered a problem wrt loadtxt.

   File
 /data/home/nwagner/local/lib/python2.5/site-packages/numpy/lib/io.py,
 line 384, in loadtxt
 fh = seek_gzip_factory(fname)
 
 Would you mind trying latest SVN?
 
 Thanks
 Stéfan
  
Hi Stéfan,

Works for me. Thank you very much !
BTW, is it possible to use more than one character to 
indicate the start of a comment ?

I would like to use both '!' and '$'.
  
Cheers,
 Nils

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] ValueError: invalid literal for float()

2009-02-27 Thread Nils Wagner
Hi all,

Is it possible to modify the behaviour of float wrt
the following situation

  
 permas_M[0,2]
'1.569809265137D+01'
 float(permas_M[0,2])
Traceback (most recent call last):
   File stdin, line 1, in module
ValueError: invalid literal for float(): 
1.569809265137D+01

The following works.

 permas_M[0,2] = '1.569809265137E+01'
 permas_M[0,2]
'1.569809265137E+01'
 float(permas_M[0,2])
15.69809265137

Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] RFR: 995 - numpy.load can't handle gzip file handles

2009-02-22 Thread Nils Wagner
On Sat, 21 Feb 2009 12:58:14 +0200
  Stéfan van der Walt ste...@sun.ac.za wrote:
 Hi,
 
 Based on an example on Effbot, I implemented a 
workaround for reverse
 seeking in gzip files.  I need someone with Python 2.4 
to review:
 
 http://www.scipy.org/scipy/numpy/ticket/995
 
 Thanks!
 Stéfan


Done. See http://www.scipy.org/scipy/numpy/ticket/995
for details.

Cheers,

 Nils
  
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] RFR: 995 - numpy.load can't handle gzip file handles

2009-02-22 Thread Nils Wagner
On Sun, 22 Feb 2009 13:03:03 +0200
  Stéfan van der Walt ste...@sun.ac.za wrote:
 Hi Nils,
 
 2009/2/22 Nils Wagner nwag...@iam.uni-stuttgart.de:
 Done. See http://www.scipy.org/scipy/numpy/ticket/995
 for details.
 
 Thanks.  Did you have a NumPy array stored with 
numpy.save in test.gz?
 I finally got access to a 2.4 machine and the patch 
works there.
 
 Cheers
 Stéfan
 ___
 Numpy-discussion mailing list
 Numpy-discussion@scipy.org
 http://projects.scipy.org/mailman/listinfo/numpy-discussion

The attachment is missing.

Nils
  
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] RFR: 991 - Make savez able to write ZIP64 files

2009-02-22 Thread Nils Wagner
On Sun, 22 Feb 2009 18:37:05 +0200
  Stéfan van der Walt ste...@sun.ac.za wrote:
 Hi all,
 
 Please review the patch attached to
 
 http://scipy.org/scipy/numpy/ticket/991
 
 which enables ZIP64 extensions when saving and loading 
zipped data
 under Python = 2.5
 
 Thanks,
 Stéfan

Hi Stefan,

Please can you provide a short test ?

Thanks in advance

 Nils
  
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] RFR: 991 - Make savez able to write ZIP64 files

2009-02-22 Thread Nils Wagner
On Sun, 22 Feb 2009 22:18:32 +0200
  Stéfan van der Walt ste...@sun.ac.za wrote:
 Hi Nils
 
 2009/2/22 Nils Wagner nwag...@iam.uni-stuttgart.de:
 http://scipy.org/scipy/numpy/ticket/991

 which enables ZIP64 extensions when saving and loading
zipped data
 under Python = 2.5
 
 You can just run nosetests numpy.lib on both a 2.4 and 
a 2.5
 installation to see if it works.
 
 Thanks!
 Stéfan
 ___
 Numpy-discussion mailing list
 Numpy-discussion@scipy.org
 http://projects.scipy.org/mailman/listinfo/numpy-discussion


Done. I am using python2.6 now.

patch io.py  0001-Add-ZIP64-support.patch


nosetests numpy.lib
..
--
Ran 938 tests in 8.616s

OK


Cheers,
 Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] RFR: 995 - numpy.load can't handle gzip file handles

2009-02-21 Thread Nils Wagner
On Sat, 21 Feb 2009 12:58:14 +0200
  Stéfan van der Walt ste...@sun.ac.za wrote:
 Hi,
 
 Based on an example on Effbot, I implemented a 
workaround for reverse
 seeking in gzip files.  I need someone with Python 2.4 
to review:
 
 http://www.scipy.org/scipy/numpy/ticket/995
 
 Thanks!
 Stéfan
 _

Hi Stefan,

I would like to help but I failed to install numpy
(python2.4 Suse Linux 9.3)

In file included from 
numpy/core/src/multiarraymodule.c:96:
numpy/core/src/umath_funcs_c99.inc.src:269: warning: 
conflicting types for built-in function `sinl'
numpy/core/src/umath_funcs_c99.inc.src:269: warning: 
conflicting types for built-in function `cosl'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `tanl'
/usr/include/bits/mathcalls.h:68: error: previous 
declaration of `tanl'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `sinhl'
/usr/include/bits/mathcalls.h:75: error: previous 
declaration of `sinhl'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `coshl'
/usr/include/bits/mathcalls.h:73: error: previous 
declaration of `coshl'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `tanhl'
/usr/include/bits/mathcalls.h:77: error: previous 
declaration of `tanhl'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `fabsl'
/usr/include/bits/mathinline.h:476: error: previous 
declaration of `fabsl'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `floorl'
/usr/include/bits/mathinline.h:530: error: previous 
declaration of `floorl'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `ceill'
/usr/include/bits/mathinline.h:541: error: previous 
declaration of `ceill'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `rintl'
/usr/include/bits/mathcalls.h:280: error: previous 
declaration of `rintl'
numpy/core/src/umath_funcs_c99.inc.src:269: warning: 
conflicting types for built-in function `truncl'
numpy/core/src/umath_funcs_c99.inc.src:269: warning: 
conflicting types for built-in function `sqrtl'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `log10l'
/usr/include/bits/mathcalls.h:113: error: previous 
declaration of `log10l'
numpy/core/src/umath_funcs_c99.inc.src:269: warning: 
conflicting types for built-in function `logl'
numpy/core/src/umath_funcs_c99.inc.src:269: warning: 
conflicting types for built-in function `expl'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `expm1l'
/usr/include/bits/mathcalls.h:129: error: previous 
declaration of `expm1l'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `asinl'
/usr/include/bits/mathcalls.h:57: error: previous 
declaration of `asinl'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `acosl'
/usr/include/bits/mathcalls.h:55: error: previous 
declaration of `acosl'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `atanl'
/usr/include/bits/mathcalls.h:59: error: previous 
declaration of `atanl'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `asinhl'
/usr/include/bits/mathcalls.h:91: error: previous 
declaration of `asinhl'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `acoshl'
/usr/include/bits/mathcalls.h:89: error: previous 
declaration of `acoshl'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `atanhl'
/usr/include/bits/mathcalls.h:93: error: previous 
declaration of `atanhl'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `log1pl'
/usr/include/bits/mathcalls.h:132: error: previous 
declaration of `log1pl'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `exp2l'
/usr/include/bits/mathcalls.h:142: error: previous 
declaration of `exp2l'
numpy/core/src/umath_funcs_c99.inc.src:269: error: 
conflicting types for `log2l'
/usr/include/bits/mathcalls.h:145: error: previous 
declaration of `log2l'
numpy/core/src/umath_funcs_c99.inc.src:285: error: 
conflicting types for `atan2l'
/usr/include/bits/mathcalls.h:61: error: previous 
declaration of `atan2l'
numpy/core/src/umath_funcs_c99.inc.src:285: error: 
conflicting types for `hypotl'
/usr/include/bits/mathcalls.h:163: error: previous 
declaration of `hypotl'
numpy/core/src/umath_funcs_c99.inc.src:285: error: 
conflicting types for `powl'
/usr/include/bits/mathcalls.h:154: error: previous 
declaration of `powl'
numpy/core/src/umath_funcs_c99.inc.src:285: error: 
conflicting types for `fmodl'
/usr/include/bits/mathcalls.h:188: error: previous 
declaration of `fmodl'
numpy/core/src/umath_funcs_c99.inc.src:296: error: 
conflicting types for `modfl'
/usr/include/bits/mathcalls.h:116: error: previous 
declaration of `modfl'
In file included from 
numpy/core/src/scalartypes.inc.src:8,
  from numpy/core/src/arrayobject.c:545,
  from 

[Numpy-discussion] Summary of ticket 937

2009-02-19 Thread Nils Wagner
Hi all,

The summary of ticket 937 is incomplete.
It should be Complex matrices and lstsq.

http://projects.scipy.org/scipy/numpy/ticket/937

Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] astype

2009-02-14 Thread Nils Wagner
Hi all,

How can I convert an array with string elements to
an array with float entries ?


  
 coord_info[:,1]
array(['0,0', '100,0', '200,0', '300,0', '400,0', '500,0', 
'600,0', '700,0', '800,0', '0.0', '100.0', '200.0', 
'300.0', '400.0', '500.0', '600.0',
'700.0', '800.0', '0.0', '100.0', '200.0', 
'300.0', '400.0', '500.0', '600.0', '700.0', '800.0', 
'0.0', '100.0', '200.0', '300.0', '400.0',
'500.0', '600.0', '700.0', '800.0', '0.0', 
'100.0', '200.0', '300.0', '400.0', '500.0', '600.0', 
'700.0', '800.0'],
   dtype='|S50')

 coord_info[:,1].astype(float)
Traceback (most recent call last):
   File stdin, line 1, in module
ValueError: invalid literal for float(): 0,0


Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] astype

2009-02-14 Thread Nils Wagner
On Sat, 14 Feb 2009 17:22:43 +0100
  Nils Wagner nwag...@iam.uni-stuttgart.de wrote:
 Hi all,
 
 How can I convert an array with string elements to
 an array with float entries ?
 
 
  
 coord_info[:,1]
 array(['0,0', '100,0', '200,0', '300,0', '400,0', 
'500,0', 
 '600,0', '700,0', '800,0', '0.0', '100.0', '200.0', 
 '300.0', '400.0', '500.0', '600.0',
'700.0', '800.0', '0.0', '100.0', '200.0', 
 '300.0', '400.0', '500.0', '600.0', '700.0', '800.0', 
 '0.0', '100.0', '200.0', '300.0', '400.0',
'500.0', '600.0', '700.0', '800.0', '0.0', 
 '100.0', '200.0', '300.0', '400.0', '500.0', '600.0', 
 '700.0', '800.0'],
   dtype='|S50')
 
 coord_info[:,1].astype(float)
 Traceback (most recent call last):
   File stdin, line 1, in module
 ValueError: invalid literal for float(): 0,0
 
 
 Nils
 ___
 Numpy-discussion mailing list
 Numpy-discussion@scipy.org
 http://projects.scipy.org/mailman/listinfo/numpy-discussion


Sorry for the noise -  dots and commas were mixed up in 
the input file.

  
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Comparison of arrays

2009-02-09 Thread Nils Wagner
Hi all,

I have two integer arrays of different shape, e.g.

   
 a
array([ 1,  2,  3,  4,  5,  6,  7,  8,  9, 10])
 b
array([ 3,  4,  5,  6,  7,  8,  9, 10])

How can I extract the values that belong to the array a 
exclusively i.e. array([1,2]) ?

Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Comparison of arrays

2009-02-09 Thread Nils Wagner
On Mon, 9 Feb 2009 09:45:02 +0100
  Francesc Alted fal...@pytables.org wrote:
 A Monday 09 February 2009, Nils Wagner escrigué:
 Hi all,

 I have two integer arrays of different shape, e.g.

  a

 array([ 1,  2,  3,  4,  5,  6,  7,  8,  9, 10])

  b

 array([ 3,  4,  5,  6,  7,  8,  9, 10])

 How can I extract the values that belong to the array a
 exclusively i.e. array([1,2]) ?
 
 One possible, fast solution is using Python sets:
 
 In [45]: np.array(list(set(a) ^ set(b)))
 Out[45]: array([1, 2])
 
 Although this is suboptimal for very large arrays as it 
needs temporary 
 space.
 
 Cheers,
 
 -- 
Francesc Alted
  
Thank you very much for your prompt response.

Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] ERROR: Test flat on masked_matrices

2009-02-07 Thread Nils Wagner

==
ERROR: Test flat on masked_matrices
--
Traceback (most recent call last):
   File 
/usr/local/lib64/python2.5/site-packages/numpy/ma/tests/test_core.py, 
line 1127, in test_flat
 test = ma.array(np.matrix([[1, 2, 3]]), mask=[0, 0, 
1])
NameError: global name 'ma' is not defined

--
Ran 1897 tests in 14.713s

FAILED (KNOWNFAIL=9, errors=1)
nose.result.TextTestResult run=1897 errors=1 failures=0
  
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] xblas and numpy

2009-02-06 Thread Nils Wagner
Hi all,

Just curious. Is it possible to use xblas with numpy ?
  

http://www.netlib.org/xblas/


Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


  1   2   >