错误:参数中的排名不匹配(等级1和标量) [英] Error: Rank mismatch in argument (rank-1 and scalar)

查看:1666
本文介绍了错误:参数中的排名不匹配(等级1和标量)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了这些错误。

  colsys.f:1367.51:

1 NOLD,ALDIF,K,NCOMP,M,MSTAR (1)(等级1和标量)
colsys.f:814.33:

1 EALPHA,A,IPIV,INTEGS,RNORM,0,FSUB,
1
警告:实际参数对于虚拟参数'integs'(1/3) )

这里给出了程序链接。下面提供的链接中有更多错误。我修复了一些错误。但我不知道如何附加更新后的程序,因为它复制和粘贴时间太长。



http://www4.ncsu.edu/~mtchu/Teaching/Lectures/MA581/colsys.f < a)在程序的声明中(或者是a); b)在程序的声明中(或者是a); b) 函数或者一个子程序)参数 dumm 定义为一个rank-1数组(如果你喜欢但是'rank-1'是你的编译器使用的Fortran术语,则为1维的数组),并且当你的代码调用该过程时,会给它一个标量值。特别要注意的是,标量值与只有一个元素的rank-1数组不同(标记值与参数匹配不同)。



反之亦然



无论哪种方式,过程定义中的参数以及在调用该过程时传递的参数。

第二个错误报告类似,看起来当过程被调用时,它期望一个3元素的数组,但获取只有一个1元素的数组。或者类似的东西。



就我个人而言,我不倾向于在现场寻找更多错误来解决问题。


I am getting these kind of errors.

colsys.f:1367.51:

     1          NOLD, ALDIF, K, NCOMP, M, MSTAR, 3,DUMM,0)              
                                                   1
Warning: Rank mismatch in argument 'dmval' at (1) (rank-1 and scalar)
colsys.f:814.33:

     1          EALPHA, A, IPIV, INTEGS, RNORM, 0, FSUB,                
                                 1
Warning: Actual argument contains too few elements for dummy argument 'integs' (1/3) at (1)

Here I an giving the program link. More errors are there in the link provided below. Some of the errors I fixed. But I don't know how to attach the updated program since it is too long to copy and paste.

http://www4.ncsu.edu/~mtchu/Teaching/Lectures/MA581/colsys.f

解决方案

Either

a) in the declaration of a procedure (either a function or a subroutine) argument dumm is defined to be a rank-1 array (an array with 1 dimension if you prefer but 'rank-1' is the Fortran terminology that your compiler uses) and when your code calls the procedure it is given a scalar value. Note in particular that a scalar value is not the same (for argument matching) as a rank-1 array with only one element.

or

b) vice-versa.

Either way, there is a mismatch between the argument in the procedure definition and the argument passed when the procedure is called.

The second error you report is similar, it seems that when the procedure is called it expects a 3-element array but gets only a 1-element array. Or something like that.

Personally I'm not inclined to follow links off-site in search of more errors to fix.

这篇关于错误:参数中的排名不匹配(等级1和标量)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆