By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,034 Members | 2,000 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,034 IT Pros & Developers. It's quick & easy.

c# application calling Scipy

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a

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.