fortran77

Where can I get the files to install f2c on redhat linux?

不羁的心 提交于 2019-12-04 20:35:16
I am looking for an rpm or simple install instructions for getting f2c to work on my redhat linux os. I am new to linux and it is difficult finding something like this on google. (The goal is to use f2c to convert a simple fortran77 file to c, then compile) Does anybody have any suggestions? Getting the source with rsync (recommended): $ rsync -avz netlib.org::netlib/f2c/src f2c Getting the sources via FTP: $ mkdir -p f2c/src $ cd f2c/src $ ftp ftp.netlib.org ftp> cd f2c ftp> prompt ftp> mget * To build the sources, in the f2c/src directory do: $ make -f makefile.u To install the binary, copy

why change “complex*16” to “complex(16)” cause the runtime increased unreasonably in fortran?

我的未来我决定 提交于 2019-12-04 17:08:55
This fortran code was originally written in Fortran 77 format(I will show it later). After I got it, I changed it into f90 free format via a converting tool. Using intel fortran compiler ifort , the compiation and running is just as fine as before. Then I want to do more, I want to transform nonstandard,obsolete data type declaration f77 style like: real*8 , complex*16 etc into f90 standard real(8) , complex(16) . But I found an unbelievable thing. I just changed one "complex*16" into "complex(16)", then the running time increased from 10 seconds to 2 minutes. How could it be!!?? Can someone

Array of Strings in Fortran 77

天大地大妈咪最大 提交于 2019-12-03 13:40:56
I've a question about Fortran 77 and I've not been able to find a solution. I'm trying to store an array of strings defined as the following: character matname(255)*255 Wich is an array of 255 strings of length 255. Later I read the list of names from a file and I set the content of the array like this: matname(matcount) = mname EDIT: Actually mname value is harcoded as mname = 'AIR' of type character*255 , it is a parameter of a function matadd() wich executes the previous line. But this is only for testing, in the future it will be read from a file. Later on I want to print it with: write(*,

Export custom formatted expressions from Mathematica

試著忘記壹切 提交于 2019-12-03 07:15:29
How can I get Mathematica to export/save/write a text file with proper Fortan77 formatting, that is, 72 columns and a continuation marker on the sixth column? I am using Mathematica to generate large and complex analytic expressions, which I then need to insert into pre-existing Fortran77 code. I have everything working correctly in the front end of Mathematica with FortranForm[] and SetOptions[$Output, PageWidth -> 72] However, I can't figure out how to get Mathematica to output correctly to a text file. I want something like this: MM11 = mH1**2 + (g2**2*v1**2)/2. - - (g2**2*(v1**2/2. - - (

fortran pass character*81 array to c/c++ code

孤者浪人 提交于 2019-12-02 16:09:23
问题 I am a fresh in programming, I wanna to call a fortran function in my c++ code. the thing is I dont know how to pass a fortran character*81 array to my c++. fortran code is like: subroutine func01(a) implicit none character*81 a(2) write(*,*) a(1) write(*,*) a(2) end c++ code is like: #include <iostream> extern "C"{ void func01_( const char **a ); } int main() { const char *a[2]; a[0]="Hello world!"; a[1]="This is a test!"; func01_(a); return 0; } I bascially tested my fortran code using this

Different precision in C++ and Fortran

时光毁灭记忆、已成空白 提交于 2019-12-02 09:07:51
问题 For a project I'm working on I've coded in C++ a very simple function : Fne(x) = 0.124*x*x , the problem is when i compute the value of the function for x = 3.8938458092314270 with both Fortran 77 and C++ languages , i got different precison. For Fortran I got Fne(x) = 1.8800923323458316 and for C++i got Fne(x) = 1.8800923630725743 . For both languages, the Fne function is coded for double precision values, and return also double precision values. C++ code: double FNe(double X) { double FNe

Error: Unexpected end of format string in format string in Fortran

你离开我真会死。 提交于 2019-12-02 08:59:29
问题 Getting this error while trying to compile a copied code from a Fortran 77 program. code: 900 FORMAT(1H0,2X,'ABSOLUTE GRID LIMITS FOR DATA RETENTION FOR RADAR',I3,' XMIN-XMAX ',2F8.3,' YMIN-YMAX ',2F8.3,' ZMAX ',F8.3, /3X,'WITH AZIMUTH LIMITS OF',2F8.2, 3X,'AND RANGE LIMITS OF',2F10.3,/) compiler error: messy21.f90:529.132: N FOR RADAR',I3,' XMIN-XMAX ',2F8.3,' YMIN-YMAX ',2F8.3,' ZMAX ',F8.3, /3X,(1) Error: Unexpected end of format string in format string at (1) I am not sure what the error

fortran pass character*81 array to c/c++ code

独自空忆成欢 提交于 2019-12-02 07:30:23
I am a fresh in programming, I wanna to call a fortran function in my c++ code. the thing is I dont know how to pass a fortran character*81 array to my c++. fortran code is like: subroutine func01(a) implicit none character*81 a(2) write(*,*) a(1) write(*,*) a(2) end c++ code is like: #include <iostream> extern "C"{ void func01_( const char **a ); } int main() { const char *a[2]; a[0]="Hello world!"; a[1]="This is a test!"; func01_(a); return 0; } I bascially tested my fortran code using this program pro01 character*81 a(2) a(1)='Hello world!' a(2)='This is a test!' call func01(a) end program

Different precision in C++ and Fortran

痞子三分冷 提交于 2019-12-02 04:34:37
For a project I'm working on I've coded in C++ a very simple function : Fne(x) = 0.124*x*x , the problem is when i compute the value of the function for x = 3.8938458092314270 with both Fortran 77 and C++ languages , i got different precison. For Fortran I got Fne(x) = 1.8800923323458316 and for C++i got Fne(x) = 1.8800923630725743 . For both languages, the Fne function is coded for double precision values, and return also double precision values. C++ code: double FNe(double X) { double FNe_out; FNe_out = 0.124*pow(X,2.0); return FNe_out; } Fortran code: real*8 function FNe(X) implicit real*8

Error: Unexpected end of format string in format string in Fortran

梦想的初衷 提交于 2019-12-02 03:12:01
Getting this error while trying to compile a copied code from a Fortran 77 program. code: 900 FORMAT(1H0,2X,'ABSOLUTE GRID LIMITS FOR DATA RETENTION FOR RADAR',I3,' XMIN-XMAX ',2F8.3,' YMIN-YMAX ',2F8.3,' ZMAX ',F8.3, /3X,'WITH AZIMUTH LIMITS OF',2F8.2, 3X,'AND RANGE LIMITS OF',2F10.3,/) compiler error: messy21.f90:529.132: N FOR RADAR',I3,' XMIN-XMAX ',2F8.3,' YMIN-YMAX ',2F8.3,' ZMAX ',F8.3, /3X,(1) Error: Unexpected end of format string in format string at (1) I am not sure what the error means. My guess (on the basis of error position in the line, 132) would be: starting from Fortran 90 we