@@ -7,26 +7,26 @@ max_nout_test = 2
7
7
reltol = 1e-3
8
8
abstol = 1e-3
9
9
10
- algs = [QuadGKJL () , HCubatureJL () , CubatureJLh () , CubatureJLp () , VEGAS () , # CubaVegas() ,
11
- CubaSUAVE () , CubaDivonne () , CubaCuhre () ]
10
+ algs = [QuadGKJL, HCubatureJL, CubatureJLh, CubatureJLp, VEGAS, # CubaVegas,
11
+ CubaSUAVE, CubaDivonne, CubaCuhre]
12
12
13
- alg_req = Dict (QuadGKJL () => (nout = 1 , allows_batch = false , min_dim = 1 , max_dim = 1 ,
13
+ alg_req = Dict (QuadGKJL => (nout = 1 , allows_batch = false , min_dim = 1 , max_dim = 1 ,
14
14
allows_iip = false ),
15
- HCubatureJL () => (nout = Inf , allows_batch = false , min_dim = 1 ,
15
+ HCubatureJL => (nout = Inf , allows_batch = false , min_dim = 1 ,
16
16
max_dim = Inf , allows_iip = true ),
17
- VEGAS () => (nout = 1 , allows_batch = true , min_dim = 2 , max_dim = Inf ,
17
+ VEGAS => (nout = 1 , allows_batch = true , min_dim = 2 , max_dim = Inf ,
18
18
allows_iip = true ),
19
- CubatureJLh () => (nout = Inf , allows_batch = true , min_dim = 1 ,
19
+ CubatureJLh => (nout = Inf , allows_batch = true , min_dim = 1 ,
20
20
max_dim = Inf , allows_iip = true ),
21
- CubatureJLp () => (nout = Inf , allows_batch = true , min_dim = 1 ,
21
+ CubatureJLp => (nout = Inf , allows_batch = true , min_dim = 1 ,
22
22
max_dim = Inf , allows_iip = true ),
23
- CubaVegas () => (nout = Inf , allows_batch = true , min_dim = 1 , max_dim = Inf ,
23
+ CubaVegas => (nout = Inf , allows_batch = true , min_dim = 1 , max_dim = Inf ,
24
24
allows_iip = true ),
25
- CubaSUAVE () => (nout = Inf , allows_batch = true , min_dim = 1 , max_dim = Inf ,
25
+ CubaSUAVE => (nout = Inf , allows_batch = true , min_dim = 1 , max_dim = Inf ,
26
26
allows_iip = true ),
27
- CubaDivonne () => (nout = Inf , allows_batch = true , min_dim = 2 ,
27
+ CubaDivonne => (nout = Inf , allows_batch = true , min_dim = 2 ,
28
28
max_dim = Inf , allows_iip = true ),
29
- CubaCuhre () => (nout = Inf , allows_batch = true , min_dim = 2 , max_dim = Inf ,
29
+ CubaCuhre => (nout = Inf , allows_batch = true , min_dim = 2 , max_dim = Inf ,
30
30
allows_iip = true ))
31
31
32
32
integrands = [
96
96
for i in 1 : length (integrands)
97
97
prob = IntegralProblem (integrands[i], lb, ub)
98
98
@info " Alg = $alg , Integrand = $i , Dimension = $dim , Output Dimension = $nout "
99
- sol = solve (prob, alg, reltol = reltol, abstol = abstol)
99
+ sol = solve (prob, alg () , reltol = reltol, abstol = abstol)
100
100
@test sol. u≈ exact_sol[i](dim, nout, lb, ub) rtol= 1e-2
101
101
end
102
102
end
@@ -110,11 +110,11 @@ end
110
110
for dim in 1 : max_dim_test
111
111
lb, ub = (ones (dim), 3 ones (dim))
112
112
prob = IntegralProblem (integrands[i], lb, ub)
113
- if dim > req. max_dim || dim < req. min_dim || alg isa QuadGKJL # QuadGKJL requires numbers, not single element arrays
113
+ if dim > req. max_dim || dim < req. min_dim || alg () isa QuadGKJL # QuadGKJL requires numbers, not single element arrays
114
114
continue
115
115
end
116
116
@info " Alg = $alg , Integrand = $i , Dimension = $dim , Output Dimension = $nout "
117
- sol = solve (prob, alg, reltol = reltol, abstol = abstol)
117
+ sol = solve (prob, alg () , reltol = reltol, abstol = abstol)
118
118
@test sol. u≈ exact_sol[i](dim, nout, lb, ub) rtol= 1e-2
119
119
end
120
120
end
@@ -129,14 +129,14 @@ end
129
129
for dim in 1 : max_dim_test
130
130
lb, ub = (ones (dim), 3 ones (dim))
131
131
prob = IntegralProblem (iip_integrands[i], lb, ub)
132
- if dim > req. max_dim || dim < req. min_dim || alg isa QuadGKJL # QuadGKJL requires numbers, not single element arrays
132
+ if dim > req. max_dim || dim < req. min_dim || alg () isa QuadGKJL # QuadGKJL requires numbers, not single element arrays
133
133
continue
134
134
end
135
135
@info " Alg = $alg , Integrand = $i , Dimension = $dim , Output Dimension = $nout "
136
- if alg isa HCubatureJL && dim == 1 # HCubature library requires finer tol to pass test. When requiring array outputs for iip integrands
137
- sol = solve (prob, alg, reltol = 1e-5 , abstol = 1e-5 )
136
+ if alg () isa HCubatureJL && dim == 1 # HCubature library requires finer tol to pass test. When requiring array outputs for iip integrands
137
+ sol = solve (prob, alg () , reltol = 1e-5 , abstol = 1e-5 )
138
138
else
139
- sol = solve (prob, alg, reltol = reltol, abstol = abstol)
139
+ sol = solve (prob, alg () , reltol = reltol, abstol = abstol)
140
140
end
141
141
if sol. u isa Number
142
142
@test sol. u≈ exact_sol[i](dim, nout, lb, ub) rtol= 1e-2
159
159
continue
160
160
end
161
161
@info " Alg = $alg , Integrand = $i , Dimension = $dim , Output Dimension = $nout "
162
- sol = solve (prob, alg, reltol = reltol, abstol = abstol)
162
+ sol = solve (prob, alg () , reltol = reltol, abstol = abstol)
163
163
@test sol. u[1 ]≈ exact_sol[i](dim, nout, lb, ub) rtol= 1e-2
164
164
end
165
165
end
177
177
continue
178
178
end
179
179
@info " Alg = $alg , Integrand = $i , Dimension = $dim , Output Dimension = $nout "
180
- sol = solve (prob, alg, reltol = reltol, abstol = abstol)
180
+ sol = solve (prob, alg () , reltol = reltol, abstol = abstol)
181
181
if sol. u isa Number
182
182
@test sol. u≈ exact_sol[i](dim, nout, lb, ub) rtol= 1e-2
183
183
else
201
201
continue
202
202
end
203
203
@info " Alg = $alg , Integrand = $i , Dimension = $dim , Output Dimension = $nout "
204
- sol = solve (prob, alg, reltol = reltol, abstol = abstol)
204
+ sol = solve (prob, alg () , reltol = reltol, abstol = abstol)
205
205
if sol. u isa Number
206
206
@test sol. u≈ exact_sol[i](dim, nout, lb, ub) rtol= 1e-2
207
207
else
226
226
continue
227
227
end
228
228
@info " Alg = $alg , Integrand = $i , Dimension = $dim , Output Dimension = $nout "
229
- sol = solve (prob, alg, reltol = reltol, abstol = abstol)
229
+ sol = solve (prob, alg () , reltol = reltol, abstol = abstol)
230
230
if nout == 1
231
231
@test sol. u[1 ]≈ exact_sol_v[i](dim, nout, lb, ub)[1 ] rtol= 1e-2
232
232
else
@@ -245,14 +245,14 @@ end
245
245
lb, ub = (ones (dim), 3 ones (dim))
246
246
for nout in 1 : max_nout_test
247
247
if dim > req. max_dim || dim < req. min_dim || req. nout < nout ||
248
- alg isa QuadGKJL || alg isa VEGAS
248
+ alg () isa QuadGKJL || alg () isa VEGAS
249
249
# QuadGKJL and VEGAS require numbers, not single element arrays
250
250
continue
251
251
end
252
252
prob = IntegralProblem ((x, p) -> integrands_v[i](x, p, nout), lb, ub,
253
253
nout = nout)
254
254
@info " Alg = $alg , Integrand = $i , Dimension = $dim , Output Dimension = $nout "
255
- sol = solve (prob, alg, reltol = reltol, abstol = abstol)
255
+ sol = solve (prob, alg () , reltol = reltol, abstol = abstol)
256
256
if nout == 1
257
257
@test sol. u[1 ]≈ exact_sol_v[i](dim, nout, lb, ub)[1 ] rtol= 1e-2
258
258
else
@@ -274,14 +274,14 @@ end
274
274
prob = IntegralProblem ((dx, x, p) -> iip_integrands_v[i](dx, x, p, nout),
275
275
lb, ub, nout = nout)
276
276
if dim > req. max_dim || dim < req. min_dim || req. nout < nout ||
277
- alg isa QuadGKJL # QuadGKJL requires numbers, not single element arrays
277
+ alg () isa QuadGKJL # QuadGKJL requires numbers, not single element arrays
278
278
continue
279
279
end
280
280
@info " Alg = $alg , Integrand = $i , Dimension = $dim , Output Dimension = $nout "
281
281
if alg isa HCubatureJL && dim == 1 # HCubature library requires finer tol to pass test. When requiring array outputs for iip integrands
282
- sol = solve (prob, alg, reltol = 1e-5 , abstol = 1e-5 )
282
+ sol = solve (prob, alg () , reltol = 1e-5 , abstol = 1e-5 )
283
283
else
284
- sol = solve (prob, alg, reltol = reltol, abstol = abstol)
284
+ sol = solve (prob, alg () , reltol = reltol, abstol = abstol)
285
285
end
286
286
if nout == 1
287
287
@test sol. u[1 ]≈ exact_sol_v[i](dim, nout, lb, ub)[1 ] rtol= 1e-2
306
306
continue
307
307
end
308
308
@info " Alg = $alg , Integrand = $i , Dimension = $dim , Output Dimension = $nout "
309
- sol = solve (prob, alg, reltol = reltol, abstol = abstol)
309
+ sol = solve (prob, alg () , reltol = reltol, abstol = abstol)
310
310
@test sol. u≈ exact_sol_v[i](dim, nout, lb, ub) rtol= 1e-2
311
311
end
312
312
end
327
327
continue
328
328
end
329
329
@info " Alg = $alg , Integrand = $i , Dimension = $dim , Output Dimension = $nout "
330
- sol = solve (prob, alg, reltol = reltol, abstol = abstol)
330
+ sol = solve (prob, alg () , reltol = reltol, abstol = abstol)
331
331
@test sol. u≈ exact_sol_v[i](dim, nout, lb, ub) rtol= 1e-2
332
332
end
333
333
end
348
348
continue
349
349
end
350
350
@info " Alg = $alg , Integrand = $i , Dimension = $dim , Output Dimension = $nout "
351
- sol = solve (prob, alg, reltol = reltol, abstol = abstol)
351
+ sol = solve (prob, alg () , reltol = reltol, abstol = abstol)
352
352
@test sol. u≈ exact_sol_v[i](dim, nout, lb, ub) rtol= 1e-2
353
353
end
354
354
end
375
375
end
376
376
for i in 1 : length (integrands)
377
377
prob = IntegralProblem (integrands[i], lb, ub, p)
378
- cache = init (prob, alg, reltol = reltol, abstol = abstol)
378
+ cache = init (prob, alg () , reltol = reltol, abstol = abstol)
379
379
@test solve! (cache). u≈ exact_sol[i](dim, nout, lb, ub) rtol= 1e-2
380
380
cache. lb = lb = 0.5
381
381
@test solve! (cache). u≈ exact_sol[i](dim, nout, lb, ub) rtol= 1e-2
0 commit comments