[Numpy-discussion] Anyone have a well-tested SWIG-based C++ STL valarray <=> numpy.array typemap to share?

Bill Spotz wfspotz@sandia....
Wed Sep 5 17:13:18 CDT 2007


The setup.py script in numpy/doc/swig is for compiling test code for  
numpy.i.  It is properly invoked by the Makefile, which will first  
run swig to generate the wrapper code for the test classes.  All a  
developer, who is using swig to interface some code with numpy in  
python, needs is numpy.i.  The setup.py script could possibly work as  
a template for whatever they are wrapping, I guess.

On Sep 5, 2007, at 3:57 PM, David Goldsmith wrote:

> Travis Vaught wrote:
>> Have you seen this?
>>
>> http://www.scipy.org/Cookbook/SWIG_and_NumPy
>>
> Unclear (to me): precisely what does one get from running python
> numpy/docs/swig/setup.py install, and is the product necessary, and if
> so, which other components rely on the product?  I ask 'cause I'm
> getting the following error trying to do so:
>
> [Parallels emulating] Microsoft Windows XP [Version 5.1.2600]
> (C) Copyright 1985-2001 Microsoft Corp.
>
> C:\Python25\Lib\site-packages\numpy\doc\swig>python setup.py install
> running install
> running build
> running build_py
> file Vector.py (for module Vector) not found
> file Matrix.py (for module Matrix) not found
> file Tensor.py (for module Tensor) not found
> file Vector.py (for module Vector) not found
> file Matrix.py (for module Matrix) not found
> file Tensor.py (for module Tensor) not found
> running build_ext
> building '_Vector' extension
> creating build
> creating build\temp.win32-2.5
> creating build\temp.win32-2.5\Release
> C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c
> /nologo /Ox
>  /MD /W3 /GX /DNDEBUG -IC:\Python25\lib\site-packages\numpy\core 
> \include
> -IC:\Python25\include -IC:\Python25\PC /TpVector_wrap.cxx
> /Fobuild\temp.win32-2.5\Release\Vector_wrap.obj
> cl : Command line warning D4029 : optimization is not available in the
> standard edition compiler
> Vector_wrap.cxx
> c1xx : fatal error C1083: Cannot open source file:  
> 'Vector_wrap.cxx': No
> such file or directory
> error: command '"C:\Program Files\Microsoft Visual Studio .NET
> 2003\Vc7\bin\cl.exe"' failed with exit status 2
>
> I have Python 2.5.1 installed:
>
> C:\Python25\Lib\site-packages\numpy\doc\swig>python
> Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
> (Intel)] on win32
>
> and numpy 1.0.3:
>>>> import numpy
>>>> numpy.__version__
> '1.0.3'
>
> I have the swig-1.3.31 exe:
>
>  Directory of C:\SWIG\swigwin-1.3.31
>
> 11/21/2006  12:07 AM         1,190,652 swig.exe
>
> and it runs (take my word for it)
>
> and the VC++ compiler via Visual Studio .NET 2003 (this I know  
> 'cause I
> use it frequently).
>
> So, if I don't need the product of python numpy/doc/swig/setup.py
> install, please explain why I don't, but if I do need it, please  
> help me
> figure out why I can't build it.  Thanks!
>
> DG
>
>
>> Also, the numpy/doc/swig directory has the simple typemaps.
>>
>> Travis
>>
>> On Sep 5, 2007, at 7:08 AM, Xavier Gnata wrote:
>>
>>
>>> I'm using the numpy C API (PyArray_SimpleNewFromData) to perform the
>>> conversion but my code is written by hands. I would like to
>>> simplify it
>>> using SWIG but I also would like to see a good typemap valarray <=>
>>> numpy.array :)
>>>
>>> Joris : Historical ones? Maybe also the fact that distutils has
>>> some small pb with C++ module. To sum up : You have to compile you
>>> module with the same compiler options you used to compile Python.
>>> Python is coded in C so some options does not make sense in C++.
>>> As a result, you get warnings at compile time (see pylab compiled
>>> with gcc for instance).
>>>
>>>
>>> Xavier
>>>
>>>
>>>
>>>
>>>> A related question, just out of curiosity: is there a technical
>>>> reason why Numpy has been coded in C rather than C++?
>>>>
>>>> Joris
>>>>
>>>>
>>>>
>>>> On 05 Sep 2007, at 02:24, David Goldsmith wrote:
>>>>
>>>>
>>>>
>>>>> Anyone have a well-tested SWIG-based C++ STL valarray <=>
>>>>> numpy.array
>>>>> typemap to share?  Thanks!
>>>>>
>>>>> DG
>>>>> -- 
>>>>> ERD/ORR/NOS/NOAA <http://response.restoration.noaa.gov/
>>>>> emergencyresponse/>
>>>>> _______________________________________________
>>>>> Numpy-discussion mailing list
>>>>> Numpy-discussion@scipy.org
>>>>> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>>>>>
>>>>>
>>>> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
>>>>
>>>> _______________________________________________
>>>> Numpy-discussion mailing list
>>>> Numpy-discussion@scipy.org
>>>> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>>>>
>>>>
>>>>
>>> -- 
>>> ############################################
>>> Xavier Gnata
>>> CRAL - Observatoire de Lyon
>>> 9, avenue Charles André
>>> 69561 Saint Genis Laval cedex
>>> Phone: +33 4 78 86 85 28
>>> Fax: +33 4 78 86 83 86
>>> E-mail: gnata@obs.univ-lyon1.fr
>>> ############################################
>>>
>>> _______________________________________________
>>> Numpy-discussion mailing list
>>> Numpy-discussion@scipy.org
>>> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>>>
>>>
>>
>> _______________________________________________
>> Numpy-discussion mailing list
>> Numpy-discussion@scipy.org
>> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>>
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>

** Bill Spotz                                              **
** Sandia National Laboratories  Voice: (505)845-0170      **
** P.O. Box 5800                 Fax:   (505)284-5451      **
** Albuquerque, NM 87185-0370    Email: wfspotz@sandia.gov **





More information about the Numpy-discussion mailing list