Thanks. I'll do that. Might try hacking a bit to see if I can work around 
it by directly calling ARPACK too.

David

On Monday, November 9, 2015 at 3:28:11 AM UTC-5, Tomas Lycken wrote:
>
> This actually seems to be a type instability issue in Base.eigs:
>
> julia> @code_warntype eigs(A)
> Variables:
>   A::SparseMatrixCSC{Float64,Int64}
>
> Body:
>   begin
>       $(Expr(:line, 50, symbol("linalg/arnoldi.jl"), symbol("")))
>       GenSym(8) = 
> (top(ccall))(:jl_alloc_array_1d,(top(apply_type))(Base.Array,Any,1)::Type{Array{Any,1}},(top(svec))(Base.Any,Base.Int)::SimpleVector,Array{Any,1},0,0,0)::Array{Any,1}
>       GenSym(9) = GenSym(8)
>       return 
> (Base.LinAlg.__eigs#221__)(GenSym(9),A::SparseMatrixCSC{Float64,Int64})::Tuple
>   end::Tuple
>
> julia> @code_warntype eigs(Symmetric(A))
> Variables:
>   A::Symmetric{Float64,SparseMatrixCSC{Float64,Int64}}
>
> Body:
>   begin
>       $(Expr(:line, 50, symbol("linalg/arnoldi.jl"), symbol("")))
>       GenSym(8) = 
> (top(ccall))(:jl_alloc_array_1d,(top(apply_type))(Base.Array,Any,1)::Type{Array{Any,1}},(top(svec))(Base.Any,Base.Int)::SimpleVector,Array{Any,1},0,0,0)::Array{Any,1}
>       GenSym(9) = GenSym(8)
>       return 
> (Base.LinAlg.__eigs#221__)(GenSym(9),A::Symmetric{Float64,SparseMatrixCSC{Float64,Int64}})::Tuple
>   end::Tuple
>
> I can’t find anything on the issue tracker about it, so it might be a good 
> idea to file a new issue <https://github.com/JuliaLang/julia/issues/new>.
>
> // t
>
> On Saturday, November 7, 2015 at 5:25:30 PM UTC+1, David Gleich wrote:
>
> I'm trying to get a type-stable output from a symmetric sparse eigenvalue 
>> problem.
>>
>> Any ideas why neither of these ideas work to give me a deterministic 
>> return of Array{Float64,1} ?
>>
>> n = 500; A = sparse(1:n-1,2:n,1.,n,n); A = A + A'
>> @show issym(A)
>> function myeig1(A::SparseMatrixCSC{Float64,Int64})
>>    d,V = eigs(A;tol=1e-4)
>>    return d
>> end
>>
>> function myeig2(A::SparseMatrixCSC{Float64,Int64})
>>    d,V = eigs(Symmetric(A);tol=1e-4)
>>    return d
>> end
>>
>> @code_warntype myeig1(A)
>> @code_warntype myeig2(A)
>>
>> Thanks,
>> David Gleich
>>
> ​
>

Reply via email to