Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
公告
Important Update: Community Platform Migration​. Learn more​>

linspace

yingwu
初学者
3,275 次查看
Could I ask whether this is any Fortran funtion like the function linspace() in matlab? Or I need to implement it by myself. Thanks.
0 项奖励
1 解答
Les_Neilson
重要分销商 II
3,275 次查看
Quoting - yingwu
Could I ask whether this is any Fortran funtion like the function linspace() in matlab? Or I need to implement it by myself. Thanks.

You could use an array construct. Something along the lines of :

real y(100)
real a
integer i

a = 1.5 ! Initial value

y = (/((i*a),i=1,100)/) ! assign to y in increments of 1.5 starting at 1.5


Les

在原帖中查看解决方案

0 项奖励
2 回复数
Les_Neilson
重要分销商 II
3,276 次查看
Quoting - yingwu
Could I ask whether this is any Fortran funtion like the function linspace() in matlab? Or I need to implement it by myself. Thanks.

You could use an array construct. Something along the lines of :

real y(100)
real a
integer i

a = 1.5 ! Initial value

y = (/((i*a),i=1,100)/) ! assign to y in increments of 1.5 starting at 1.5


Les
0 项奖励
yingwu
初学者
3,275 次查看
Quoting - Les Neilson

You could use an array construct. Something along the lines of :

real y(100)
real a
integer i

a = 1.5 ! Initial value

y = (/((i*a),i=1,100)/) ! assign to y in increments of 1.5 starting at 1.5


Les


Thanks so much. It is very helpful.
0 项奖励
回复