【问题标题】:Dummy argument associated actual procedure differs from dummy argument of the dummy procedure与实际过程相关的伪参数与伪过程的伪参数不同
【发布时间】:2019-04-09 10:36:59
【问题描述】:

我正在使用 IMSL Fortran 库中的函数 NEQNF 来求解非线性方程组并得到 3 个错误。我在 x64 系统上使用 Visual Studio 2017。错误说明如下:

Error #7061: The characterístic of dummy argument 1 of the associated actual procedure differ from the characteristics of dummy argument 1 of the dummy procedure [FCN_SS]


Error #7062: The characterístic of dummy argument 2 of the associated actual procedure differ from the characteristics of dummy argument 2 of the dummy procedure [FCN_SS]

Error #7063: The characterístic of dummy argument 3 of the associated actual procedure differ from the characteristics of dummy argument 3 of the dummy procedure [FCN_SS]

代码是:

    include 'link_fnl_shared.h' 

    use neqnf_int
    use umach_int

    implicit none

!Declaring variables
    .
    .
    .

    Contains

    subroutine solve_ss(x, fnorm)

        integer n
        parameter (n=2)

        integer k, nout
        real(dp) :: fnorm, x(n), xguess(n)

        data xguess/1.0_dp, 0.3_dp/   !guess for total output in units

        call umach (2, nout)
        call neqnf (fcn_ss, x, xguess=xguess, fnorm=fnorm)

    end subroutine solve_ss


    subroutine fcn_ss(x, f, n)

        implicit none

        !specification
        integer n
        real(dp) :: x(n), f(n)

    .
    .
    .

    F(1)=...

    F(2)=...

    end subroutine fcn_ss

我不确定错误是什么,因为solve_ssfcn_ss 中的变量声明是相同的。

【问题讨论】:

  • 尝试调用D_NEQNF 而不是NEQNF(最终也可以使用DNEQNF)。最好制作一个可编译的minimal reproducible example
  • 您拥有 IMSL 包含文件夹中模块 neqnf_int 的源代码。我不再有权访问它,但它是 NUMERICAL_LIBRARIES_F90.f90 或类似的东西。在文本编辑器(或 Visual Studio)中打开它,找到 NEQNF 的声明及其细节,并与您的 FCN_SS 进行比较。

标签: fortran fortran90


【解决方案1】:

该库的文档明确指出(herehere)您需要 use 各个模块才能访问例程的现代实现。

否则,您可能(我无法测试,但我基于this)访问该库的旧版支持。所以,不是通用的 Fortran 90 接口,它可能会引导您到 FORTRAN77 特定的接口:

NEQNF (FCN, ERRREL, N, ITMAX, XGUESS, X, FNORM)

其他细节是文档明确指出您必须将传递的函数声明为外部:

external fcn_ss

不过,我不确定这些猜测。可能是那个或任何其他奇怪的错误。请提供反馈。

【讨论】:

  • 我不确定,实际上。我只是注意到它在文档中说明,但在调用中没有遵循。我仍在尝试在网络上查找函数的来源以比较声明。是否应该更好地转换为评论?
  • 好吧,我认为我们之间的任何人看到编辑都感到困惑......
  • 在我看来,OP 确实使用了一些名称为 NEQNF 的模块。我认为 NEQNF_INT 提供接口。至少顾名思义。
  • 对不起,伙计们。我误读了这个问题,并认为 OP 包含了例程而不是使用模块,所以我写了那个编辑。但后来我意识到他确实使用过,所以编辑不再有意义;这就是我回滚的原因
  • 我不知道答案,所以请选择最适合您想法的版本。我的编辑是基于你的一个,但我选择的那个有一点冲突:它不是故意选择一个。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-05-14
  • 1970-01-01
  • 2015-11-03
  • 1970-01-01
  • 2011-05-12
  • 1970-01-01
相关资源
最近更新 更多