Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large memory allocation in stieltjes, backwardrecurrence! #30

Closed
jamiecjx opened this issue Sep 8, 2023 · 1 comment
Closed

Large memory allocation in stieltjes, backwardrecurrence! #30

jamiecjx opened this issue Sep 8, 2023 · 1 comment

Comments

@jamiecjx
Copy link
Contributor

jamiecjx commented Sep 8, 2023

stieltjes() evaluated at certain points results in large amount of memory allocated.

julia> using ClassicalOrthogonalPolynomials, SingularIntegrals

julia> W = Weighted(ChebyshevU()); x = axes(W, 1); f = expand(W, x -> inv(2 * x + 3/2) * (1-x^2));

julia> z = 0.2567881003580743 - 0.33437737333561895im;

julia> @time inv.(z .- x') * f # first time run, ignore
  1.994925 seconds (1.61 M allocations: 3.126 GiB, 10.78% gc time, 65.63% compilation time)
1.1162556659904905 + 1.449666329259747im

julia> @time inv.(z .- x') * f # large memory allocation
  0.614899 seconds (78 allocations: 2.980 GiB, 19.81% gc time)
1.1162556659904905 + 1.449666329259747im

julia> @time inv.(z+0.01im .- x') * f # fine here
  0.000219 seconds (80 allocations: 122.562 KiB)
1.1295620627968406 + 1.4556063512794264im

After some investigation, it seems that the problem resides in backwardrecurrence!, where:

Line 118: μ is set to 1
Line 121, N is set to maxiterations, which results in K.data being 100_000_000 size.

Setting maxiterations to something smaller seems to "fix" the problem.

@jamiecjx jamiecjx changed the title Large memory allocation in stieltjes, recurrencearray Large memory allocation in stieltjes, backwardrecurrence! Sep 8, 2023
@dlfivefifty
Copy link
Member

Do you think you could make a PR? Then I can code review it

jamiecjx added a commit to jamiecjx/SingularIntegrals.jl that referenced this issue Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants