用 Module 封装,你得调用 F90 接口,F77接口不行
[Fortran] 纯文本查看 复制代码 Module function_equation
contains
Subroutine fcn(xx, yy, nn)
Implicit None
Integer nn
Double Precision xx(nn), yy(nn)
yy(1) = xx(1)**2 + xx(2)**2 - 5D0
yy(2) = (xx(1)+1D0)*xx(2) - (3D0*xx(1)+1D0)
End Subroutine fcn
End Module function_equation
Program main_test
Use neqnf_int
Use umach_int
Use function_equation
Implicit None
Double Precision, Parameter :: errrel = 1D-7
Integer, Parameter :: n = 2
Integer, Parameter :: itmax = 200
Double Precision x_guess(2), ans(2), fnorm
x_guess = (1D0, 1D0)
Call neqnf(fcn, ans, xguess=x_guess, fnorm=fnorm)
Print *, ans
End Program main_test
|