hello all,
i am currently in the process of planning a piece of software to model
polymerisation kinetics, and intend to use python for all the
high-level stuff. the number-crunching is something i would prefer to
do in fortran (which i have never used, but will learn), but i have no
experience of accessing non-python code from python. i am also fairly
new to programming period, and am therefore tackling a fairly serious
issue reletive to my experience.
how easy is it to get fortran modules running from python? if c is
easier to use in this respect, i could go in that direction instead.
i realize there is a lot of material on this subject already available,
but i am finding it difficult to make sense of, it's like trying to
take a drink from a fire hose.
any advice would be gratefully received. i will almost certainly be
coding this on windows, for what it's worth.
thank you,
sam
PS if numpy is adequate for this, i would be quite happy to use it. i
got the impression it was more for matrix algebra. i will be
programming a monte carlo simulation, which will need to perform a lot
(a lot!) of simple operations over and over... 3 2099
sam wrote:
hello all,
i am currently in the process of planning a piece of software to model
polymerisation kinetics, and intend to use python for all the
high-level stuff. the number-crunching is something i would prefer to
do in fortran (which i have never used, but will learn), but i have no
experience of accessing non-python code from python.
I strongly recommend learning Fortran 95, rather than Fortran 77
i am also fairly new to programming period, and am therefore tackling a fairly serious
issue reletive to my experience.
how easy is it to get fortran modules running from python?
G95 is a good, free Fortran 95 compiler -- I use it heavily, on
Windows. A discussion of "How to interface with Python programs" using
numpy is at http://www.g95.org/howto.html#python .
There is a numpy group http://groups.google.com/group/Numpy-discussion
with a recent thread "accessing FORTRAN from Python". There is also a
g95 group http://groups.google.com/group/gg95 .
if c is easier to use in this respect, i could go in that direction instead.
easier to interface with Python, but not easier for writing numerical
code IMO, especially if you need multidimensiona l arrays.
<snip>
PS if numpy is adequate for this, i would be quite happy to use it. i
got the impression it was more for matrix algebra. i will be
programming a monte carlo simulation, which will need to perform a lot
(a lot!) of simple operations over and over...
Fortran 95 has some of the advantages of numpy -- you perform
operations on whole arrays and array sections. It would probably be
considerably faster for code with loops.
sam wrote:
hello all,
i am currently in the process of planning a piece of software to model
polymerisation kinetics, and intend to use python for all the
high-level stuff. the number-crunching is something i would prefer to
do in fortran (which i have never used, but will learn), but i have no
experience of accessing non-python code from python. i am also fairly
new to programming period, and am therefore tackling a fairly serious
issue reletive to my experience.
how easy is it to get fortran modules running from python? if c is
easier to use in this respect, i could go in that direction instead.
i realize there is a lot of material on this subject already available,
but i am finding it difficult to make sense of, it's like trying to
take a drink from a fire hose.
any advice would be gratefully received. i will almost certainly be
coding this on windows, for what it's worth.
thank you,
sam
PS if numpy is adequate for this, i would be quite happy to use it. i
got the impression it was more for matrix algebra. i will be
programming a monte carlo simulation, which will need to perform a lot
(a lot!) of simple operations over and over...
numpy isn't for matrix algebra, specifically. It is primarily designed for
operations on arrays. If your simple operations can be "vectorized ," then numpy
will benefit you. If you can describe your needs in more detail, we'll be happy
to give you suggestions on the numpy-discussion list. http://www.scipy.org/Mailing_Lists
Of course, since the major player in wrapping Fortran libraries for Python is
f2py, a component of numpy, you're probably going to end up installing numpy
anyways. http://numpy.scipy.org
All of the f2py documentation is currently in the source, so start here: http://projects.scipy.org/scipy/nump...ocs/README.txt
Using f2py to wrap Fortran subroutines is actually a fair bit simpler than
wrapping C code, mostly because typical Fortran uses a limited set of simple types.
--
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
thanks guys,
i'll follow this up more in a couple of weeks when i know what i need
to do better.
sam This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Markus Faust |
last post by:
Hi,
I'm trying to link Fortran files generated with “Compaq Visual Fortran
Optimizing Compiler Version 6.6 (Update B)” under “Enthought Edition
build 1028, Python 2.3 (#46, Aug 11 2003, 09:34:05) on win32” on Windows-XP”.
I changed mingw32_support.py as proposed by Pearu Peterson on April 8
2003 (I changed `if 1:` block into `if 0:`...
|
by: Carl |
last post by:
I have experimented with f2c and swig-generated wrappers to create python
modules from Fortran files.
I think I'm missing something when I'm building the Python module, because
when I import the built module the Python interpreter returns the
following:
>>> import LDSsobol
Traceback (most recent call last):
File "<stdin>", line 1, in ?
|
by: Paul Phillips |
last post by:
Here is what I am trying to do.
I have an application that is written in VB 6 and in this application it is
accessing a custom dll file that was created using Microsoft Fortran
Professional 4.0. Now I have created the same application as far as user
interface in a ASP.Net web application but I am having trouble accessing the
Fortran dll...
|
by: Anonymous |
last post by:
I have a mixed-language pgm (Fortran and C++) which needs to pass a few
hundred values from C++ to Fortran. One way to do this is to have a
Fortran module and a C++ structure (or class) with an identical data
layout. I have used this idea with no problem, but it necessitates
making changes very carefully to the Fortran module and the C++...
|
by: Santosh |
last post by:
Hello,
I am trying to do some interfacing between c++ and fortran,
so my fortran code (say function foo )makes use of the data defined in
the modules.
Now, I call foo (fortran function) from my c++ code, How do I access
all the data of the
modules in my c++ code after calling the function foo (the foo
manipulates with that data)
I am using...
| |
by: sam |
last post by:
Hi,
Can anyone help me find a software that can convert a code in 'C'
to 'Fortran77/90' automatically?
Thanks in advance.
Sam.
|
by: unexpected |
last post by:
Hi all,
I'm currently working on a large, legacy Fortran application. I would
like to start new development in Python (as it is mainly I/O related).
In order to do so, however, the whole project needs to be able to
compile in Fortran.
I'm aware of resources like the F2Py Interface generator, but this only
lets me access the Fortran...
|
by: Mangabasi |
last post by:
Howdy,
I have been trying to call the following Fortran function from Python
(using Windows XP, Compaq Fortran and Python 2.4). I tried F2Py,
Pyfort and calldll with no success.
I think I came very close with calldll. Here is a short summary
Fortran code:
|
by: Gabriel Genellina |
last post by:
En Wed, 19 Nov 2008 20:06:37 -0200, Yann Vonder
<yann.vonderscher@gmail.comescribió:
If you put tmod in both libraries, you'll have two copies of it, and two
copies of the data. Can't you join both libraries onto a single one? Or
make one load the other? Or avoid global variables, and pass the required
data to the subroutines? Either way,...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |