Xavier Gnata wrote: > I'm using the numpy C API (PyArray_SimpleNewFromData) to perform the > conversion but my code is written by hands.
I'd like to see that. How are you getting the pointer to pass in to PyArray_SimpleNewFromData? It looks like you can do something like: (VA is a valarray<double>) npy_intp *dims dims[0] = VA.size() NPA = PyArray_SimpleNewFromData(1, dims, typenum, &VA[0]); Is that what you're doing? Is there any guarantee that &VA[0] won't change? In any case, I assume that you have to make sure that VA doesn't get deleted while the array is still around. > I would like to simplify it using SWIG but I also would like to see a good > typemap valarray <=> > numpy.array :) In principle, if you know how to write the code by hand, you know how to write the typemap. -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion