10
10
# ###########################################################################################
11
11
12
12
function test_unary_jacobian (f, x)
13
- test = ForwardDiff. jacobian! (DiffBase. JacobianResult (x), f, x, ForwardDiff. JacobianConfig (x))
13
+ test_val = f (x)
14
+ test = ForwardDiff. jacobian! (DiffBase. JacobianResult (test_val, x), f, x, ForwardDiff. JacobianConfig (x))
14
15
15
16
# without JacobianConfig
16
17
@@ -20,7 +21,7 @@ function test_unary_jacobian(f, x)
20
21
ReverseDiff. jacobian! (out, f, x)
21
22
@test_approx_eq_eps out DiffBase. jacobian (test) EPS
22
23
23
- result = DiffBase. JacobianResult (x)
24
+ result = DiffBase. JacobianResult (test_val, x)
24
25
ReverseDiff. jacobian! (result, f, x)
25
26
@test_approx_eq_eps DiffBase. value (result) DiffBase. value (test) EPS
26
27
@test_approx_eq_eps DiffBase. jacobian (result) DiffBase. jacobian (test) EPS
@@ -35,7 +36,7 @@ function test_unary_jacobian(f, x)
35
36
ReverseDiff. jacobian! (out, f, x, cfg)
36
37
@test_approx_eq_eps out DiffBase. jacobian (test) EPS
37
38
38
- result = DiffBase. JacobianResult (x)
39
+ result = DiffBase. JacobianResult (test_val, x)
39
40
ReverseDiff. jacobian! (result, f, x, cfg)
40
41
@test_approx_eq_eps DiffBase. value (result) DiffBase. value (test) EPS
41
42
@test_approx_eq_eps DiffBase. jacobian (result) DiffBase. jacobian (test) EPS
@@ -50,7 +51,7 @@ function test_unary_jacobian(f, x)
50
51
ReverseDiff. jacobian! (out, tp, x)
51
52
@test_approx_eq_eps out DiffBase. jacobian (test) EPS
52
53
53
- result = DiffBase. JacobianResult (x)
54
+ result = DiffBase. JacobianResult (test_val, x)
54
55
ReverseDiff. jacobian! (result, tp, x)
55
56
@test_approx_eq_eps DiffBase. value (result) DiffBase. value (test) EPS
56
57
@test_approx_eq_eps DiffBase. jacobian (result) DiffBase. jacobian (test) EPS
@@ -71,12 +72,12 @@ function test_unary_jacobian(f, x)
71
72
Jf! (out, x)
72
73
@test_approx_eq_eps out DiffBase. jacobian (test) EPS
73
74
74
- result = DiffBase. JacobianResult (x)
75
+ result = DiffBase. JacobianResult (test_val, x)
75
76
ReverseDiff. jacobian! (result, ctp, x)
76
77
@test_approx_eq_eps DiffBase. value (result) DiffBase. value (test) EPS
77
78
@test_approx_eq_eps DiffBase. jacobian (result) DiffBase. jacobian (test) EPS
78
79
79
- result = DiffBase. JacobianResult (x)
80
+ result = DiffBase. JacobianResult (test_val, x)
80
81
Jf! (result, x)
81
82
@test_approx_eq_eps DiffBase. value (result) DiffBase. value (test) EPS
82
83
@test_approx_eq_eps DiffBase. jacobian (result) DiffBase. jacobian (test) EPS
@@ -186,14 +187,14 @@ function test_binary_jacobian(f, a, b)
186
187
@test_approx_eq_eps Ja test_a EPS
187
188
@test_approx_eq_eps Jb test_b EPS
188
189
189
- Ja = similar (a, length (a ), length (b ))
190
- Jb = copy (Ja )
190
+ Ja = similar (a, length (test_val ), length (a ))
191
+ Jb = similar (b, length (test_val), length (b) )
191
192
ReverseDiff. jacobian! ((Ja, Jb), f, (a, b))
192
193
@test_approx_eq_eps Ja test_a EPS
193
194
@test_approx_eq_eps Jb test_b EPS
194
195
195
- Ja = DiffBase. JacobianResult (a, b )
196
- Jb = copy (Ja )
196
+ Ja = DiffBase. JacobianResult (test_val, a )
197
+ Jb = DiffBase . JacobianResult (test_val, b )
197
198
ReverseDiff. jacobian! ((Ja, Jb), f, (a, b))
198
199
@test_approx_eq_eps DiffBase. value (Ja) test_val EPS
199
200
@test_approx_eq_eps DiffBase. value (Jb) test_val EPS
@@ -208,14 +209,14 @@ function test_binary_jacobian(f, a, b)
208
209
@test_approx_eq_eps Ja test_a EPS
209
210
@test_approx_eq_eps Jb test_b EPS
210
211
211
- Ja = similar (a, length (a ), length (b ))
212
- Jb = copy (Ja )
212
+ Ja = similar (a, length (test_val ), length (a ))
213
+ Jb = similar (b, length (test_val), length (b) )
213
214
ReverseDiff. jacobian! ((Ja, Jb), f, (a, b), cfg)
214
215
@test_approx_eq_eps Ja test_a EPS
215
216
@test_approx_eq_eps Jb test_b EPS
216
217
217
- Ja = DiffBase. JacobianResult (a, b )
218
- Jb = copy (Ja )
218
+ Ja = DiffBase. JacobianResult (test_val, a )
219
+ Jb = DiffBase . JacobianResult (test_val, b )
219
220
ReverseDiff. jacobian! ((Ja, Jb), f, (a, b), cfg)
220
221
@test_approx_eq_eps DiffBase. value (Ja) test_val EPS
221
222
@test_approx_eq_eps DiffBase. value (Jb) test_val EPS
@@ -230,14 +231,14 @@ function test_binary_jacobian(f, a, b)
230
231
@test_approx_eq_eps Ja test_a EPS
231
232
@test_approx_eq_eps Jb test_b EPS
232
233
233
- Ja = similar (a, length (a ), length (b ))
234
- Jb = copy (Ja )
234
+ Ja = similar (a, length (test_val ), length (a ))
235
+ Jb = similar (b, length (test_val), length (b) )
235
236
ReverseDiff. jacobian! ((Ja, Jb), tp, (a, b))
236
237
@test_approx_eq_eps Ja test_a EPS
237
238
@test_approx_eq_eps Jb test_b EPS
238
239
239
- Ja = DiffBase. JacobianResult (a, b )
240
- Jb = copy (Ja )
240
+ Ja = DiffBase. JacobianResult (test_val, a )
241
+ Jb = DiffBase . JacobianResult (test_val, b )
241
242
ReverseDiff. jacobian! ((Ja, Jb), tp, (a, b))
242
243
@test_approx_eq_eps DiffBase. value (Ja) test_val EPS
243
244
@test_approx_eq_eps DiffBase. value (Jb) test_val EPS
@@ -254,28 +255,28 @@ function test_binary_jacobian(f, a, b)
254
255
@test_approx_eq_eps Ja test_a EPS
255
256
@test_approx_eq_eps Jb test_b EPS
256
257
257
- Ja = similar (a, length (a ), length (b ))
258
- Jb = copy (Ja )
258
+ Ja = similar (a, length (test_val ), length (a ))
259
+ Jb = similar (b, length (test_val), length (b) )
259
260
ReverseDiff. jacobian! ((Ja, Jb), ctp, (a, b))
260
261
@test_approx_eq_eps Ja test_a EPS
261
262
@test_approx_eq_eps Jb test_b EPS
262
263
263
- Ja = similar (a, length (a ), length (b ))
264
- Jb = copy (Ja )
264
+ Ja = similar (a, length (test_val ), length (a ))
265
+ Jb = similar (b, length (test_val), length (b) )
265
266
Jf! ((Ja, Jb), (a, b))
266
267
@test_approx_eq_eps Ja test_a EPS
267
268
@test_approx_eq_eps Jb test_b EPS
268
269
269
- Ja = DiffBase. JacobianResult (a, b )
270
- Jb = copy (Ja )
270
+ Ja = DiffBase. JacobianResult (test_val, a )
271
+ Jb = DiffBase . JacobianResult (test_val, b )
271
272
ReverseDiff. jacobian! ((Ja, Jb), ctp, (a, b))
272
273
@test_approx_eq_eps DiffBase. value (Ja) test_val EPS
273
274
@test_approx_eq_eps DiffBase. value (Jb) test_val EPS
274
275
@test_approx_eq_eps DiffBase. gradient (Ja) test_a EPS
275
276
@test_approx_eq_eps DiffBase. gradient (Jb) test_b EPS
276
277
277
- Ja = DiffBase. JacobianResult (a, b )
278
- Jb = copy (Ja )
278
+ Ja = DiffBase. JacobianResult (test_val, a )
279
+ Jb = DiffBase . JacobianResult (test_val, b )
279
280
Jf! ((Ja, Jb), (a, b))
280
281
@test_approx_eq_eps DiffBase. value (Ja) test_val EPS
281
282
@test_approx_eq_eps DiffBase. value (Jb) test_val EPS
0 commit comments