fortran do construct(do循环)
来源:互联网 发布:网络剧在哪个播放器有 编辑:程序博客网 时间:2024/04/29 19:07
cite from Fortran 90 Handbook by Jeanne C. Adam,Walter S. Brainerd,Jeanne T. Martin,Brian T. Smith,Jerrold L. Wagener
有两种形式的do构造:the block DO and the nonblock DO
块化的do与非块化的do。非块化的do是为了与fortran 77兼容
块化do的一个例子是
DO I = 1, N
SUM = SUM + A (I)
END DO
非块化do的一个例子是
DO 10 I = 1, N
10 SUM = SUM + A (I)
The form of a block DO construct (R817) is:
[ do-construct-name : ] DO [ label ] [ loop-control ]
[ execution-part-construct ] ...
[ label ] end-do
where the forms of the loop control (R821) are:
[ , ] scalar-variable-name = scalar-numeric-expression , &
scalar-numeric-expression [ , scalar-numeric-expression ]
[ , ] WHILE ( scalar-logical-expression )
注:loop control即为循环控制的相关语句比如DO 10 I=1,N
and the forms of the end-do (R824) are:
END DO [ do-construct-name ]
CONTINUE
If the DO statement of a block DO construct has a construct name, the
corresponding end-do must be an END DO statement that has the same
construct name. If the DO statement of a block DO construct does not have
a construct name, the corresponding end-do must not have a construct
name.
如果block DO构造的DO语句有个构造名的话即[do-construct-name]部分,对应的end-do必须是一个有同样构造名的END DO语句。如果DO语句没有构造名,那么对应的end-do也不能有构造名。
If the DO statement does not contain a label, the corresponding end-do
must be an END DO statement. If the DO statement does contain a label,
the corresponding end-do must be identified with the same label. Note that
a block DO construct can never share its terminal statement with another
DO construct, even if it is a labeled statement. If a DO construct does share
its terminal statement with another DO construct, it is a nonblock DO
construct.
如果DO语句不包含标签的话,对应的end-do必须是一个END DO语句。如果DO语句包含标签的话,对应的end-do部分必须以相同的标签识别。block Do构造从不允许与其他的DO构造共享terminal语句(结束语句),即使是一个标签语句。如果一个DO构造与其他的DO构造共享结束语句,那么它就是一个非块化构造(nonblock construct).
The nonblock DO construct is a DO construct that either shares a terminal
statement with another DO construct, or the terminal statement is a construct
or an action statement. The nonblock DO construct always uses a label to
specify the terminal statement of the construct.
nonblock DO构造或者与其它的DO构造共享结束语句或者结束语句是一条构造语句或者动作语句(action statement)。nonblock DO构造通常使用标签来指定该构造的结束语句。
The two forms for a nonblock
DO construct (R826) are:
action-terminated-do-construct
outer-shared-do-construct
where the form of an action terminated DO construct (R827) is:
[ do-construct-name : ] DO label [ loop-control ]
[ execution-part-construct ] ...
label action-statement
and the form of an outer shared DO construct (R830) is:
[ do-construct-name : ] DO label [ loop-control ]
[ execution-part-construct ] ...
label shared-termination-do-construct
where the forms of a shared termination DO construct (R831) are:
outer-shared-do-construct
inner-shared-do-construct
共享终止的DO构造是
外部共享do构造
内部共享do构造
注:外层是共享的do构造,内部是嵌套的共享do构造An inner shared DO construct (R832) is:
内部的共享DO构造是
[ do-construct-name : ] DO label [ loop-control ]
[ execution-part-construct ] ...
label action-statement
integer ::i,j,kdo 2 i=1,10 x(i)=ido 2 j=1,10 y(i)=j*10do 2 k=1,10 z(k)=k*100+x(i)+y(j)2 continuedo i=1,10 write(*,*)z(i)end doend
以上代码输出结果位210,310,410,510,。。1110
三个do循环共用了label为2的语句相当于三句end do。这里相当于do循环的三重嵌套
- fortran do construct(do循环)
- DO循环
- Implied do loop of FORTRAN
- Fortran使用隐形DO循环和reshape给一维和多维数组赋初值
- do
- Do-While循环
- do while 循环
- do-while循环
- 循环do-while
- LISP 7.6 Do循环
- do while 循环语句
- 4. do while循环
- do-while循环:
- do-while循环小记
- do...while循环
- do-while循环
- do-while循环
- do-while循环
- SAPI 包含sphelper.h编译错误解决方案
- AT+CRSM
- 开启Apache mod_rewrite模块
- (转)Android Location的使用!!
- MFC弹出目录选择对话框以及指定弹出的目录
- fortran do construct(do循环)
- 使用jQuery清空file文件域
- WCDMA HSPA(4)
- Linux下Qt程序的调试方法
- 关于各种无法解析的外部符号问题的相应解决方案
- 待读文章
- python日志:easylogger
- CCMenu 菜单
- ClearSilver模板编程