From 86406479a8ae8b0eb704395ad07d910678580016 Mon Sep 17 00:00:00 2001 From: James Chen <100195398+jamiecjx@users.noreply.github.com> Date: Sat, 9 Sep 2023 14:55:03 +0100 Subject: [PATCH] tweak mu to fix #30 (#31) * tweak mu to fix #30 * unit test for memory --- src/recurrence.jl | 2 +- test/test_recurrence.jl | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/recurrence.jl b/src/recurrence.jl index 474f8e7..7085a6d 100644 --- a/src/recurrence.jl +++ b/src/recurrence.jl @@ -118,7 +118,7 @@ function backwardrecurrence!(K, A, B, C, z, nN::AbstractUnitRange, j...) μ = min(abs(data[k,j...]/data[k-1,j...]), abs(data[k-1,j...]/data[k-2,j...])) # data[k] * μ^M ≤ ε # M ≥ log(ε/data[k])/log(μ) - N = ceil(Int, max(2N, min(maxiterations, log(eps(real(T))/100)/log(μ)))) + N = ceil(Int, max(2N, min(maxiterations, log(eps(real(T))/100)/log(μ+eps(real(T)))))) _growdata!(K, N, j...) resize!(u, N) data = K.data diff --git a/test/test_recurrence.jl b/test/test_recurrence.jl index 1fdc521..d9fe361 100644 --- a/test/test_recurrence.jl +++ b/test/test_recurrence.jl @@ -22,6 +22,12 @@ using ClassicalOrthogonalPolynomials: recurrencecoefficients @test r[1:1000] ≈ ξ.^(1:1000) @test r[10_000] ≈ ξ.^(10_000) atol=3E-10 end + + for z in (0.2567881003580743 - 0.33437737333561895im) + ξ = π * (z - √(z-1) * √(z+1)) + r = RecurrenceArray(z, recurrencecoefficients(U), [ξ,2z*ξ-π]) + @test sizeof(r.data) < 1000_000 + end end @testset "RecurrenceMatrix" begin