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

Sparse matrices generalized eigenvalue problem. #109

Closed
mseri opened this issue May 5, 2014 · 8 comments
Closed

Sparse matrices generalized eigenvalue problem. #109

mseri opened this issue May 5, 2014 · 8 comments
Labels
help wanted Extra attention is needed sparse Sparse arrays

Comments

@mseri
Copy link

mseri commented May 5, 2014

I have two huge sparse matrices A and B generated by FreeFem++.

I'd like to compute what in matlab would be

      [v,lambda]=eigs(A,B,nv,sigma);

(and I need both eigenvalues and relative eigenfunctions)

Sadly with Julia I get:

      ERROR: no method eigs(SparseMatrixCSC{Complex{Float64},Int64}, SparseMatrixCSC{Complex{Float64},Int64}, Int64)
      ERROR: no method eigfact!(SparseMatrixCSC{Complex{Float64},Int64}, SparseMatrixCSC{Complex{Float64},Int64}, Int64, Float64)
       in eigfact at linalg/factorization.jl:543

(and similar with different combinations of arguments).

Is there any way to overcome this problem?

@jiahao
Copy link
Member

jiahao commented May 6, 2014

Looks like we don't currently wrap the ARPACK function to compute the generalized eigenproblem.

@ViralBShah
Copy link
Member

I have been planning to do it for a while. Shouldn't be too difficult.

@ViralBShah
Copy link
Member

That said, I won't be able to get to it until next week - so anyone who wants to take a crack should probably do it.

@rodrperezi
Copy link

Hi, any news on this? I'm having the same problem
Thanks!

@ViralBShah
Copy link
Member

Initial support is now in place. I suspect that this is going to be slow, because of allocation of a vector during the matvec, but I haven't actually benchmarked it yet. Do try it out...

julia> a = sprand(100,100,0.3);

julia> b = sprand(100,100,0.3);

julia> d,v = eigs(a,b,sigma=0.1);

julia> norm(a*v[:,2] - d[2]*b*v[:,2])
8.156335076785677e-8

@timholy
Copy link
Member

timholy commented May 19, 2014

I timed a few iterations of your demo above. Most of the time it completes in 0.2-0.3 seconds, but occasionally it takes 7-8 seconds (without changing a and b). Very curious. I haven't checked your algorithm, is there an element of randomness to it?

@jarlebring
Copy link
Contributor

The initial support test of @ViralBShah didn't check if eigenpairs were computed, and in many cases they are not eigenpairs, unfortunately. Although the residual is almost zero, so are the eigenvectors in many cases:

julia> a = sprand(100,100,0.3);
julia> b = sprand(100,100,0.3);
julia> d,v = eigs(a,b,sigma=0.1);
julia> norm(a*v[:,2] - d[2]*b*v[:,2])
5.417169902738541e-15
julia> norm(v[:,2])
9.350489717877918e-15

Also, the values in d are not eigenvalues:

julia> minimum(svdvals(full(a-d[2]*b)))
0.02991546632563478

I think the origin of this is the same as origin of the bugs reported in the comments of #488. Credits to @meleg for identifying this.

@ViralBShah
Copy link
Member

Maybe open a new issue?

@KristofferC KristofferC transferred this issue from JuliaLang/julia Nov 26, 2024
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed sparse Sparse arrays
Projects
None yet
Development

No branches or pull requests

6 participants