![](https://secure.gravatar.com/avatar/af6c39d6943bd4b0e1fde23161e7bb8c.jpg?s=120&d=mm&r=g)
Hi Chris On Thu, Nov 03, 2005 at 03:42:51PM -0800, Chris Barker wrote:
Bruce Southey wrote:
Hi, I found SWIG extremely to use but it only exposes a function to Python but not to numpy. Thus it is very slow for matrix functions. So if you want speed then you will have to deal with the APIs.
Yes, but can't I deal with them in writing typemaps, and then let SWIG do the rest of the work? I think I've seen some examples like this somewhere, but it's been a while and I need to go digging more.
I use SWIG and Blitz++ this way, and it works well. I modified Fernando's typemap to work with templates. See attached (does this need to be modified for Numeric3?). It is easy to create a Blitz matrix from a Numeric Array without copying data. Unfortunately, Blitz jealously guards its data (restricted pointers), so that it is not so easy to do the conversion in the other direction. If anyone knows an answer to this problem, I'd be glad to hear it. Stéfan