我的理解是,在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)
或者任何我得到的编译错误。
https://stackoverflow.com/questions/3828094
复制相似问题