fortran

Prototyping hybrid Python code

I have been mulling over writing a peak fitting library for a while. I know Python fairly well and plan on implementing everything in Python to begin with but envisage that I may have to re-implement some core routines in a compiled language eventually. IIRC, one of Python's original remits was as a prototyping language, however Python ...

Learning FORTRAN In the Modern Era

I've recently come to maintain a large amount of scientific calculation-intensive FORTRAN code. I'm having difficulties getting a handle on all of the, say, nuances, of a forty year old language, despite google & two introductory level books. The code is rife with "performance enhancing improvements". Does anyone have any guides or pr...

What Fortran compilers are there?

What Fortran compilers are there in this day and age, and which would you recommend? Please list the version of Fortran it supports, the platform it works on (e.g. *nix / Windows), and whether it cost money. (Standard OS one per answer etc.) ...

Calling 32bit Code from 64bit Process

I have an application that we're trying to migrate to 64bit from 32bit. It's .NET, compiled using the x64 flags. However, we have a large number of DLLs written in FORTRAN 90 compiled for 32bit. The functions in the FORTRAN DLLs are fairly simple: you put data in, you pull data out; no state of any sort. We also don't spend a lot of...

Is Fortran faster than C?

From time to time I read that Fortran is or can be faster then C for heavy calculations. Is that really true? I must admit that I hardly know Fortran, but the Fortran code I have seen so far did not show that the language has features that C doesn't have. If it is true, please tell me why. Please don't tell me what languages or libs are...

Private function in Fortran

How to declare a private function in Fortran? ...

Fortran Array to C array. Stupid macro tricks wanted

I have this 'simplified' fortran code real B(100, 200) real A(100,200) ... initialize B array code. do I = 1, 100 do J = 1, 200 A(J,I) = B(J,I) end do end do One of the programming gurus warned me, that fortran accesses data efficiently in column order, while c accesses data efficiently in row order. He suggested that I t...

Protected Memory Violation calling FORTRAN DLL from C#

I am trying to call out to a legacy dll compiled from FORTRAN code. I am new to Interop, but I've read some articles on it and it seems like my case should be fairly straightforward. The method I really want to call has a complex method signature, but I can't even call this simple GetVersion method without getting a protected memory ...

Matching FORTRAN rounding in C#

FORTRAN provides several functions to convert a double precision number to an integral value. The method used for truncation/rounding differs. I am converting complex scientific algorithms which use these. According to FORTRAN documentation: aint(x) returns the integral value between x and 0, nearest x. anint(x) returns the nearest in...

mtrace for a fortran program

I'm trying to use mtrace to detect memory leaks in a fortran program. I'm using the gfortran compiler. See the wikipedia entry for a (working) C example of mtrace: http://en.wikipedia.org/wiki/Mtrace I tried both ways, i.e. wrapping the mtrace() and muntrace() and call them from the fortran program, as well as create a C program which ...

Conversion of Fortran 77 code to C++

Has anyone converted a large (ours is 550,000 lines) program of Fortran 77 code to C++ ? What pitfalls did you run into ? Was the conversion a success ? Did you use a tool like for_c ( http://www.cobalt-blue.com/fc/fcmain.htm ) ? Was the resulting C++ code significantly faster or slower ? ...

Should one learn a non-legacy language before learning Fortran?

I’m advising another person who has no programming education or background (beyond trying out AutoLISP and Excel VBA once or twice), who runs scientific simulations using Fortran software written by others and who now finds she’d benefit from being able to program in Fortran herself. I can see two main approaches to this: Learning e.g...

How can I find out which library is home to a given object?

I'm programming in FORTRAN and C on an SGI running Irix 6.5, but this should be applicable to all Unix-like systems. How do I find which library I need to link to my program when I get an "unresolved text symbol" link error? Here's an example of what I'm seeing from the linker: ld32: ERROR 33 Unresolved text symbol "ortho2_" -- first...

Convert Fortran to C or C++

I have some numeric code that I need to convert to C or C++. I tried using f2c, but it won't work on the Fortran code. f2c complains because the code uses C style preprocessor directives (#include). The code's readme states that it is Fortran77, that works with the fort77 linker, that would expand those includes. Does anyone know how t...

write a quick fortran program

How can I write a quick program in fortran. I need to ask 3 questions with an option to exit after each question. ...

FORTRAN problem....

Hi..need help in Fortran... This is the main loop of the program.. do iStep=0,nStep write(7,*)iStep !* Compute new temperature using FTCS scheme. do i=1,N if( istep==0) then !only for t=0 tt_new(i)=250 write(7,*)tt_new(i) else if(i==1) then tt_new(i)=2*coeff*(tt(i+1...

Calling C Code from FORTRAN

Given Microsoft FORTRAN 5.1 and Microsoft C/C++ 14.0, along with the linker that comes with that version of FORTRAN (that must be used for other dependencies) how do I create a C function and call it from the FORTRAN application? ...

Fortran: line to long / append line - but with text at the end?

I have a line of Fortran code, which includes some text. I'm changing the text, which makes the code line too long for Fortran, so I split it over two lines using 'a'. Was: IF (MYVAR .EQ. 1) THEN WRITE(iott,'(A) (A)') 'ABC=', SOMEVAR Changed to: IF (MYVAR .EQ. 1) THEN WRITE(iott,'(A) (A)') 'ABC DEF GHI JK a ' // 'L=', S...

How to identify fortran standard - '77, '90, or '95?

I have a piece of fortran code, and I am not sure which standard it is - '77, '90 or '95. Is there a standard tool to identify which standard it subjects to? ...

FORTRAN, what do you recommend for a development environment

I need to start developing in FORTRAN, any recommendations on learning\developing FORTRAN coming from the .NET area? Any recommended environments that are close to Visual Studio? Visual Fortran looked really promising, but is a bit pricey, and look like it wouldn't compile with gcc. ...