Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Feb 11, 2025
1 parent f01244c commit 31b052d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion ext/IntegralsFastGaussQuadratureExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ end
function composite_gauss_legendre(f::F, p, lb, ub, nodes, weights, subintervals) where {F}
h = (ub - lb) / subintervals
I = gauss_legendre(f, p, lb, lb + h, nodes, weights)
for i in 1:subintervals-1
for i in 1:(subintervals - 1)
_lb = lb + i * h
_ub = _lb + h
I += gauss_legendre(f, p, _lb, _ub, nodes, weights)
Expand Down
4 changes: 2 additions & 2 deletions src/algorithms_sampled.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Example with sampled data:
```julia
using Integrals
f = x -> x^2
x = range(0, 1, length=20)
x = range(0, 1, length = 20)
y = f.(x)
problem = SampledIntegralProblem(y, x)
method = TrapezoidalRule()
Expand All @@ -31,7 +31,7 @@ Example with equidistant data:
```julia
using Integrals
f = x -> x^2
x = range(0, 1, length=20)
x = range(0, 1, length = 20)
y = f.(x)
problem = SampledIntegralProblem(y, x)
method = SimpsonsRule()
Expand Down
3 changes: 2 additions & 1 deletion test/derivative_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ alg_req = Dict(
allows_iip = false),
GaussLegendre(n = 50) => (nout = Inf, min_dim = 1, max_dim = 1, allows_batch = false,
allows_iip = false),
GaussLegendre(n = 50, subintervals=3) => (nout = Inf, min_dim = 1, max_dim = 1, allows_batch = false,
GaussLegendre(n = 50, subintervals = 3) => (
nout = Inf, min_dim = 1, max_dim = 1, allows_batch = false,
allows_iip = false),
QuadGKJL() => (nout = Inf, allows_batch = true, min_dim = 1, max_dim = 1,
allows_iip = true),
Expand Down
24 changes: 12 additions & 12 deletions test/gaussian_quadrature_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,19 @@ sol = solve(prob, alg)
@test sol.u -240.25235266303063249920743158729

# Gauss-Legendre with array-valued integrands
prob = IntegralProblem((x,p)->[1,2], (-1,1))
sol = solve(prob, GaussLegendre(;n=5))
@test sol.u 2*[1,2]
prob = IntegralProblem((x, p) -> [1, 2], (-1, 1))
sol = solve(prob, GaussLegendre(; n = 5))
@test sol.u 2 * [1, 2]

prob = IntegralProblem((x,p)->[1 2; 3 4], (-1,1))
sol = solve(prob, GaussLegendre(;n=5))
@test sol.u 2*[1 2; 3 4]
prob = IntegralProblem((x, p) -> [1 2; 3 4], (-1, 1))
sol = solve(prob, GaussLegendre(; n = 5))
@test sol.u 2 * [1 2; 3 4]

# Composite Gauss-Legendre with array-valued integrands
prob = IntegralProblem((x,p)->[1,2], (-1,1))
sol = solve(prob, GaussLegendre(;n=5, subintervals=5))
@test sol.u 2*[1,2]
prob = IntegralProblem((x, p) -> [1, 2], (-1, 1))
sol = solve(prob, GaussLegendre(; n = 5, subintervals = 5))
@test sol.u 2 * [1, 2]

prob = IntegralProblem((x,p)->[1 2; 3 4], (-1,1))
sol = solve(prob, GaussLegendre(;n=5, subintervals=5))
@test sol.u 2*[1 2; 3 4]
prob = IntegralProblem((x, p) -> [1 2; 3 4], (-1, 1))
sol = solve(prob, GaussLegendre(; n = 5, subintervals = 5))
@test sol.u 2 * [1 2; 3 4]

0 comments on commit 31b052d

Please sign in to comment.