gpt4 book ai didi

fortran - 与实际过程相关的伪参数与伪过程的伪参数不同

转载 作者:行者123 更新时间:2023-12-03 17:31:27 25 4
gpt4 key购买 nike

我正在使用函数 NEQNF从 IMSL Fortran 库中求解非线性方程组并得到 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_ss 中是相同的。和 fcn_ss .

最佳答案

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

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

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

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

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

关于fortran - 与实际过程相关的伪参数与伪过程的伪参数不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53165061/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com