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

Loosen limit n ≤ 4000 in gaussjacobi #48

Open
dlfivefifty opened this issue May 1, 2017 · 3 comments
Open

Loosen limit n ≤ 4000 in gaussjacobi #48

dlfivefifty opened this issue May 1, 2017 · 3 comments

Comments

@dlfivefifty
Copy link
Member

This seems to be a hold over from MATLAB since

julia> n=5000;a=rand(n);b=rand(n-1);@time eig(SymTridiagonal(a,b));
  4.166163 seconds (276.39 k allocations: 203.424 MB, 1.36% gc time)
@hyrodium
Copy link
Collaborator

hyrodium commented Jan 8, 2021

Is there any technical problem for this limitations?

Is it okay to replace

    elseif n <= 4000 && max(a,b)>=5.
        jacobi_gw(n, a, b)
    else
        error("gaussjacobi($n,$a,$b) is not implemented: n must be ≤ 4000 for max(a,b)≥5.")
    end

with

    else
        jacobi_gw(n, a, b)
    end

?

https://github.com/JuliaApproximation/FastGaussQuadrature.jl/blob/master/src/gaussjacobi.jl#L25

If there's a problem, I guess the convergence of Newton's method is suspicious.
Because the Newton iteration algorithm has hard-coded loop limitation.
https://github.com/JuliaApproximation/FastGaussQuadrature.jl/blob/master/src/gaussjacobi.jl#L88

@dlfivefifty
Copy link
Member Author

dlfivefifty commented Jan 8, 2021

Go for it! I think the limitation on n ≤ 4000 was just because Matlab was not using SymTridiagonal.

If there's a problem, I guess the convergence of Newton's method is suspicious

True, this could effect the large a and b case. Even worse, the initial guesses might not be sufficiently accurate to converge. @ajt60gaibb any thoughts?

@dlfivefifty
Copy link
Member Author

If we add GenericLinearAlgebra.jl as a dependency we could just use Golub-Welsch with BigFloat for large a and b and then cast to Float64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants