Fortran Coder

查看: 8574|回复: 6
打印 上一主题 下一主题

[数学库] 调用imsl的 DN2QNJ出现错误

[复制链接]

21

帖子

4

主题

0

精华

入门

F 币
87 元
贡献
50 点
跳转到指定楼层
楼主
发表于 2018-6-14 20:33:58 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

test.txt (12.46 KB, 下载次数: 4)

调用imsl的 DN2QNJ的时候(封装在module中)出现以下错误提示:
1>C:\Users\wenv\source\repos\Console5\Console5\Source1.f90(238): error #7061: The characteristics of dummy argument 1 of the associated actual procedure differ from the characteristics of dummy argument 1 of the dummy procedure.   [FCN]
1>C:\Users\wenv\source\repos\Console5\Console5\Source1.f90(238): error #7062: The characteristics of dummy argument 2 of the associated actual procedure differ from the characteristics of dummy argument 2 of the dummy procedure.   [FCN]
1>C:\Users\wenv\source\repos\Console5\Console5\Source1.f90(238): error #7063: The characteristics of dummy argument 3 of the associated actual procedure differ from the characteristics of dummy argument 3 of the dummy procedure.   [FCN]
1>C:\Users\wenv\source\repos\Console5\Console5\Source1.f90(238): error #7061: The characteristics of dummy argument 1 of the associated actual procedure differ from the characteristics of dummy argument 1 of the dummy procedure.   [LSJAC]
1>C:\Users\wenv\source\repos\Console5\Console5\Source1.f90(238): error #7062: The characteristics of dummy argument 2 of the associated actual procedure differ from the characteristics of dummy argument 2 of the dummy procedure.   [LSJAC]
1>C:\Users\wenv\source\repos\Console5\Console5\Source1.f90(238): error #7063: The characteristics of dummy argument 3 of the associated actual procedure differ from the characteristics of dummy argument 3 of the dummy procedure.   [LSJAC]




调用指令如下:
program kakusann

Include 'link_fnl_shared.h'
!use numerical_libraries
use DN2QNJ_int
USE UMACH_INT
USE Inverse


call  DN2QNJ (FCN, LSJAC, ERRREL, N, ITMAX, XGUESS, X, FNORM, FVEC, FJAC, R, QTF, WK)


具体代码在附件里面,希望得到大佬的帮助,谢谢。
分享到:  微信微信
收藏收藏 点赞点赞 点踩点踩

954

帖子

0

主题

0

精华

大师

F 币
184 元
贡献
75 点

规矩勋章元老勋章新人勋章水王勋章热心勋章

QQ
沙发
发表于 2018-6-15 07:49:44 | 只看该作者
[Fortran] 纯文本查看 复制代码
  subroutine fcn(X,F,N)
    integer, intent(in) :: n    
    real(kind(1d0)), intent(in) :: x(n)  
    real(kind(1d0)), intent(out) :: f(n) 

subroutine lsjac(n,X,fjac)
  integer::i1,j1
  integer, intent(in) :: n                                                         
  real(kind(1d0)), intent(in) :: x(n)                                              
  real(kind(1d0)), intent(out) :: fjac(n,n) 

21

帖子

4

主题

0

精华

入门

F 币
87 元
贡献
50 点
板凳
 楼主| 发表于 2018-6-15 09:56:57 | 只看该作者
vvt 发表于 2018-6-15 07:49
[mw_shl_code=fortran,true]  subroutine fcn(X,F,N)
    integer, intent(in) :: n   
    real(kind(1d0 ...

谢谢回复,貌似是能成功调用函数了,但是又出现了新的问题。也没有错误提示。您知道C:\Users\wenv\Desktop\zhao是什么意思吗?

954

帖子

0

主题

0

精华

大师

F 币
184 元
贡献
75 点

规矩勋章元老勋章新人勋章水王勋章热心勋章

QQ
地板
发表于 2018-6-15 10:41:34 | 只看该作者
这个问题需要精细的单步调试才能找到原因。

21

帖子

4

主题

0

精华

入门

F 币
87 元
贡献
50 点
5#
 楼主| 发表于 2018-6-15 15:45:41 | 只看该作者
vvt 发表于 2018-6-15 10:41
这个问题需要精细的单步调试才能找到原因。

谢谢回复。问题解决了,出错是数组越界。但我有一点不明白。
我有两台电脑,一个mac,一个windows。都装的ivf。mac用终端运行,windows用vs。
一模一样的代码,mac能运行,windows就会出问题。
比如数组
integer::i
real::a(3)


do i=1,3
a(i+2)=i
end do

在mac会出结果a(3)=1,a(4)=2,a(5)=3
但在windos就会报错,说数组越界。
您知道这个是什么原因吗?

954

帖子

0

主题

0

精华

大师

F 币
184 元
贡献
75 点

规矩勋章元老勋章新人勋章水王勋章热心勋章

QQ
6#
发表于 2018-6-15 15:54:42 | 只看该作者
本帖最后由 vvt 于 2018-6-15 15:58 编辑

跟操作系统没关系呀,主要是编译器的默认参数不一样。
ivf 用VS编译,会默认检查数组越界,而命令行则不会

命令行可以加选项 -check:bounds 使其增加越界检查。

21

帖子

4

主题

0

精华

入门

F 币
87 元
贡献
50 点
7#
 楼主| 发表于 2018-6-16 22:58:06 | 只看该作者
vvt 发表于 2018-6-15 15:54
跟操作系统没关系呀,主要是编译器的默认参数不一样。
ivf 用VS编译,会默认检查数组越界,而命令行则不会
...

谢谢回复,解决了我很大的困惑。
您需要登录后才可以回帖 登录 | 极速注册

本版积分规则

捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )

GMT+8, 2024-4-27 07:08

Powered by Tencent X3.4

© 2013-2024 Tencent

快速回复 返回顶部 返回列表