【发布时间】:2011-04-19 04:34:47
【问题描述】:
据我了解,您可以从 Fortran 中的函数返回数组,但由于某种原因,我的代码只返回数组中的第一个值,我要求它返回。这是函数:
function polynomialMult(npts,x,y)
integer npts
double precision x(npts), results(npts + 1), y(npts,npts)
polynomialMult = x(1:npts) + 1
end function
这就是我所说的
C(1:numPoints) = polynomialMult(numPoints,x,f)
print *, C(1:numPoints)`
现在它没有做任何有用的事情,因为我在编写逻辑之前试图理解语法。我看到了一些关于为函数指定类型的东西,但是当我写
integer function polynomialMult(npts,x,y)
或任何我得到的编译错误。
【问题讨论】:
标签: arrays function fortran fortran90