Fortran Coder

标题: 为什么把imsl的介绍文档里的代码copy下来还是出现错误 [打印本页]

作者: shouwangna    时间: 2014-4-26 16:00
标题: 为什么把imsl的介绍文档里的代码copy下来还是出现错误
刚刚把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        

请问大家这到底是怎么回事?

作者: vvt    时间: 2014-4-26 16:08
program testimsluse linear_operators
这里应该有个回车
program testimsl
use linear_operators
作者: fcode    时间: 2014-4-26 16:18
如果还有问题,请提供更多的错误提示吧。

Compilation Aborted 并不是错误提示。
作者: shouwangna    时间: 2014-4-26 16:47
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 ----------------------

作者: vvt    时间: 2014-4-26 17:07
这个有点不常见,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)
作者: shouwangna    时间: 2014-4-26 17:16
vvt 发表于 2014-4-26 17:07
这个有点不常见,intel编译器内部错误了。
你试试看写一个简单的代码编译一下,会不会也这样?

也不行,总是报那种错误,我替换成啥,他就报啥的错
作者: fcode    时间: 2014-4-26 17:45
internal error 应该是 IVF 的 BUG,或者不完善。

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

因为你的代码在我们这里可以运行,因此怀疑是 IMSL和IVF的版本不兼容。建议去 intel 论坛问问(英文)
作者: fcode    时间: 2014-4-26 21:12
换成 IMSL5.0 就OK了,貌似IMSL与IVF版本不兼容




欢迎光临 Fortran Coder (http://bbs.fcode.cn/) Powered by Discuz! X3.2