I've written a function which calculates the eigenvalues of a 2*2 matrix. It takes a 2*2 matrix as an argument and returns 2 eigenvalues via a 2-element array. I have declared the function in the program unit like this:
real, dimension(2), external :: eigenvalues
But it won't compile, it comes up with this error:
Error: EXTERNAL attr...
An usual read statement in Fortran interrupts the execution of the program until the RETURN key was pressed. I am looking for a statement that reads any pressed key without waiting for the RETURN key. The program should not stop even if no key was pressed.
Thank you for your answer.
Edit:
Here is some source code that should clarify the...
I'm responsible for a number of legacy (F77) programs. On occasion one or another may fail due to attempting to exceed a fixed array size. My usual fix is to way over allocate the offending array.
Does anyone have thoughts or experience on changing these fixed arrays to dynamic and what are the ramifications to the rest of the code in...
I have an input file and the first line contains the following decimal.
0.5053102074297753
I have a Fortran 90 program which reads the file and outputs the value.
read(*,*) answer
write(*,"(F20.16)") answer
This is the output:
0.5053101778030396
Apparently, what is stored is not the same as what is read. The question is, Why?
...
Hey everybody, i am deploying my code from a cluster running on ubuntu onto a cluster with identical hardware, but with red hat and as it seems older gfortran compiler. The source is actually compiled by ifort, but since it is not installed on the red had cluster, i may have to switch to gfortran.
Now the problem is that the code does ...
I have obtained program that is lovely mesh of fortran and c code.
In order for this program to compile it requires a series of libraries that comes precompiled from software vendor. This included among others Intel MKL, MPICH2 etc.
On linux everything works just fine. But on windows I am stuck:
Using the command line, I can compile the...
It is my understanding that you can return an array from a function in Fortran, but for some reason my code is only returning the first value in the array I am asking it to return. This is the function:
function polynomialMult(npts,x,y)
integer npts
double precision x(npts), results(npts + 1), y(npts,npts)
polynomialMult = ...
Hello,
I have a big fortran 77 program. when running under certain constants it runs fine. but, when I change that constants it stoped.
I can not find where is the problem in the code.
Is there any specific software to make a checking for the program during running?? I mean a kind of tracking ......
Thanks in Advance
Ghazooo
...
I have a C function
double* foofunc() {...}
I don't know how to declare the interface in Fortran to call to this C function.
The second question is: if this pointer is supposed to be pointing to GPU device memory. How could I define that in the Fortran interface, i.e. do I need to use DEVICE attribute.
Thanks,
T.
Edit: Use any featu...
We got a 12-core MacPro to do some Monte Carlo calculations. Its Intel Xeon processors have Hyper-Threading (HT) enabled, so in fact there should be 24 processes running in parallel to make them fully utilized. However, our calcs are more efficient to run on 12x100% than 24x50%, so we tried to turn Hyper-Threading off via Processor pane ...
i use ifort and gfortran to compile my Fortran program.
However i also use a coworkers source and he has got a lot of unused variables.
How can i suppress these for the compile, seeing as they are not really an error?
However i dont want to disable -pedantic and -stan in the compiler options and thus want all the other warnings.
ch...
Hi All,
I have some massive (4.6 million lines) data files that I'm trying to edit with fortran. Basically, throughout the files is a series of headers followed by a table of numbers. Something like this:
p he4 blah 99 ggg
1.0e+01 2.0e+01 2.0e+01
2.0e+01 5.0e+01 2.0e+01
.
.
3.2e+-1 2.0e+01 1.0e+00
...
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 R...
One of the most troublesome issues with Fortran 90 is the lack of namespacing. In this previous question "How do you use Fortran 90 module data" from Pete, it has been discussed the main issue of USE behaving like a "from module import *" in python: everything that is declared public in the module is imported as-is within the scope of th...
Is it safe to use the ARPACK eigensolver from different threads at the same time from a program written in C? Or, if ARPACK itself is not thread-safe, is there an API-compatible thread-safe implementation out there? A quick Google search didn't turn up anything useful, but given the fact that ARPACK is used heavily in large scientific ca...
I'm having trouble trying to compile a simple fortran program which uses a module in the same directory.
I have 2 files: test1.f90 which contains the program and modtest.f90 which contains the module.
This is test1.f90:
program test
use modtest
implicit none
print*,a
end program test
This is modtest.f90:
module modtest
impli...
Possible Duplicates:
Code polisher / reformater for C, C++ or Fortran
Best C++ Code Formatter/Beautifier
I have code in C, C++ and Fortran (both f77 and f95) in a strong need for proper indentation (that is: they have none). I remember some tool to fix indentation, although I'm unable to find it, and as far as I recall, it j...
Hi all,
I have been working with a fast multipole code in Fortran. It is a black box to me, and I have been having some strangeness when compiling it on my mac.
I am using version 11.1 of the compiler, I've got a MacBook Pro running a 2.5 GHz Intel Core 2 Duo on Snow Leopard.
The code runs fine when I set the optimization flag to -O...
I am bored to death with such behavior. So in SConstruct file we have the last string like this one:
import compilers, os
env = Environment(ENV = os.environ, TOOLS = ['default'])
def set_compiler(compiler_name):
env.Replace(FORTRAN = compiler_name)
env.Replace(F77 = compiler_name)
env.Replace(F90 = compiler_name)
env.R...
There's something weird going on in my fortran folding. This is the example file
module foo
contains
subroutine hello()
end subroutine hello
subroutine hello()
end subroutine
subroutine hello()
end subroutine
end module foo
subroutine hello()
end subroutine
subroutine hello()
end subroutine
subroutine hello()
end subroutine
an...