Skip to content

Commit 93c16af

Browse files
committed
added normalization in integrate() to account for weights
1 parent e31537d commit 93c16af

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/integration.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ function integrate(
1111
nodes1d, weights1d, _ = QuadGK.kronrod(order ÷ 2, -1, +1)
1212
nodes = @. (b - a) * (nodes1d' + 1) / 2 + a
1313
weights = @. (b - a) * weights1d' / 2
14+
normalization = order^length(a)
1415

1516
localdims = fill(length(nodes1d), length(a))
1617

1718
function F(indices)
1819
x = [nodes[n, i] for (n, i) in enumerate(indices)]
1920
w = prod(weights[n, i] for (n, i) in enumerate(indices))
20-
return w * f(x)
21+
return w * f(x) * normalization
2122
end
2223

2324
tci2, ranks, errors = crossinterpolate2(
@@ -27,5 +28,5 @@ function integrate(
2728
tolerance
2829
)
2930

30-
return sum(tci2)
31+
return sum(tci2) / normalization
3132
end

0 commit comments

Comments
 (0)