为LF编译器识别此代码的Fortran版本 [英] Identify version of Fortran of this code for the LF compiler

查看:149
本文介绍了为LF编译器识别此代码的Fortran版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Fortran的新手.给了我一个应该在Fortran 90中使用的文件,但该文件是使用Lahey Fujitsu编译器进行编译的(稀疏文档指出应使用lf95 filename.f -out compiled_name @imsllf95.cmd进行编译).但是,有些行用c进行了注释,据我所知,这是在Fortran 77中进行注释的方式.此外,矩阵的声明类似于REAL*8, DIMENSION(23,8) :: xxx19,我再次认为这是来自Fortran 77.

I'm new to Fortran. I was given a file that is supposed to be in Fortran 90, but written to be compiled with the Lahey Fujitsu compiler (the sparse documentation states that it should be compiled with lf95 filename.f -out compiled_name @imsllf95.cmd). However, some lines are commented with c, which as I understand was the way to comment in Fortran 77. Also, matrices are declared like REAL*8, DIMENSION(23,8) :: xxx19, which again I think is from Fortran 77.

在大多数情况下,除了需要计算矩阵逆的部分外,我可以使用gfortranifort编译文件.显然,在LF95编译器(使用专有模块IMSLF90)中,使用.i.计算了矩阵逆.如果删除这些反转,则文件可以编译并运行,不会有任何问题(除了错误的结果).

For the most part, I can compile the file with gfortran or ifort except for a section that requires the computation of a matrix inverse. Apparently, in the LF95 compiler (using a propietary module IMSLF90), a matrix inverse was computed with .i.. If I delete those inversions, the file compiles and runs with no problem (apart from the fact that it gives the wrong result).

我正在尝试查找编写此代码的Fortran版本,以便可以搜索以相同版本编写的一些代码,以便可以将代码中的矩阵求逆.

I'm trying to find the version of Fortran this code is written in, so that I can then search for some code written in that same version so that I can invert the matrices in the code.

该文件的扩展名为.f,即使编译说明似乎暗示它是Fortran 95.

The file has extension .f, even though the compiling instructions seem to imply that it is Fortran 95.

这里有一些代码部分:

    PROGRAM estimate_group
    implicit none

    INTEGER :: i,j,k,full,group1
    REAL*8, DIMENSION(500) :: theta_start,theta_input



    OPEN(68, STATUS="REPLACE",file='fit_measures.txt')
c   OPEN(68, file='fit_measures.txt')
    REWIND(68)

    DO full=1,1

        PRINT *, "=================================="
        PRINT *, "FULL LOOP #: ", full
        PRINT *, "=================================="
        WRITE(68, *) "=================================="
        WRITE(68, *) "FULL LOOP #: ", full
        WRITE(68, *) "=================================="   

    DO group1=2,28

c   Additional If statement to focus on top level and scale
c       IF ( ((group1>=22) .AND. (group1<=28)) .OR. (group1==2)) THEN
        IF ( group1==2) THEN

c   READING IN THETA VECTOR FROM PREVIOUS ITERATIONS
c   (starting values taken from prior runs theta output)
c   ====================================================

        IF ((group1==2) .AND. (full==1)) THEN
            theta_input=0.0*theta_input
            OPEN(67, file='theta_input1.txt')
            REWIND(67)
            DO i=1,500
            READ(67,*) theta_input(i)
            END DO
        ELSE
            theta_input=0.0*theta_input
            OPEN(66,file='theta_input.txt')
            REWIND(66)
            DO i=1,500
            READ(66,*) theta_input(i)
            END DO
        END IF


    SUBROUTINE estimate(group1, theta_start)

        INTEGER, INTENT(IN) :: group1
        REAL*8, INTENT(IN), DIMENSION(500) :: theta_start


c   Variable Declarations:\ 

        INTEGER :: i,j,k,m,l,t0,i0,improve,max_m



        REAL*8, DIMENSION(23,8) :: xxx19

    xxx19(1:23,1) = (/554.0,541.1,583.3,593.2,615.8,582.0,582.5,546.5,
     &          538.4,494.1,503.3,494.1,486.9,478.6,432.6,439.6,
     &          380.4,355.4,305.9,271.8,254.6,208.8,202.8/)

推荐答案

Real*8不属于Fortran,也从未属于Fortran.因此,对您的问题的严格回答是,它不是任何年份的Fortran.

Real*8 is not part of Fortran, and has never been part of Fortran. So the strict answer to your question is it is not Fortran of any vintage.

但是,除了Real*8以外,您所显示的内容都是Fortran 90或更高版本.固定源代码形式仍然是该语言的一部分(尽管我会因为使用它而使所有学生不及格),因此它不能指示代码的年代久远.但是,快速浏览以上内容后,我可以看到Fortran 90的标准语言中包含以下功能:

However going on what you have shown apart from Real*8 it is Fortran 90 or later. Fixed source form is still part of the language (though I would fail any students I have for using it) so it not an indicator of the vintage of the code. However after a quick look at the above I can see the following features which came into the standard language in Fortran 90:

  • 混合大小写(字符变量和常量之外)
  • 在符号名称下划线
  • Implicit None
  • ::在变量声明和逗号分隔的属性列表中
  • 超过6个字符的变量名称
  • 双引号()分隔字符串
  • 做...做完(我想您由于某种原因错过了做完,否则上面的片段毫无意义)
  • ==测试相等性
  • Intent用于虚拟参数
  • 数组部分
  • 数组构造函数
  • Mixed case (outside character variables and constants)
  • Underscore in symbol name
  • Implicit None
  • :: in variable declarations and comma separated attribute lists
  • Variable names longer than 6 characters
  • Double inverted commas (") to delimit character strings
  • Do ... End Do (I assume you have missed out the End Do for some reason as otherwise the fragments above make no sense whatsoever)
  • == to test equality
  • Intent for dummy arguments
  • Array sections
  • Array constructors

可能还有其他人.

这篇关于为LF编译器识别此代码的Fortran版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆