Skip to content

Commit bec7569

Browse files
committed
fixed TCI2 history bug + additional integral test
1 parent 1d08f3b commit bec7569

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/tensorci2.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,8 +778,8 @@ function sweep2site!(
778778
extraIset = tci.Iset
779779
extraJset = tci.Jset
780780
if length(tci.Iset_history) > 0
781-
extraIset = union(extraIset, tci.Iset_history[end])
782-
extraJset = union(extraJset, tci.Jset_history[end])
781+
extraIset = union.(extraIset, tci.Iset_history[end])
782+
extraJset = union.(extraJset, tci.Jset_history[end])
783783
end
784784
end
785785

test/test_integration.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using Test
22
import TensorCrossInterpolation as TCI
33
import Random
44

5-
@testset "Integration" begin
5+
@testset "Integrate polynomials" begin
66
Random.seed!(1234)
77

88
coefficients = [
@@ -25,3 +25,12 @@ import Random
2525
exactval = prod(polynomialintegral.(b) .- polynomialintegral.(a))
2626
@test TCI.integrate(Float64, f, a, b) exactval
2727
end
28+
29+
@testset "Integrate 10d function" begin
30+
function f(x)
31+
return 1000 * cos(10 * sum(x .^ 2)) * exp(-sum(x)^4 / 1000)
32+
end
33+
I15 = TCI.integrate(Float64, f, fill(-1.0, 10), fill(+1.0, 10); GKorder=15, tolerance=1e-8)
34+
Iref = -5.4960415218049
35+
@test abs(I15 - Iref) < 1e-3
36+
end

0 commit comments

Comments
 (0)