Search Results

Search found 231 results on 10 pages for 'fortran'.

Page 3/10 | < Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >

  • fortran complications passing arrays in function

    - by user1514188
    I'm trying to write a program to calculate a cross product of two vectors (input is of "real" type, so for example [1.3 3.4 1,5]). But I keep getting numerous errors: program Q3CW implicit none REAL :: matA(3), matB(3) REAL :: A11, A12, A13 REAL :: B11, B12, B13 real :: productc(3), answer(3) read*,A11, A12, A13 read*,B11, B12, B13 matA = (/A11, A12, A13/) matB = (/B11, B12, B13/) answer = productc(matA, matB) print*,'Answer = ', answer(1), answer(2), answer(3) end program real function productc(matIn1, matIn2) real, dimension(3) :: matIn1, matIn2 productc(1)=(/matIn1(2)*matIn2(3)-matIn1(3)*matIn2(2)/) productc(2)=(/matIn1(3)*matIn2(1)-matIn1(1)*matIn2(3)/) productc(3)=(/matIn1(1)*matIn2(2)-matIn1(2)*matIn2(1)/) end function This is the error I get: Error: Q33333.f95(20) : Statement function definition for pre-existing procedure PRODUCTC; detected at )@= Error: Q33333.f95(21) : Statement function definition for pre-existing procedure PRODUCTC; detected at )@= Error: Q33333.f95(22) : Statement function definition for pre-existing procedure PRODUCTC; detected at )@= Warning: Q33333.f95(23) : Function PRODUCTC has not been assigned a value; detected at FUNCTION@<end-of-statement> Build Result Error(3) Warning(1) Extension(0) Any idea what the problem could be ?

    Read the article

  • fortran error I/O

    - by jpcgandre
    I get this error when compiling: forrtl: severe (256): unformatted I/O to unit open for formatted transfers, unit 27, file C:\Abaqus_JOBS\w.txt The error occurs in the beginning of the analysis. At the start, the file w.txt is created but is empty. The error may be related to the fact that I want to read from an empty file. My code is: OPEN(27, FILE = "C:/Abaqus_JOBS/w.txt", status = "UNKNOWN") READ(27, *, iostat=stat) w IF (stat .NE. 0) CALL del_file(27, stat) SUBROUTINE del_file(uFile, stat) IMPLICIT NONE INTEGER uFile, stat C If the unit is not open, stat will be non-zero CLOSE(unit=uFile, status='delete', iostat=stat) END SUBROUTINE Ref: Close multiple files If you agree with my opion about the cause of the error, is there a way to solve it? Thanks

    Read the article

  • What does the following FORTRAN code do?

    - by Jon Skeet
    C AREA OF A TRIANGLE WITH A STANDARD SQUARE ROOT FUNCTION C INPUT - CARD READER UNIT 5, INTEGER INPUT C OUTPUT - LINE PRINTER UNIT 6, REAL OUTPUT C INPUT ERROR DISPLAY ERROR OUTPUT CODE 1 IN JOB CONTROL LISTING READ (5, 501) IA, IB, IC 501 FORMAT (3I5) C IA, IB, AND IC MAY NOT BE NEGATIVE C FURTHERMORE, THE SUM OF TWO SIDES OF A TRIANGLE C IS GREATER THAN THE THIRD SIDE, SO WE CHECK FOR THAT, TOO IF (IA) 777, 777, 701 701 IF (IB) 777, 777, 702 702 IF (IC) 777, 777, 703 703 IF (IA+IB-IC) 777,777,704 704 IF (IA+IC-IB) 777,777,705 705 IF (IB+IC-IA) 777,777,799 777 STOP 1 C USING HERON'S FORMULA WE CALCULATE THE C AREA OF THE TRIANGLE 799 S = FLOATF (IA + IB + IC) / 2.0 AREA = SQRT( S * (S - FLOATF(IA)) * (S - FLOATF(IB)) * + (S - FLOATF(IC))) WRITE (6, 601) IA, IB, IC, AREA 601 FORMAT (4H A= ,I5,5H B= ,I5,5H C= ,I5,8H AREA= ,F10.2, + 13H SQUARE UNITS) STOP END plz i need to know soon!!!!!

    Read the article

  • FORTRAN: Invalid form for an assignment

    - by Sam Goodness
    I can't get this code to compile uding either the g77 minGW compiler or the g95 compiler. Does anyone know why? I get these errors with the g77: diff5z10.for: In subroutine `diffract': diff5z10.for:579: Tropo100 = 20.34 - .077 * Dist ^ Invalid form for assignment statement at (^) diff5z10.for:581: IF (Freq .GT. 1000) FreqAdj = 24.5 - 7200/(Freq+3000) ^ Invalid form for assignment statement at (^) and i get these errors when compiling with g95: In file diff5z10.for:574 CLUTTER = steep*CLUTTER 1 Error: Unclassifiable statement at (1) In file diff5z10.for:580 FreqAdj = 23.978 - 58026.76 / (Freq + 2320) 1 Error: Unclassifiable statement at (1) here is the code from this section of the program: (starting with line 362) Span = .28 - .144 * (Round - 1.2) Para = C / Span**2 IF (Ratio .GT. .4) Para = 6.25 * (C - 1) CLUTTER = Para * (RATIO - .4)**2 - C IF (CLUTTER .GT. 0.) CLUTTER = 0. CSlope = SQRT(freq)/350 steep = 1 + CSlope * (dist - Horizon) IF (steep .LT. 0) steep = 0 IF (steep .GT. 1) steep = 1 CLUTTER = steep*CLUTTER Tropo100 = 20.34 - .077 * Dist FreqAdj = 23.978 - 58026.76 / (Freq + 2320) IF (Freq .GT. 1000) FreqAdj = 24.5 - 7200/(Freq+3000) TropoFd = Tropo100 - FreqAdj FS_field = 106.9 - 20 * LOG10(Dist) Scatter = TropoFd - FS_field !loss ref to free space DiffL = Scatter - DLOSS Combine = 150/(20 - DiffL) - 5 IF (DiffL .LT. -10) Combine = 0 IF (DiffL .GT. 10) Combine = DiffL DLOSS = DLOSS + Combine RETURN END

    Read the article

  • matlab's fortran's format equivalents

    - by ldigas
    What would be matlab's equivalent of write(1,'("Speed, resistance, power",3f8.2)')(a(i),i=1,3) I've tried a = [10. 20. 200.] fprintf(unit1,'a = 3%8.1e',a) but I'm still having trouble with it (the whole matlab output formatting thing). Edit for Kenny: for the values of a as given above, it would give (in a new row): Speed, resistance, power 10.00 20.00 200.00

    Read the article

  • Are Fortran control characters (carriage control) still implemented in compilers?

    - by CmdrGuard
    In the book Fortran 95/2003 for Scientists and Engineers, there is much talk given to the importance of recognizing that the first column in a format statement is reserved for control characters. I've also seen control characters referred to as carriage control on the internet. To avoid confusion, by control characters, I refer to the characters "1, a blank (i.e. \s), 0, and +" as having an effect on the vertical spacing of output when placed in the first column (character) of a FORMAT statement. Also, see this text-only web page written entirely in fixed-width typeface : Fortran carriage-control (because nothing screams accuracy and antiquity better than prose in monospaced font). I found this page and others like it to be not quite clear. According to Fortran 95/2003 for Scientists and Engineers, failure to recall that the first column is reserved for carriage control can lead to horrible unintended output. Paraphrasing Dave Barry, type the wrong character, and nuclear missiles get fired at Norway. However, when I attempt to adhere to this stern warning, I find that gfortran has no idea what I'm talking about. Allow me to illustrate my point with some example code. I am trying to print out the number Pi: PROGRAM test_format IMPLICIT NONE REAL :: PI = 2 * ACOS(0.0) WRITE (*, 100) PI WRITE (*, 200) PI WRITE (*, 300) PI 100 FORMAT ('1', "New page: ", F11.9) 200 FORMAT (' ', "Single Space: ", F11.9) 300 FORMAT ('0', "Double Space: ", F11.9) END PROGRAM test_format This is the output: 1New page: 3.141592741 Single Space: 3.141592741 0Double Space: 3.141592741 The "1" and "0" are not typos. It appears that gfortran is completely ignoring the control character column. My question, then, is this: Are control characters still implemented in standards compliant compilers or is gfortran simply not standards compliant? For clarity, here is the output of my gfortran -v Using built-in specs. Target: powerpc-apple-darwin9 Configured with: ../gcc-4.4.0/configure --prefix=/sw --prefix=/sw/lib/gcc4.4 --mandir=/sw/share/man --infodir=/sw/share/info --enable-languages=c,c++,fortran,objc,java --with-gmp=/sw --with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib --disable-libjava-multilib --build=powerpc-apple-darwin9 --host=powerpc-apple-darwin9 --target=powerpc-apple-darwin9 Thread model: posix gcc version 4.4.0 (GCC)

    Read the article

  • How do I create a python module from a fortran program with f2py?

    - by Lars Hellemo
    I am trying to read some smps files with python, and found a fortran implementation, so I thought I would give f2py a shot. The problem is that I have no experience with fortran. I have successfully installed gfortran and f2py on my Linux box and ran the example on thew f2py page, but I have some trouble compiling and running the large program. There are two files, one with a file reader wrapper and one with all the logic. They seem to call each other, but when I compile and link or try f2py, I get errors that they somehow can't find each other: f95 -c FILEWR~1.F f95 -c SMPSREAD.F90 f95 -o smpsread SMPSREAD.o FILEWR~1.o FILEWR~1.o In function `file_wrapper_' FILEWR~1.F(.text+0x3d) undefined reference to `chopen_' usrlibgcci486-linux-gnu4.4.1libgfortranbegin.a(fmain.o) In function `main' (.text+0x27) undefined reference to `MAIN__' collect2 ld returned 1 exit status I also tried changing the name to FILE_WRAPPER.F but that did not help. With f2py I found out I had to include a comment to get it to accept free format, and saved this as a new file and tried: f2py -c -m smpsread smpsread.f90 I get a lot of output and warnings, but the error seems to be this one: getctype: No C-type found in "{'typespec': 'type', 'attrspec': ['allocatable'], 'typename': 'node', 'dimension': [':']}", assuming void. The fortran 90 spms reader can be found here. Any help or suggestions appreciated.

    Read the article

  • (For what) Are Fortran, Cobol and Co. used today?

    - by lamas
    I'm a relatively young programmer and so I don't really know much about languages like Fortran or Cobol that have their origins in the beginning of modern informatics. I'm a bit confused because it seems like there are many people out there saying that these two languages are still very alive and being used all over the world whereas others say the opposite. In addition, it seems like there are only very few questions tagged Fortran or Cobol here on stackoverflow. Can someone "demystify" the situation for me? Who uses these senior languages these days and are they even used anymore? Do you have any experiences with one of the languages or do you know something about their latest developments?

    Read the article

  • Can functions like sin() be redefined, in Fortran, C or Java?

    - by EOL
    Can a mathematical function like sin() be redefined, in Fortran, C or Java code, while preserving the default behavior of other mathematical functions like cos()? Or can another function named sin() but that accepts different argument types be defined in addition to the built-in sin()? I am interested in general features of these languages (I am thinking of applications like the implementation of non-usual number algebras). I tried to define a sin() function in a Fortran 95 program, but the intrinsic sin() function was called instead… Is there a way around this? what about C and Java?

    Read the article

  • Are local variables in Fortran 77 static or stack dynamic?

    - by mm2887
    For my programming languages class one hw problem asks: Are local variables in FORTRAN static or stack dynamic? Are local variables that are INITIALIZED to a default value static or stack dynamic? Show me some code with an explanation to back up your answer. Hint: The easiest way to check this is to have your program test the history sensitivity of a subprogram. Look at what happens when you initialize the local variable to a value and when you don’t. You may need to call more than one subprogram to lock in your answer with confidence. I wrote a few subroutines: - create a variable - print the variable - initialize the variable to a value - print the variable again Each successive call to the subroutine prints out the same random value for the variable when it is uninitialized and then it prints out the initialized value. What is this random value when the variable is uninitialized? Does this mean Fortran uses the same memory location for each call to the subroutine or it dynamically creates space and initializes the variable randomly? My second subroutine also creates a variable, but then calls the first subroutine. The result is the same except the random number printed of the uninitialized variable is different. I am very confused. Please help! Thank you so much.

    Read the article

  • Where can I find BLAS example code (in Fortran)?

    - by Feynman
    I have been searching for decent documentation on blas, and I have found some 315 pages of dense material that ctrl-f does not work on. It provides all the information regarding what input arguments the routines take, but there are a LOT of input arguments and I could really use some example code. I am unable to locate any. I know there has to be some or no one would be able to use these libraries! Specifically, I use ATLAS installed via macports on a mac osx 10.5.8 and I use gfortran from gcc 4.4 (also installed via macports). I am coding in Fortran 90. I am still quite new to Fortran, but I have a fair amount of experience with mathematica, matlab, perl, and shell scripting. I would like to be able to initialize and multiply a dense complex vector by a dense symmetric (but not hermitian) complex matrix. The elements of the matrix are defined through a mathematical function of the indices--call it f(i,j). Could anyone provide some code or a link to some code?

    Read the article

  • Is it possible to read Fortran formatted data in Python?

    - by Werner
    I get output files from very old Fortran programs, which look like: 0.81667E+00 -0.12650E+01 -0.69389E-03 0.94381E+00 -0.11985E+01 -0.11502E+00 0.96064E+00 -0.11333E+01 -0.17616E+00 0.10202E+01 -0.12435E+01 -0.93917E-01 0.10026E+01 -0.10904E+01 -0.15108E+00 0.90516E+00 -0.11030E+01 -0.19139E+00 0.98624E+00 -0.11598E+01 -0.22970E+00 Is it possible to read this in Python and convert the numbers to "normal" floats?

    Read the article

  • How can I left-justify numerical output in fortran?

    - by mishaF
    I am writing some simple output in fortran, but I want whitespace delimiters. If use the following statement, however: format(A20,ES18.8,A12,ES18.8) I get output like this: p001t0000 3.49141273E+01obsgp_oden 1.00000000E+00 I would prefer this: p001t0000 3.49141273E+01 obsgp_oden 1.00000000E+00 I tried using negative values for width (like in Python) but no dice. So, is there a way to left-justify the numbers? Many thanks in advance!

    Read the article

  • Attempting my first fortran 95 program, to solve quadratic eqn. Getting weird errors.

    - by Damon
    So, I'm attempting my first program in Fortran, trying to solve quadratic eqn. I have double and triple checked my code and don't see anything wrong. I keep getting "Invalid character in name at (1)" and "Unclassifiable statement at (1)" at various locations. Any help would be greatly appreciated... ! This program solves quadratic equations ! of the form ax^2 + bx + c = 0. ! Record: ! Name: Date: Notes: ! Damon Robles 4/3/10 Original Code PROGRAM quad_solv IMPLICIT NONE ! Variables REAL :: a, b, c REAL :: discrim, root1, root2, COMPLEX :: comp1, comp2 CHARACTER(len=1) :: correct ! Prompt user for coefficients. WRITE(*,*) "This program solves quadratic equations " WRITE(*,*) "of the form ax^2 + bx + c = 0. " WRITE(*,*) "Please enter the coefficients a, b, and " WRITE(*,*) "c, separated by commas:" READ(*,*) a, b, c WRITE(*,*) "Is this correct: a = ", a, " b = ", b WRITE(*,*) " c = ", c, " [Y/N]? " READ(*,*) correct IF correct = N STOP IF correct = Y THEN ! Definition discrim = b**2 - 4*a*c ! Calculations IF discrim > 0 THEN root1 = (-b + sqrt(discrim))/(2*a) root2 = (-b - sqrt(discrim))/(2*a) WRITE(*,*) "This equation has two real roots. " WRITE(*,*) "x1 = ", root1 WRITE(*,*) "x2 = ", root2 IF discrim = 0 THEN root1 = -b/(2*a) WRITE(*,*) "This equation has a double root. " WRITE(*,*) "x1 = ", root1 IF discrim < 0 THEN comp1 = (-b + sqrt(discrim))/(2*a) comp2 = (-b - sqrt(discrim))/(2*a) WRITE(*,*) "x1 = ", comp1 WRITE(*,*) "x2 = ", comp2 PROGRAM END quad_solv Thanks in advance!

    Read the article

  • Greenspun's Tenth Rule, does every large project include a Lisp interpreter?

    - by casualcoder
    Greenspun's tenth rule (actually the only rule) states that: Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp. My memory is that there are some papers on the topic, perhaps for Borland's Quattro (spreadsheet) project and possibly others. Google is unhelpful, maybe the right search terms are not coming to mind. I am looking for papers or articles supporting this claim, if any.

    Read the article

  • Simultanious process mysteriously ending

    - by Matt
    I'm trying to run a large air quality model, written in FORTRAN, setup with bash scripts, and run in a work queue (slurm.) The first part of the modeling is to run an "entry" model, this runs with MPI in the work queue but only on one process. At one point in the logs, there's a mysterious FORTRAN STOP, and then later the model fails because something wasn't set up properly. This FORTRAN STOP isn't from the main process, which continues running. This is a huge model, but as far as I know there should not be any other processes running at the same time. It consistently fails at the exact same spot. (I can move it by adding debug, but the debug is in the main process) How can I determine what this process is? I've tried added a call to strace -feprocess $SHELL in the run script, but I'm new to this, so if it has offered any info, I haven't been able to use it yet. The is no trace output around the FORTRAN STOP. The whole process occurs so fast that I can't seem to observe it by using ps. Is there a way I can somehow monitor all the processes being initiated from the time the work queue starts? Or some other way I can figure out what is failing? This is running on CentOS 6.4, with Slurm, compiled with PGI 13.

    Read the article

  • What is wrong with this Fortran '77 snippet?

    - by notJim
    I've been tasked with maintaing some legacy fortran code, and I'm having trouble getting it to compile with gfortran. I've written a fair amount of Fortran 95, but this is my first experience with Fortran 77. This snippet of code is the problematic one: CHARACTER*22 IFILE, OFILE IFILE='TEST.IN' OFILE='TEST.OUT' OPEN(5,FILE=IFILE,STATUS='NEW') OPEN(6,FILE=OFILE,STATUS='NEW') common/pabcde/nfghi When I compile with gfortran file.FOR, all lines starting with the common statement are errors (e.g. Error: Unexpected COMMON statement at (1) for each following line until it hits the 25 error limit). I compiled with -Wall -pedantic, but fixing the warnings did not fix this problem. The crazy thing is that if I comment out all 4 lines starting with IF='TEST.IN', the program compiles and works as expected, but I must comment out all of them. Leaving any of them uncommented gives me the same errors starting with the common statement. If I comment out the common statement, I get the same errors, just starting on the following line. I am on OS X Leopard (not Snow Leopard) using gfortran. I've used this very system with gfortran extensively to write Fortran 95 programs, so in theory the compiler itself is sane. What the hell is going on with this code?

    Read the article

  • Unable to install Eclipse manually

    - by veerendar
    I have just started Linux. I have a SBC(Atom processor) on which I have installed Ubuntu 12.04 and now I am trying to install Fortran IDE. For which I have learnt that I need to install OpenJDK first, then Eclipse Juno and at last the Phortran plugin for Eclipse. I have no Internet access so I had follow the below steps for manual installation. First download the eclipse tar.gz package (downloaded: eclipse-parallel-juno-linux-gtk.tar). Then right-click the eclipse tar.gz and choose the extract here option to extract the tar.gz package.You can also use the command line to extract the tar.gz package. # tar xzf eclipse-cpp-juno-linux-gtk.tar.gz Move to /opt/ folder. # mv eclipse /opt/ Use sudo if the above command gives permission denied message. # sudo mv eclipse /opt/ Create a desktop file and place it into /usr/share/applications # sudo gedit /usr/share/applications/eclipse.desktop and copy the following to the eclipse.desktop file [Desktop Entry] Name=Eclipse Type=Application Exec=/opt/eclipse/eclipse Terminal=false Icon=/opt/eclipse/icon.xpm Comment=Integrated Development Environment NoDisplay=false Categories=Development;IDE Name[en]=eclipse.desktop Create a symlink in /usr/local/bin using # cd /usr/local/bin # sudo ln -s /opt/eclipse/eclipse Now its the time to launch eclipse. # /opt/eclipse/eclipse -clean & Now at step 5, when I type the command sudo ln -s /opt/eclipse/eclipse , I get an this error message: ln: Failed to create symbolic link './eclipse': File exists. Please help me in resolving this.

    Read the article

  • Fortran 90 How to call a function in a subroutine in a module?

    - by Feynman
    I have a module that "contains" a subroutine that "contains" a function. I say "use themodule" in my main program and I can "call thesubroutine", but how to I get the function that is "contained" in the subroutine? The code looks like this: module useful integer, parameter :: N=2 double precision, parameter :: xmin=1, xmax=10, pi=3.1415926535898 double complex :: green(N,N), solution(N), k=(2.0,0.0) contains subroutine y(n1) contains function x(n1) real :: n1, x x=n1*(xmax-xmin)/N end function x end subroutine y end module useful

    Read the article

  • How to break out of a nested parallel (OpenMP) Fortran loop idiomatically?

    - by J.F. Sebastian
    Here's sequential code: do i = 1, n do j = i+1, n if ("some_condition") then result = "here's result" return end if end do end do Is there a cleaner way to execute iterations of the outer loop concurrently other than: !$OMP PARALLEL private(i,j) !$OMP DO do i = 1, n if (found) goto 10 do j = i+1, n if (found) goto 10 if ("some_condition") then !$OMP CRITICAL !$OMP FLUSH if (.not.found) then found = .true. result = "here's result" end if !$OMP FLUSH !$OMP END CRITICAL goto 10 end if end do 10 continue end do !$OMP END DO NOWAIT !$OMP END PARALLEL

    Read the article

  • Recompiling an old fortran 2/4\66 program that was compiled for os\2 need it to run in dos

    - by Mike Hansen
    I am helping an old scientist with some problems and have 1 program that he found and modified about 20 yrs. ago, and runs fine as a 32 bit os\2 executable but i need it to run under dos! I am not a programmer but a good hardware & software man, so I'am pretty stupid about this problem, but here go's I have downloaded 6 different compilers watcom77,silverfrost ftn95,gfortran,2 versions of g77 and f80. Watcom says it is to old of program,find older compiler,silverfrost opens it,debugs, etc. but is changing all the subroutines from "real" to "complex" and vice-vesa,and the g77's seem to install perfectly (library links and etc.) but wont even compile the test.f programs.My problem is 1; to recompile "as is" or "upgrade" the code? PROGRAM xconvlv INTEGER N,N2,M PARAMETER (N=2048,N2=2048,M=128) INTEGER i,isign REAL data(n),respns(m),resp(n),ans(n2),t3(n),DUMMY OPEN(UNIT=1, FILE='C:\QKBAS20\FDATA1.DAT') DO 1 i=1,N READ(1,*) T3(i), data(i), DUMMY continue CLOSE(UNIT-1) do 12 i=1,N respns(i)=data(i) resp(i)=respns(i) continue isign=-1 call convlv(data,N,resp,M,isign,ans) OPEN(UNIT=1,FILE='C:\QKBAS20\FDATA9.DAT') DO 14 i=1,N WRITE(1,*) T3(i), ans(i) continue END SUBROUTINE CONVLV(data,n,respns,m,isign,ans) INTEGER isign,m,n,NMAX REAL data(n),respns(n) COMPLEX ans(n) PARAMETER (NMAX=4096) * uses realft, twofft INTEGER i,no2 COMPLEX fft (NMAX) do 11 i=1, (m-1)/2 respns(n+1-i)=respns(m+1-i) continue do 12 i=(m+3)/2,n-(m-1)/2 respns(i)=0.0 continue call twofft (data,respns,fft,ans,n) no2=n/2 do 13 i=1,no2+1 if (isign.eq.1) then ans(i)=fft(i)*ans(i)/no2 else if (isign.eq.-1) then if (abs(ans(i)) .eq.0.0) pause ans(i)=fft(i)/ans(i)/no2 else pause 'no meaning for isign in convlv' endif continue ans(1)=cmplx(real (ans(1)),real (ans(no2+1))) call realft(ans,n,-1) return END SUBROUTINE realft(data,n,isign) INTEGER isign,n REAL data(n) * uses four1 INTEGER i,i1,i2,i3,i4,n2p3 REAL c1,c2,hli,hir,h2i,h2r,wis,wrs DOUBLE PRECISION theta,wi,wpi,wpr,wr,wtemp theta=3.141592653589793d0/dble(n/2) cl=0.5 if (isign.eq.1) then c2=-0.5 call four1(data,n/2,+1) else c2=0.5 theta=-theta endif (etc.,etc., etc.) SUBROUTINE twofft(data,data2,fft1,fft2,n) INTEGER n REAL data1(n,data2(n) COMPLEX fft1(n), fft2(n) * uses four1 INTEGER j,n2 COMPLEX h1,h2,c1,c2 c1=cmplx(0.5,0.0) c2=cmplx(0.0,-0.5) do 11 j=1,n fft1(j)=cmplx(data1(j),data2(j) continue call four1 (fft1,n,1) fft2(1)=cmplx(aimag(fft1(1)),0.0) fft1(1)=cmplx(real(fft1(1)),0.0) n2=n+2 do 12 j=2,n/2+1 h1=c1*(fft1(j)+conjg(fft1(n2-j))) h2=c2*(fft1(j)-conjg(fft1(n2-j))) fft1(j)=h1 fft1(n2-j)=conjg(h1) fft2(j)=h2 fft2(n2-j)=conjg(h2) continue return END SUBROUTINE four1(data,nn,isign) INTEGER isign,nn REAL data(2*nn) INTEGER i,istep,j,m,mmax,n REAL tempi,tempr DOUBLE PRECISION theta, wi,wpi,wpr,wr,wtemp n=2*nn j=1 do 11 i=1,n,2 if(j.gt.i)then tempr=data(j) tempi=data(j+1) (etc.,etc.,etc.,) continue mmax=istep goto 2 endif return END There are 4 subroutines with this that are about 3 pages of code and whould be much easier to e-mail to someone if their able to help me with this.My e-mail is [email protected] , or if someone could tell me where to get a "working" compiler that could recompile this? THANK-YOU, THANK-YOU,and THANK-YOU for any help with this! The errors Iam getting are; 1.In a call to CONVLV from another procedure,the first argument was of a type REAL(kind=1), it is now a COMPLEX(kind=1) 2.In a call to REALFT from another procedure, ... COMPLEX(kind=1) it is now a REAL(kind=1) 3.In a call to TWOFFT from...COMPLEX(kind-1) it is now a REAL(kind=1) 4.In a previous call to FOUR1, the first argument was of a type REAL(kind=1) it is now a COMPLEX(kind=1).

    Read the article

  • Fortran severe (40) Error... Help?!

    - by Taka
    I can compile but when I run I get this error "forrtl: severe (40): recursive I/O operation, unit -1, file unknown" if I set n = 29 or more... Can anyone help with where I might have gone wrong? Thanks. PROGRAM SOLUTION IMPLICIT NONE ! Variable Declaration INTEGER :: i REAL :: dt DOUBLE PRECISION :: st(0:9) DOUBLE PRECISION :: stmean(0:9) DOUBLE PRECISION :: first_argument DOUBLE PRECISION :: second_argument DOUBLE PRECISION :: lci, uci, mean REAL :: exp1, n REAL :: r, segma ! Get inputs WRITE(*,*) 'Please enter number of trials: ' READ(*,*) n WRITE(*,*) dt=1.0 segma=0.2 r=0.1 ! For n Trials st(0)=35.0 stmean(0)=35.0 mean = stmean(0) PRINT *, 'For ', n ,' Trials' PRINT *,' 1 ',st(0) ! Calculate results DO i=0, n-2 first_argument = r-(1/2*(segma*segma))*dt exp1 = -(1/2)*(i*i) second_argument = segma*sqrt(dt)*((1/sqrt(2*3.1416))*exp(exp1)) st(i+1) = st(i) * exp(first_argument+second_argument) IF(st(i+1)<=20) THEN stmean(i+1) = 0.0 st(i+1) = st(i) else stmean(i+1) = st(i+1) ENDIF PRINT *,i+2,' ',stmean(i+1) mean = mean+stmean(i+1) END DO ! Output results uci = mean+(1.96*(segma/sqrt(n))) lci = mean-(1.96*(segma/sqrt(n))) PRINT *,'95% Confidence Interval for ', n, ' trials is between ', lci, ' and ', uci PRINT *,'' END PROGRAM SOLUTION

    Read the article

  • reading newlines with FORMAT statement

    - by peter.murray.rust
    I'm writing a preprocessor and postprocessor for Fortran input and output using FORMAT-like statements (there are reasons not to use a FORTRAN library). I want to treat the new line ("/") character correctly. I don't have a Fortran compiler immediately to hand. Is there a simple algorithm for working out how many newlines are written or consumed (This post just gives reading examples) [Please assume a FORTRAN77-like mentality in the FORTRAN code and correct any FORTRAN syntax on my part] UPDATE: no comments yet so I am reduced to finding a compiler and running it myself. I'll post the answers if I'm not beaten to it. No-one commented I had the format syntax wrong. I've changed it but there may still be errors Assume datafile 1 a b c d etc... (a) does the READ command always consume a newline? does READ(1, '(A)') A READ(1, '(A)') B give A='a' and B='b' (b) what does READ(1,'(A,/)') A READ(1,'(A)') B give for B? (I would assume 'c') (c) what does READ(1, '(/)') READ(1, '(A)') A give for A (is it 'b' or 'c') (d) what does READ(1,'(A,/,A)') A, B READ(1,'(A)') C give for A and B and C(can I assume 'a' and 'b' and 'c') (e) what does READ(1,'(A,/,/,A)') A, B READ(1,'(A)') C give for A and B and C(can I assume 'a' and 'c' and 'd')? Are there any cases in which the '/' is redundant?

    Read the article

  • Xcode with fortran

    - by fraguas
    Hi. I'm trying to compile some fortran files in Xcode, using a makefile made by me. The problem is that Xcode can't find gfortran compiler. I have it, because if I go to console and try to compile from there it works well. Do you know how to add fortran compiler to Xcode. Thanks in advance

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >