Re: Lua is faster than Fortran???

2010-07-04 Thread Stefan Behnel
sturlamolden, 04.07.2010 21:44: On 4 Jul, 19:51, Stefan Behnel wrote: Ok, so, which of those do you care about? I have already said I don't care about unladen swallow. What I meant, was: which of these benchmarks would have to be better to make you care? Because your decision not to care

Re: Lua is faster than Fortran???

2010-07-04 Thread Luis M . González
On Jul 4, 4:51 pm, Luis M. González luis...@gmail.com wrote: On Jul 4, 12:30 am, sturlamolden sturlamol...@yahoo.no wrote: I was just looking at Debian's benchmarks. It seems LuaJIT is now (on median) beating Intel Fortran! C (gcc) is running the benchmarks faster by less than

Re: Lua is faster than Fortran???

2010-07-04 Thread John Nagle
On 7/4/2010 12:51 PM, Luis M. González wrote: Looking at median runtimes, here is what I got: gcc 1.10 LuaJIT1.96 Java 6 -server2.13 Intel Fortran 2.18 OCaml 3.41 SBCL 3.66 JavaScript V8 7.57 PyPy

Re: Lua is faster than Fortran???

2010-07-04 Thread Stephen Hansen
On 7/4/10 9:21 AM, sturlamolden wrote: On 4 Jul, 14:29, David Cournapeau courn...@gmail.com wrote: Actually, I think the main reason why Lua is much faster than other dynamic languages is its size. The language is small. You don't list, dict, tuples, etc... They have managed to combine

Lua is faster than Fortran???

2010-07-03 Thread sturlamolden
I was just looking at Debian's benchmarks. It seems LuaJIT is now (on median) beating Intel Fortran! C (gcc) is running the benchmarks faster by less than a factor of two. Consider that Lua is a dynamically typed scripting language very similar to Python. LuaJIT also runs the benchmarks faster

Re: Lua is faster than Fortran???

2010-07-03 Thread Steven D'Aprano
On Sat, 03 Jul 2010 20:30:30 -0700, sturlamolden wrote: I know it's just a benchmark but this has to count as insanely impressive. Beating Intel Fortran with a dynamic scripting language, how is that even possible? By being clever, using Just In Time compilation as much as possible

Re: Lua is faster than Fortran???

2010-07-03 Thread sturlamolden
milliseconds either. But I do care about libraries like Python's standard library, wxPython, NumPy, and matplotlib. And when I need C, C++ or Fortran I know where to fint it. Nobody in the scientific community would be sad if Python was so fast that no C or Fortran would have to be written. And I am sure

Re: Using Python to Execute a C or FORTRAN Program (Windows)

2009-12-21 Thread Gib Bogle
W. eWatson wrote: Mensanator wrote: On Dec 14, 8:14�pm, W. eWatson wolftra...@invalid.com wrote: I think Python is capable of executing a compiled C or FORTRAN program, Sure, if it was compiled to an .exe file. and maybe even getting some parameters passed back. Sure, if the program

Re: Using Python to Execute a C or FORTRAN Program (Windows)

2009-12-17 Thread W. eWatson
sturlamolden wrote: On 17 Des, 03:41, W. eWatson wolftra...@invalid.com wrote: His program was originally written in Python, but a new hardware device (capture card) had no good interface with Python, so he wrote it in C++, which does. From my knowledge of the Python program before the entry

Re: Using Python to Execute a C or FORTRAN Program (Windows)

2009-12-16 Thread W. eWatson
Mensanator wrote: On Dec 14, 8:14�pm, W. eWatson wolftra...@invalid.com wrote: I think Python is capable of executing a compiled C or FORTRAN program, Sure, if it was compiled to an .exe file. and maybe even getting some parameters passed back. Sure, if the program prints to stdout

Re: Using Python to Execute a C or FORTRAN Program (Windows)

2009-12-16 Thread sturlamolden
On 17 Des, 03:41, W. eWatson wolftra...@invalid.com wrote: His program was originally written in Python, but a new hardware device (capture card) had no good interface with Python, so he wrote it in C++, which does. From my knowledge of the Python program before the entry of c++, it seems he

Re: Using Python to Execute a C or FORTRAN Program (Windows)

2009-12-16 Thread Mensanator
On Dec 16, 8:41 pm, W. eWatson wolftra...@invalid.com wrote: Mensanator wrote: On Dec 14, 8:14 pm, W. eWatson wolftra...@invalid.com wrote: I think Python is capable of executing a compiled C or FORTRAN program, Sure, if it was compiled to an .exe file. and maybe even getting some

Re: Using Python to Execute a C or FORTRAN Program (Windows)

2009-12-14 Thread Stephen Hansen
On Mon, Dec 14, 2009 at 6:14 PM, W. eWatson wolftra...@invalid.com wrote: I think Python is capable of executing a compiled C or FORTRAN program, and maybe even getting some parameters passed back. Does anyone have a example of how this might be done? I'm running under Win XP Pro. import

Re: Using Python to Execute a C or FORTRAN Program (Windows)

2009-12-14 Thread Mensanator
On Dec 14, 8:14�pm, W. eWatson wolftra...@invalid.com wrote: I think Python is capable of executing a compiled C or FORTRAN program, Sure, if it was compiled to an .exe file. and maybe even getting some parameters passed back. Sure, if the program prints to stdout. Does anyone have

Re: Query about doing fortran-esque repeat formatting

2009-11-09 Thread Glenn Hutchings
Rob Briggs rdbriggs at mun.ca writes: Is there a way to do a repeat formatting command like in Fortran? Rather that doing this: print %s %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f % (parmName[i], tmp[i][1], tmp[i][2], tmp[i][4], tmp[i][6], tmp[i][7], tmp[i][8], tmp[i][9

Re: Query about doing fortran-esque repeat formatting

2009-11-09 Thread Jean-Michel Pichavant
Glenn Hutchings wrote: Rob Briggs rdbriggs at mun.ca writes: Is there a way to do a repeat formatting command like in Fortran? Rather that doing this: print %s %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f % (parmName[i], tmp[i][1], tmp[i][2], tmp[i][4], tmp[i][6], tmp[i][7], tmp[i][8

Re: Query about doing fortran-esque repeat formatting

2009-11-09 Thread Rob Briggs
like in Fortran? Rather that doing this: print %s %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f % (parmName[i], tmp[i][1], tmp[i][2], tmp[i][4], tmp[i][6], tmp[i][7], tmp[i][8], tmp[i][9]) There certainly is. You can use python's string concatenation and repeat

Query about doing fortran-esque repeat formatting

2009-11-08 Thread Rob Briggs
Hello, Is there a way to do a repeat formatting command like in Fortran? Rather that doing this: print %s %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f % (parmName[i], tmp[i][1], tmp[i][2], tmp[i][4], tmp[i][6], tmp[i][7], tmp[i][8], tmp[i][9]) Something like this: print %s 7%-5.3f

Re: Query about doing fortran-esque repeat formatting

2009-11-08 Thread Mensanator
On Nov 8, 8:56�am, Rob Briggs rdbri...@mun.ca wrote: Hello, Is there a way to do a repeat formatting command like in Fortran? Rather that doing this: print %s %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f % (parmName[i], tmp[i][1], tmp[i][2], tmp[i][4], �tmp[i][6], �tmp[i][7], tmp[i][8

Re: Query about doing fortran-esque repeat formatting

2009-11-08 Thread Novocastrian_Nomad
How about: print ('%s ' + '%-5.4f ' * 7) % ('text',1,2,3,4,5,6,7) -- http://mail.python.org/mailman/listinfo/python-list

Python/Fortran interoperability

2009-08-30 Thread nmm1
I am interested in surveying people who want to interoperate between Fortran and Python to find out what they would like to be able to do more conveniently, especially with regard to types not supported for C interoperability by the current Fortran standard. Any suggestions as to other ways

Re: Python/Fortran interoperability

2009-08-30 Thread nmm1
In article 1032c78d-d4dd-41c0-a877-b85ca000d...@g31g2000yqc.googlegroups.com, sturlamolden sturlamol...@yahoo.no wrote: On 23 Aug, 12:35, n...@cam.ac.uk wrote: I am interested in surveying people who want to interoperate between Fortran and Python to find out what they would like to be able

Re: Python/Fortran interoperability

2009-08-30 Thread Richard Maine
) in its model. Nor most of what else Python would expect. I am note sure what you mean. ... You thus can pass derived types between C and Fortran. You missed the word OOP, which seemed like the whole point. Not that the particular word is used in the Fortran standard, but it isn't hard to guess

Re: Python/Fortran interoperability

2009-08-30 Thread nmm1
of length 1, and you have to kludge them up as arrays. That doesn't work very well, especially for things like function results. This obviosuly proves you wrong: Er, no, it doesn't. I suggest that you read what I said more carefully - and the Fortran standard. As I said, you can kludge them up

Re: Python/Fortran interoperability

2009-08-24 Thread nmm1
In article 5134d9f1-0e23-4e05-a817-bf0cc9e85...@w6g2000yqw.googlegroups.com, sturlamolden sturlamol...@yahoo.no wrote: On 24 Aug, 02:26, nos...@see.signature (Richard Maine) wrote: You missed the word OOP, which seemed like the whole point. Not that the particular word is used in the Fortran

Re: Python/Fortran interoperability

2009-08-24 Thread sturlamolden
. Not that the particular word is used in the Fortran standard, but it isn't hard to guess that he means a derived type that uses some of the OOP features. Inheritance, polymorphism, and type-bound procedure (aka methods in some other languages) come to mind. But C is not OOP. The ISO C bindings

Re: Python/Fortran interoperability

2009-08-24 Thread Paul van Delst
sturlamolden wrote: On 24 Aug, 02:57, nos...@see.signature (Richard Maine) wrote: Does anyone use OOP in Fortran anyway? I do - currently for learning (and eventually training) purposes so I don't distribute any of the code. But, the fact that... Fortran 2003 compilers are not ubiquitous

Re: Python/Fortran interoperability

2009-08-24 Thread Kurt Smith
On Sun, Aug 23, 2009 at 9:21 AM, Stefan Behnelstefan...@behnel.de wrote: n...@cam.ac.uk wrote: I am interested in surveying people who want to interoperate between Fortran and Python to find out what they would like to be able to do more conveniently, especially with regard to types

Re: Python/Fortran interoperability

2009-08-24 Thread sturlamolden
On 24 Aug, 18:20, n...@cam.ac.uk wrote: This obviosuly proves you wrong: Er, no, it doesn't.  I suggest that you read what I said more carefully - and the Fortran standard.  As I said, you can kludge them up, and that is precisely one such kludge - You said we have to kludge them up as arrays

Re: Python/Fortran interoperability

2009-08-24 Thread Richard Maine
sturlamolden sturlamol...@yahoo.no wrote: You also said we can only interop with length-1 character strings. My kludge was valid Fortran and works with strings of any length up to some sane limit that you can specify. There might be a confusion here (and I'm not even sure on whose part

Re: Python/Fortran interoperability

2009-08-24 Thread nmm1
In article 1j4y84p.v5docbtueccmn%nos...@see.signature, Richard Maine nos...@see.signature wrote: Only character strings of length 1 are interoperable, as the term interoperable is defined in the Fortran standard. However, that does not mean that only character strings of length 1 will work with C

Re: Python/Fortran interoperability

2009-08-24 Thread sturlamolden
Obviously that is not allowed, because C does not know anything about Fortran strings. How should a C compiler pass the correct data structure to Fred? The C bindings in Fortran 2003 has functions to convert C pointers to Fortran pointers (c_f_pointer, c_f_procpointer), because C does not know

Re: Python/Fortran interoperability

2009-08-24 Thread glen herrmannsfeldt
to me the usual question for Fortran assumed size arrays. Assuming that FRED can tell from the passed string, it seems fine to me. If not, it is a problem. Null terminated strings are a C convention, supported by the library and compiler (string constants). Others are legal C, though you have

Re: Python/Fortran interoperability

2009-08-24 Thread nmm1
below. Consider, for example: =A0 =A0 SUBROUTINE Fred (X) BIND(C) =A0 =A0 CHARACTER*(*) :: X =A0 =A0 END SUBROUTINE Fred Obviously that is not allowed, because C does not know anything about Fortran strings. How should a C compiler pass the correct data structure to Fred? Precisely. The reason

Re: Python/Fortran interoperability

2009-08-24 Thread nmm1
)) This is not currently allowed and raises all sorts of 'interesting' implementation and portability questions. For example, I defy anyone to write Fred portably in C :-) You mean, how does FRED know the length? It seems to me the usual question for Fortran assumed size arrays. Assuming that FRED can

Re: Python/Fortran interoperability

2009-08-24 Thread sturlamolden
On 24 Aug, 21:24, n...@cam.ac.uk wrote: You might also like to consider the converse problem: how to write a Fortran function that takes a C string of arbitrary length and uses it. That's what the code I showed you does. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python/Fortran interoperability

2009-08-24 Thread James Van Buskirk
potential confusion was forseen, which is why there are notes specifically about it in the Fortran standard (see below). Those notes do tend to get overlooked though. Only character strings of length 1 are interoperable, as the term interoperable is defined in the Fortran standard. However

Re: Python/Fortran interoperability

2009-08-24 Thread Richard Maine
James Van Buskirk not_va...@comcast.net wrote: Richard Maine nos...@see.signature wrote in message news:1j4y84p.v5docbtueccmn%nos...@see.signature... One might plausibly regard this as a kludge, but it is a kludge that is part of the Fortran standard and is guaranteed to work with all

Re: Python/Fortran interoperability

2009-08-23 Thread viper-2
On Aug 23, 6:35 am, n...@cam.ac.uk wrote: I am interested in surveying people who want to interoperate between Fortran and Python to find out what they would like to be able to do more conveniently, especially with regard to types not supported for C interoperability by the current Fortran

Re: Python/Fortran interoperability

2009-08-23 Thread Stefan Behnel
n...@cam.ac.uk wrote: I am interested in surveying people who want to interoperate between Fortran and Python to find out what they would like to be able to do more conveniently, especially with regard to types not supported for C interoperability by the current Fortran standard. Any

Re: Python/Fortran interoperability

2009-08-23 Thread sturlamolden
On 23 Aug, 12:35, n...@cam.ac.uk wrote: I am interested in surveying people who want to interoperate between Fortran and Python to find out what they would like to be able to do more conveniently, especially with regard to types not supported for C interoperability by the current Fortran

Re: Python/Fortran interoperability

2009-08-23 Thread JB
[Followup-To: header set to comp.lang.fortran.] On 2009-08-23, n...@cam.ac.uk n...@cam.ac.uk wrote: I am interested in surveying people who want to interoperate between Fortran and Python to find out what they would like to be able to do more conveniently, especially with regard to types

Re: Python/Fortran interoperability

2009-08-23 Thread nmm1
of arbitrary length? As in, a signed C int (that most Fortran implementations use to keep track of string lengths) may not be sufficient? No, I'm not particularly interested in that. No, I mean things like 'Kilroy was here'. Currently, Fortran's C interoperability supports only strings of length 1

Re: Python/Fortran interoperability

2009-08-23 Thread sturlamolden
expect. I am note sure what you mean. This has the same ABI: typedef struct { int m, n; float r; } myctype; use iso_c_binding type, bind(c) :: myftype integer(c_int) :: m, n real(c_float) :: s end type You thus can pass derived types between C and Fortran. -- http

Re: Python/Fortran interoperability

2009-08-23 Thread sturlamolden
On 24 Aug, 00:02, Dennis Lee Bieber wlfr...@ix.netcom.com wrote:         That's a C language problem -- since a string in C is just an array of character. The last FORTRAN dialect (and implementation) I used passed strings On 24 Aug, 00:02, Dennis Lee Bieber wlfr...@ix.netcom.com wrote

Re: Python/Fortran interoperability

2009-08-23 Thread sturlamolden
On 24 Aug, 01:59, sturlamolden sturlamol...@yahoo.no wrote: subroutine foobar(cstr) bind(c, name='foobar')     use, intrinsic :: iso_c_binding     type(c_ptr) :: cstr     character(*), pointer :: fstr     call c_f_pointer(cptr, fptr) Which means that you can write a wrapper in Fortran

Re: Python/Fortran interoperability

2009-08-23 Thread sturlamolden
On 24 Aug, 02:26, nos...@see.signature (Richard Maine) wrote: You missed the word OOP, which seemed like the whole point. Not that the particular word is used in the Fortran standard, but it isn't hard to guess that he means a derived type that uses some of the OOP features. Inheritance

Re: Python/Fortran interoperability

2009-08-23 Thread Richard Maine
sturlamolden sturlamol...@yahoo.no wrote: On 24 Aug, 02:26, nos...@see.signature (Richard Maine) wrote: You missed the word OOP, which seemed like the whole point. Not that the particular word is used in the Fortran standard, but it isn't hard to guess that he means a derived type

Re: Python/Fortran interoperability

2009-08-23 Thread sturlamolden
a pointer to a character(*). However, we can create a pointer to a huge string (say 2 GB or whatever maximum the system allows), and slice that down to a substring using strlen to obtain the length. So here is how to pass a variable-length string from C to Fortran, tested with gcc and gfortran 4.1.1

Re: Python/Fortran interoperability

2009-08-23 Thread sturlamolden
be interesting in teh future to say inherit a Python class from a Fortran 2003 derived type. I have no idea how to do this (I don't know Fortran 2003 that well). But possibly one could do some magic with the ISO C bindings, exposing the Fortran 2003 derived type as a C etxtension class to Python. Does anyone

Re: Python/Fortran interoperability

2009-08-23 Thread Richard Maine
sturlamolden sturlamol...@yahoo.no wrote: Does anyone use OOP in Fortran anyway? Presumably not many people yet because... And Fortran 2003 compilers are not ubiquitous. I'd not only agree, I'd say that was quite a bit understated. Last time I checked, the number of Fortran 2003 compilers

Re: python code to fortran 77's

2009-03-11 Thread Larry
On Mar 9, 9:55 am, John Machin sjmac...@lexicon.net wrote: On Mar 9, 12:09 pm, Larry larry.cebu...@gmail.com wrote: Friends, I need to read a binary file using a Fortran 77 code to integrate with a legacy code It looked very much complicated to me for I have no knowledge

python code to fortran 77's

2009-03-08 Thread Larry
Friends, I need to read a binary file using a Fortran 77 code to integrate with a legacy code It looked very much complicated to me for I have no knowledge in Fortran. I could read the file with ease using Python, as shown in the following. ### from numpy import

Re: python code to fortran 77's

2009-03-08 Thread John Machin
On Mar 9, 12:09 pm, Larry larry.cebu...@gmail.com wrote: Friends, I need to read a binary file using a Fortran 77 code to integrate with a legacy code It looked very much complicated to me for I have no knowledge in Fortran. I could read the file with ease using Python, as shown

Re: Fortran array in python (f2py?)...

2009-02-14 Thread tripp
OK. It sounds like it would be easiest for me, then, to dump the arrays to a binary file (much faster than dumping it to a text) from the fortran program. Then use f2py to load a fortran module to read it.?. How well does python handle binary files? Maybe I could skit the f2py all together

Re: Fortran array in python (f2py?)...

2009-02-14 Thread Kurt Smith
On Sat, Feb 14, 2009 at 2:06 PM, tripp trippl...@gmail.com wrote: OK. It sounds like it would be easiest for me, then, to dump the arrays to a binary file (much faster than dumping it to a text) from the fortran program. Then use f2py to load a fortran module to read it.?. I've done

Re: Fortran array in python (f2py?)...

2009-02-14 Thread Scott David Daniels
tripp wrote: ... dump the arrays to a binary file (much faster than dumping it to a text) from the fortran program How well does python handle binary files? Maybe I could skit the f2py all together if I can get python to read the fortran binary file... Likely your best plan. Look

Fortran array in python (f2py?)...

2009-02-13 Thread tripp
Hello Folks, I have a fortran program I use to process several satellite images. I currently output the results to a text file (~750 mb) which is then read by a perl program that outputs a GIS-ready image using GDAL (www.gdal.org). There are python libraries for GDAL too. I'd like to pipe

Re: Fortran array in python (f2py?)...

2009-02-13 Thread MRAB
tripp wrote: Hello Folks, I have a fortran program I use to process several satellite images. I currently output the results to a text file (~750 mb) which is then read by a perl program that outputs a GIS-ready image using GDAL (www.gdal.org). There are python libraries for GDAL too. I'd

Re: Fortran array in python (f2py?)...

2009-02-13 Thread tripp
On Feb 13, 1:27 pm, MRAB goo...@mrabarnett.plus.com wrote: tripp wrote: Hello Folks, I have a fortran program I use to process several satellite images.  I currently output the results to a text file (~750 mb) which is then read by a perl program that outputs a GIS-ready image using GDAL

Re: Fortran array in python (f2py?)...

2009-02-13 Thread Robert Kern
On 2009-02-13 11:59, tripp wrote: Hello Folks, I have a fortran program I use to process several satellite images. I currently output the results to a text file (~750 mb) which is then read by a perl program that outputs a GIS-ready image using GDAL (www.gdal.org). There are python libraries

Re: ctypes with Compaq Visual Fortran 6.6B *.dll (Windows XP), passing of integer and real values

2009-01-29 Thread Duncan Booth
alex ale...@bluewin.ch wrote: Jon Thank you for your answer. I tried it with no success. However I tried with tst=cdll.LoadLibrary(f:\\scratch\\test2\\footst.dll) instead of tst=windll.LoadLibrary(f:\\scratch\\test2\\footst.dll) and it runs now with no error message, I can't figure for

Re: ctypes with Compaq Visual Fortran 6.6B *.dll (Windows XP), passing of integer and real values

2009-01-29 Thread alex
Duncan Thank you for your explanation of the relationship between calling convention and stack management. I will try to understand better this topic in the CVF and ctypes documentation (not so easy). Regards Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes with Compaq Visual Fortran 6.6B *.dll (Windows XP), passing of integer and real values

2009-01-29 Thread member thudfoo
On Thu, Jan 29, 2009 at 1:08 PM, alex ale...@bluewin.ch wrote: Duncan Thank you for your explanation of the relationship between calling convention and stack management. I will try to understand better this topic in the CVF and ctypes documentation (not so easy). Regards Alex --

Re: ctypes with Compaq Visual Fortran 6.6B *.dll (Windows XP), passing of integer and real values

2009-01-28 Thread alex
Jon Thank you for your answer. I tried it with no success. However I tried with tst=cdll.LoadLibrary(f:\\scratch\\test2\\footst.dll) instead of tst=windll.LoadLibrary(f:\\scratch\\test2\\footst.dll) and it runs now with no error message, I can't figure for now why, but it's great! This is

ctypes with Compaq Visual Fortran 6.6B *.dll (Windows XP), passing of integer and real values

2009-01-27 Thread alex
Hello everybody I am mainly a Fortran programmer and beginning to learn Python(2.5) and OOP programming. I hope in the end to put a GUI on my existing Fortran code. Therefore I am also trying to learn Python's ctypes library. Unfortunately the ctypes tutorial does not show simple examples so I

Re: ctypes with Compaq Visual Fortran 6.6B *.dll (Windows XP), passing of integer and real values

2009-01-27 Thread Jon Clements
On Jan 27, 9:41 pm, alex ale...@bluewin.ch wrote: Hello everybody I am mainly a Fortran programmer and beginning to learn Python(2.5) and OOP programming. I hope in the end to put a GUI on my existing Fortran code. Therefore I am also trying to learn Python's ctypes library. Unfortunately

Re: F2PY: Access Fortran module data from multiple python module

2008-11-20 Thread Gabriel Genellina
En Wed, 19 Nov 2008 20:06:37 -0200, Yann Vonder [EMAIL PROTECTED] escribió: Here is a description of what I am trying to implement using F2PY: I have created two python extension modules using F2PY. The first extension module (say fsubr1.so) contains a Fortran module (say tmod

F2PY: Access Fortran module data from multiple python module

2008-11-19 Thread Yann Vonder
Hi all, Here is a description of what I am trying to implement using F2PY: I have created two python extension modules using F2PY. The first extension module (say fsubr1.so) contains a Fortran module (say tmod) and a subroutine (say subr1) that modifies the data contained in tmod. The second

catching exceptions from fortran

2008-09-11 Thread john
I wrapped some fortran code using F2PY and need to be able to catch fortran runtime errors to run the following: # grid is a wrapped fortran module # no runtime errors incurred when run with the correct inputs for filetype #--- def readGrid( self, coord='xyz

Re: catching exceptions from fortran

2008-09-11 Thread Gabriel Genellina
En Thu, 11 Sep 2008 10:43:08 -0300, john [EMAIL PROTECTED] escribió: I wrapped some fortran code using F2PY and need to be able to catch fortran runtime errors to run the following: [reindented] # grid is a wrapped fortran module # no runtime errors incurred when run with the correct inputs

Re: Calling CVF-Fortran-dll with ctypes and simple structure

2008-04-08 Thread Michael Schäfer
Gabriel, works perfect - even in complex nested structures! Thank you very much! (If both Fortran and VB say char*9, why did you choose a pointer here?) I do not know this possibility. Could you please drop me a few lines? -- Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling CVF-Fortran-dll with ctypes and simple structure

2008-04-08 Thread Gabriel Genellina
En Tue, 08 Apr 2008 06:02:17 -0300, Michael Schäfer [EMAIL PROTECTED] escribió: Gabriel, works perfect - even in complex nested structures! Thank you very much! (If both Fortran and VB say char*9, why did you choose a pointer here?) I do not know this possibility. Could you please

Calling CVF-Fortran-dll with ctypes and simple structure

2008-04-07 Thread Michael Schäfer
Hi all, I deal with the old problem passing characters from python to a fortran dll build with CFV6.6c. I reduced our complex structure to a simple one. Here is the Fortran code: SUBROUTINE DEMO2L(s) C sample for calling CVF6.6c-DLLs from C vb/vba/python with simple structure

Re: Calling CVF-Fortran-dll with ctypes and simple structure

2008-04-07 Thread Gabriel Genellina
En Mon, 07 Apr 2008 09:19:03 -0300, Michael Schäfer [EMAIL PROTECTED] escribió: Hi all, I deal with the old problem passing characters from python to a fortran dll build with CFV6.6c. I reduced our complex structure to a simple one. Here is the Fortran code: SUBROUTINE DEMO2L(s

Re: Fortran to Python

2008-01-05 Thread MartinRinehart
Jeroen Ruigrok van der Werven wrote: I got someone who asked me to make changes in an old Fortran program she is using for some calculations. Why convert? Modern Fortran is an object oriented, structured language with the singular advantage that it can run old Fortran programs. -- http

Re: Fortran to Python

2008-01-05 Thread Jeroen Ruigrok van der Werven
-On [20080105 11:21], [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote: Why convert? Modern Fortran is an object oriented, structured language with the singular advantage that it can run old Fortran programs. With all due respect to Fortran but I find the syntax to be utterly horrendous

Re: Fortran to Python

2008-01-05 Thread Jeroen Ruigrok van der Werven
-On [20080104 19:21], Dennis Lee Bieber ([EMAIL PROTECTED]) wrote: If the FORTRAN is using single precision reals, I'd expect a slow-down in Python just on that alone, as Python uses doubles as the only float type. There is also the overhead of object access for each. In this case it uses

Re: Fortran to Python

2008-01-05 Thread Robert Kern
Jeroen Ruigrok van der Werven wrote: -On [20080104 19:21], Dennis Lee Bieber ([EMAIL PROTECTED]) wrote: If the FORTRAN is using single precision reals, I'd expect a slow-down in Python just on that alone, as Python uses doubles as the only float type. There is also the overhead of object

Re: Fortran to Python

2008-01-05 Thread Evgenii Rudnyi
On Jan 4, 2:21 pm, Jeroen Ruigrok van der Werven [EMAIL PROTECTED] nomine.org wrote: I got someone who asked me to make changes in an old Fortran program she is using for some calculations. The calculations are pretty standard aside from 2 calls to DLINCG (an IMSL numerical_libraries function

Fortran to Python

2008-01-04 Thread Jeroen Ruigrok van der Werven
I got someone who asked me to make changes in an old Fortran program she is using for some calculations. The calculations are pretty standard aside from 2 calls to DLINCG (an IMSL numerical_libraries function to calculate an inverse matrix). What I wonder about, does anybody have a Fortran

Re: Fortran to Python

2008-01-04 Thread Jeroen Ruigrok van der Werven
-On [20080104 14:22], Jeroen Ruigrok van der Werven ([EMAIL PROTECTED]) wrote: What I wonder about, does anybody have a Fortran to Python conversion page somewhere to map some of the basic types to Python equivalents? Just to share my own ideas: Seems COMPLEX*16/complex*16 ~= complex REAL*8

Re: Fortran to Python

2008-01-04 Thread Jeroen Ruigrok van der Werven
-On [20080104 15:56], Robin Becker ([EMAIL PROTECTED]) wrote: you probably want to look at numpy an extension that handles lots of matrix things with great ease. I think it now lives at http://scipy.org/ Yeah, I am aware of SciPy/NumPy, but aside from these two calls to do this inverse matrix

Re: Fortran to Python

2008-01-04 Thread Robin Becker
Jeroen Ruigrok van der Werven wrote: -On [20080104 14:22], Jeroen Ruigrok van der Werven ([EMAIL PROTECTED]) wrote: What I wonder about, does anybody have a Fortran to Python conversion page somewhere to map some of the basic types to Python equivalents? Just to share my own ideas: Seems

Re: Fortran to Python

2008-01-04 Thread Robert Kern
Jeroen Ruigrok van der Werven wrote: I got someone who asked me to make changes in an old Fortran program she is using for some calculations. The calculations are pretty standard aside from 2 calls to DLINCG (an IMSL numerical_libraries function to calculate an inverse matrix). What I

Re: Subprocess and 16-bit FORTRAN

2007-11-25 Thread Nick Craig-Wood
Federico Ceccatto [EMAIL PROTECTED] wrote: This is the kind of 'bugs' i've run into, perhaps someone could shed some light onto them? - Sometimes execution of child process (in this case, NTVDM.exe and its children) stops and the object is destroyed for no reason whatsoever. Very

Subprocess and 16-bit FORTRAN

2007-11-22 Thread Federico Ceccatto
Hello, For the past year I've been building an XP Python/wxPython shell of sorts for several dozen command line FORTRAN tools developed for various material science problems. Given how the methods and how-to's have been lost to everyone but the original creators for these 80's to 90's pieces

Re: ctypes: error passing a list of str to a fortran dll

2007-06-07 Thread luis
with their padded length. YourFortranmay (but probably won't) have extensions that allow you to pass an array of character pointers. Charles The solution proposed by Jugoslav Dujic, from comp lang fortran is #Python script calling fortran subroutine from ctypes import * ap = windll.LoadLibrary

ctypes: error passing a list of str to a fortran dll

2007-06-04 Thread luis
I'm using ctypes to call a fortran dll from python. I have no problems passing integer and double arryas, but I have an error with str arrys. For example: StringVector = c_char_p * len(id) # id is a list of strings Id_dat=StringVector() for i in range(len(Id)): ...Id_dat[i]=id[i] n=c_int

Re: ctypes: error passing a list of str to a fortran dll

2007-06-04 Thread Charles Sanders
luis wrote: I'm using ctypes to call a fortran dll from python. I have no problems passing integer and double arryas, but I have an error with str arrys. For example: [snip] I do not know about Microsoft Fortran compilers (your mention of dll indicates you are probably using MS), nor much

Re: Calling Fortran from Python

2007-04-05 Thread Mangabasi
didn't like them. And SAMPLE became sample_ in the dll. Also note that argument passing to Fortran subroutines is strictly pass-by-reference. Thus the ain pointer. Lenard Lindstrom- Hide quoted text - - Show quoted text - Lenard, Now I tried it as you suggested. I did not install G77 yet. I

Re: Calling Fortran from Python

2007-04-05 Thread Mangabasi
didn't like them. And SAMPLE became sample_ in the dll. Also note that argument passing to Fortran subroutines is strictly pass-by-reference. Thus the ain pointer. Lenard Lindstrom- Hide quoted text - - Show quoted text - A little bit of googling solved the problem. instead of sample

Re: Calling Fortran from Python

2007-04-05 Thread Lenard Lindstrom
Mangabasi wrote: A little bit of googling solved the problem. instead of sample = cdll.sample_dll.SAMPLE I used sample = windll.sample_dll.SAMPLE and now it seems to be working without error messages. Thanks a lot. I remember someone on the ctypes mailing list mentioning

Re: Calling Fortran from Python

2007-04-04 Thread Mangabasi
running config_fc running build_src building extension sample sources creating c:\docume~1\fb\locals~1\temp\tmpcosvgv creating c:\docume~1\fb\locals~1\temp\tmpcosvgv\src f2py: sample.pyf Reading fortran codes... Reading file 'sample.pyf' Post-processing... Block: sample

Re: Calling Fortran from Python

2007-04-04 Thread Mangabasi
There may be a way to finish this without having to deal with distutils. F2py created three files so far samplemodule.c fortranobject.h fortranobject.c Is there a way to create the sample.pyd from these files? -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling Fortran from Python

2007-04-04 Thread Robert Kern
:\\Python24\\include'] running build running config_fc running build_src building extension sample sources creating c:\docume~1\fb\locals~1\temp\tmpcosvgv creating c:\docume~1\fb\locals~1\temp\tmpcosvgv\src f2py: sample.pyf Reading fortran codes... Reading file 'sample.pyf' Post-processing

Re: Calling Fortran from Python

2007-04-04 Thread Mangabasi
Reading fortran codes... Reading file 'sample.pyf' Post-processing... Block: sample Block: sample Post-processing (stage 2)... Building modules... Building module sample... Constructing wrapper function sample

Re: Calling Fortran from Python

2007-04-04 Thread Robert Kern
Mangabasi wrote: I am using Visual Studio 6.0 and Compaq Visual Fortran 6.6. Ah. You can't use VS6 with that version of Python. I believe you need the .NET SDK 2003. You could also use gcc, but I'm not sure if that will work well with Compaq Visual Fortran; you might have to use gfortran

Re: Calling Fortran from Python

2007-04-04 Thread Mangabasi
On Apr 4, 4:39 pm, Robert Kern [EMAIL PROTECTED] wrote: Mangabasi wrote: I am using Visual Studio 6.0 and Compaq Visual Fortran 6.6. Ah. You can't use VS6 with that version of Python. I believe you need the .NET SDK 2003. You could also use gcc, but I'm not sure if that will work well

Re: Calling Fortran from Python

2007-04-04 Thread Robert Kern
Mangabasi wrote: Would Python 2.5 work with Visual Studio 6.6? No. -- 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 --

<    1   2   3   4   >