469,352 Members | 1,747 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,352 developers. It's quick & easy.

c# application calling Scipy

Hi,

Novice here. :)

I'm building a c# application and I want to call functions in SciPy
from that application.

What's the best way to call SciPy methods from a C# program?

Is there a best Python implementation for this? Ironython? Python for
..NET? Enthought?

Thanks in advance,
Don

Jan 6 '07 #1
2 4957
do********@hotmail.com wrote:
Hi,

Novice here. :)

I'm building a c# application and I want to call functions in SciPy
from that application.

What's the best way to call SciPy methods from a C# program?

Is there a best Python implementation for this? Ironython? Python for
.NET? Enthought?
scipy is a package with many C and FORTRAN extensions, so IronPython won't work
unless someone has figured out a magic way to compile them. The Enthought
distribution (disclosure: I work for Enthought) is just a bundling of the normal
python.org distribution of Python with a bunch of packages; it knows nothing
about C#. I know little about Python for .NET beyond its README, but it does
seem to be able to embed CPython into a C# application and with some elbow
grease, that might work for you.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Jan 6 '07 #2

do********@hotmail.com wrote:
Hi,

Novice here. :)

I'm building a c# application and I want to call functions in SciPy
from that application.

What's the best way to call SciPy methods from a C# program?
You need to:

1. Embed a Python interpreter in your C# app. That is, importing from a
DLL with a Python interpreter and defining a few structs.

2. Define a NumPy ndarray as a C# struct.

Or:

1. Write a proxy DLL in C and embed Python in that. This is the
preferred way, as I see it. You are relieved of having to redefine
Python and NumPy's C structs in C#.

2. Import your proxy in C# and marshal a C# array to a IntPtr. That
will allow you to map a C# array to a NumPy ndarray C struct in your
proxy.

The latter method is less hassle.

In any case you also need to make sure you are using a .NET runtime
that are linked to the same CRT as Python (.NET 1.1 should work).

Using IronPython will not work, as neither NumPy nor SciPy is ported to
IronPython (and porting is not trivial either; but if you take the task
upon yourself, many will be happy if you succeeed.)

Jan 7 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by avik | last post: by
reply views Thread by mike kreiner | last post: by
3 posts views Thread by hawkesed | last post: by
1 post views Thread by tkpmep | last post: by
reply views Thread by Julien Fiore | last post: by
2 posts views Thread by Aage Andersen | last post: by
1 post views Thread by tkpmep | last post: by
2 posts views Thread by robert | last post: by
2 posts views Thread by Peter Maas | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.