Fortran Coder

查看: 9817|回复: 7
打印 上一主题 下一主题

[数学库] 为什么把imsl的介绍文档里的代码copy下来还是出现错误

[复制链接]

4

帖子

2

主题

0

精华

新人

F 币
23 元
贡献
12 点
跳转到指定楼层
楼主
发表于 2014-4-26 16:00:56 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
刚刚把imsl装好,路径也设置好了,但是我为了验证一下是否能用,就把它给的代码粘贴复制下来,看能不能编译,结果出现了错误:代码如下:
[Fortran] 纯文本查看 复制代码
program testimsluse linear_operators
implicit none
! This is the equivalent of Example 2 for LIN_SOL_SELF using operators
! and functions.
integer, parameter :: m=64, n=32
real(kind(1e0)) :: one=1e0, zero=0e0, err
real(kind(1e0)) A(n,n), b(n), C(m,n), d(m), cov(n,n), x(n)
! Generate a random rectangular matrix and right-hand side.
C = rand(C); d=rand(d)
! Form the normal equations for the rectangular system.
A = C .tx. C; b = C .tx. d
COV = .i. CHOL(A); COV = COV .xt. COV
! Compute the least-squares solution.
x = C .ix. d
! Compare with solution obtained using the inverse matrix.
err = norm(x - (COV .x. b))/norm(cov)
! Scale the inverse to obtain the sample covariance matrix.
COV = sum((d - (C .x. x))**2)/(m-n) * COV
! Check the results.
if (err <= sqrt(epsilon(one))) then
write (*,*) 'Example 2 for LIN_SOL_SELF (operators) is correct.'
end if
end



错误如下:

错误        1        Compilation Aborted (code 1)        G:\fortran\kuang\kuang\kuang\kuang.f90        1        

请问大家这到底是怎么回事?
分享到:  微信微信
收藏收藏 点赞点赞 点踩点踩

954

帖子

0

主题

0

精华

大师

F 币
184 元
贡献
75 点

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

QQ
沙发
发表于 2014-4-26 16:08:49 | 只看该作者
program testimsluse linear_operators
这里应该有个回车
program testimsl
use linear_operators

1963

帖子

12

主题

5

精华

论坛跑堂

臭石头雪球

F 币
1357 元
贡献
574 点

美女勋章热心勋章星光勋章新人勋章贡献勋章管理勋章帅哥勋章爱心勋章规矩勋章元老勋章水王勋章

板凳
发表于 2014-4-26 16:18:37 | 只看该作者
如果还有问题,请提供更多的错误提示吧。

Compilation Aborted 并不是错误提示。

4

帖子

2

主题

0

精华

新人

F 币
23 元
贡献
12 点
地板
 楼主| 发表于 2014-4-26 16:47:56 | 只看该作者
vvt 发表于 2014-4-26 16:08
program testimsluse linear_operators
这里应该有个回车
program testimsl

这个是我粘贴导致的,我编译的时候发现了:
------ Build started: Project: kuang, Configuration: Debug|Win32 ------

Compiling with Intel(R) Visual Fortran Compiler XE 14.0.1.139 [IA-32]...
kuang.f90
G:\fortran\kuang\kuang\kuang\kuang.f90(12): internal error: Please visit 'http://www.intel.com/software/products/support' for assistance.
C = rand(C); d=rand(d)
^
[ Aborting due to internal error. ]
compilation aborted for G:\fortran\kuang\kuang\kuang\kuang.f90 (code 1)

Build log written to  "file://G:\fortran\kuang\kuang\kuang\Debug\BuildLog.htm"
kuang - 1 error(s), 0 warning(s)


---------------------- Done ----------------------

954

帖子

0

主题

0

精华

大师

F 币
184 元
贡献
75 点

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

QQ
5#
发表于 2014-4-26 17:07:11 | 只看该作者
这个有点不常见,intel编译器内部错误了。
你试试看写一个简单的代码编译一下,会不会也这样?

然后试试把
C = rand(C); d=rand(d)
替换为
! Generate a random rectangular matrix and right-hand side.
call RANDOM_SEED()
call random_number(c); call random_number(d)

4

帖子

2

主题

0

精华

新人

F 币
23 元
贡献
12 点
6#
 楼主| 发表于 2014-4-26 17:16:39 | 只看该作者
vvt 发表于 2014-4-26 17:07
这个有点不常见,intel编译器内部错误了。
你试试看写一个简单的代码编译一下,会不会也这样?

也不行,总是报那种错误,我替换成啥,他就报啥的错

1963

帖子

12

主题

5

精华

论坛跑堂

臭石头雪球

F 币
1357 元
贡献
574 点

美女勋章热心勋章星光勋章新人勋章贡献勋章管理勋章帅哥勋章爱心勋章规矩勋章元老勋章水王勋章

7#
发表于 2014-4-26 17:45:31 | 只看该作者
internal error 应该是 IVF 的 BUG,或者不完善。

鉴于使用了 IMSL 的程序才会这样,也可能是 IMSL 的问题,或者与 IVF 不匹配。

因为你的代码在我们这里可以运行,因此怀疑是 IMSL和IVF的版本不兼容。建议去 intel 论坛问问(英文)

1963

帖子

12

主题

5

精华

论坛跑堂

臭石头雪球

F 币
1357 元
贡献
574 点

美女勋章热心勋章星光勋章新人勋章贡献勋章管理勋章帅哥勋章爱心勋章规矩勋章元老勋章水王勋章

8#
发表于 2014-4-26 21:12:48 | 只看该作者
换成 IMSL5.0 就OK了,貌似IMSL与IVF版本不兼容
您需要登录后才可以回帖 登录 | 极速注册

本版积分规则

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

GMT+8, 2024-5-10 01:11

Powered by Tencent X3.4

© 2013-2024 Tencent

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