-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhw2mod2-f2pywrappers2.f90
164 lines (156 loc) · 5.06 KB
/
hw2mod2-f2pywrappers2.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
! -*- f90 -*-
! This file is autogenerated with f2py (version:2)
! It contains Fortran 90 wrappers to fortran functions.
subroutine f2pywrap_cost_costj (x, j, f2py_x_d0)
use cost, only : costj
real(kind=8) j
integer f2py_x_d0
real(kind=8) x(f2py_x_d0)
call costj(x, j)
end subroutine f2pywrap_cost_costj
subroutine f2pywrap_cost_costj_grad2d (x, j_grad, f2py_x_d0)
use cost, only : costj_grad2d
integer f2py_x_d0
real(kind=8) x(f2py_x_d0)
real(kind=8) j_grad(size(x))
call costj_grad2d(x, j_grad)
end subroutine f2pywrap_cost_costj_grad2d
subroutine f2pywrap_cost_costj_hess2d (x, j_hess, f2py_x_d0)
use cost, only : costj_hess2d
integer f2py_x_d0
real(kind=8) x(f2py_x_d0)
real(kind=8) j_hess(size(x),size(x))
call costj_hess2d(x, j_hess)
end subroutine f2pywrap_cost_costj_hess2d
subroutine f2pywrap_cost_add_noise (x, j, f2py_x_d0)
use cost, only : add_noise
real(kind=8) j
integer f2py_x_d0
real(kind=8) x(f2py_x_d0)
call add_noise(x, j)
end subroutine f2pywrap_cost_add_noise
subroutine f2pyinitcost(f2pysetupfunc)
use cost, only : c_noise
use cost, only : c_noise_amp
interface
subroutine f2pywrap_cost_costj (x, j, f2py_x_d0)
real(kind=8) j
integer f2py_x_d0
real(kind=8) x(f2py_x_d0)
end subroutine f2pywrap_cost_costj
subroutine f2pywrap_cost_costj_grad2d (x, j_grad, f2py_x_d0)
integer f2py_x_d0
real(kind=8) x(f2py_x_d0)
real(kind=8) j_grad(size(x))
end subroutine f2pywrap_cost_costj_grad2d
subroutine f2pywrap_cost_costj_hess2d (x, j_hess, f2py_x_d0)
integer f2py_x_d0
real(kind=8) x(f2py_x_d0)
real(kind=8) j_hess(size(x),size(x))
end subroutine f2pywrap_cost_costj_hess2d
subroutine f2pywrap_cost_add_noise (x, j, f2py_x_d0)
real(kind=8) j
integer f2py_x_d0
real(kind=8) x(f2py_x_d0)
end subroutine f2pywrap_cost_add_noise
end interface
external f2pysetupfunc
call f2pysetupfunc(c_noise,c_noise_amp,f2pywrap_cost_costj,f2pywra&
&p_cost_costj_grad2d,f2pywrap_cost_costj_hess2d,f2pywrap_cost_add_n&
&oise)
end subroutine f2pyinitcost
subroutine f2py_hw2_getdims_xpath(r,s,f2pysetdata,flag)
use hw2, only: d => xpath
integer flag
external f2pysetdata
logical ns
integer r,i,j
integer(8) s(*)
ns = .FALSE.
if (allocated(d)) then
do i=1,r
if ((size(d,i).ne.s(i)).and.(s(i).ge.0)) then
ns = .TRUE.
end if
end do
if (ns) then
deallocate(d)
end if
end if
if ((.not.allocated(d)).and.(s(1).ge.1)) then
allocate(d(s(1),s(2)))
end if
if (allocated(d)) then
do i=1,r
s(i) = size(d,i)
end do
end if
flag = 1
call f2pysetdata(d,allocated(d))
end subroutine f2py_hw2_getdims_xpath
subroutine f2py_hw2_getdims_jpath(r,s,f2pysetdata,flag)
use hw2, only: d => jpath
integer flag
external f2pysetdata
logical ns
integer r,i,j
integer(8) s(*)
ns = .FALSE.
if (allocated(d)) then
do i=1,r
if ((size(d,i).ne.s(i)).and.(s(i).ge.0)) then
ns = .TRUE.
end if
end do
if (ns) then
deallocate(d)
end if
end if
if ((.not.allocated(d)).and.(s(1).ge.1)) then
allocate(d(s(1)))
end if
if (allocated(d)) then
do i=1,r
s(i) = size(d,i)
end do
end if
flag = 1
call f2pysetdata(d,allocated(d))
end subroutine f2py_hw2_getdims_jpath
subroutine f2pywrap_hw2_newton (xguess, xf, jf, i2, f2py_xguess_d0&
&, f2py_xguess_d1)
use hw2, only : newton
real(kind=8) jf
integer i2
integer f2py_xguess_d0
integer f2py_xguess_d1
real(kind=8) xguess(f2py_xguess_d0,f2py_xguess_d1)
real(kind=8) xf(size(xguess),1)
call newton(xguess, xf, jf, i2)
end subroutine f2pywrap_hw2_newton
subroutine f2pyinithw2(f2pysetupfunc)
use hw2, only : xpath
use hw2, only : jpath
use hw2, only : tol
use hw2, only : itermax
use hw2, only : bracket_descent
use hw2, only : bd_initialize
use hw2, only : convergence_check
interface
subroutine f2pywrap_hw2_newton (xguess, xf, jf, i2, f2py_xguess_d0&
&, f2py_xguess_d1)
real(kind=8) jf
integer i2
integer f2py_xguess_d0
integer f2py_xguess_d1
real(kind=8) xguess(f2py_xguess_d0,f2py_xguess_d1)
real(kind=8) xf(size(xguess),1)
end subroutine f2pywrap_hw2_newton
end interface
external f2pysetupfunc
external f2py_hw2_getdims_xpath
external f2py_hw2_getdims_jpath
call f2pysetupfunc(f2py_hw2_getdims_xpath,f2py_hw2_getdims_jpath,t&
&ol,itermax,f2pywrap_hw2_newton,bracket_descent,bd_initialize,conve&
&rgence_check)
end subroutine f2pyinithw2