We have Base.LinAlg.eig return a tuple of (values,vectors) and 
Base.LinAlg.eigfact returns a type for the result Base.LinAlg.Eigen. But 
Base.LinAlg.eigs returns a tuple would it be worth having a variant of eigs 
that returns a type such as EigsResult?

@doc """a type for the output of eigs


   "eigs" returns the "nev" requested eigenvalues in "d", the
   corresponding Ritz vectors "v" (only if "ritzvec=true"), the
   number of converged eigenvalues "nconv", the number of iterations
   "niter" and the number of matrix vector multiplications
   "nmult", as well as the final residual vector "resid".


   """ ->
type EigsResult{T, R}
 values::Array{T,1}
 vectors::Array{T,2}
 nconv::Int64
 niter::Int64
 nmult::Int64
 resid::Array{R,1}
end


function EigsResult(A; args...)
 @show args
 tupl = eigs(A; args...)
 T = eltype(tupl[1])
 R = eltype(tupl[end])
 EigsResult{T,R}(tupl...)
end

Any function that depends only on the eigenvalues and eigenvectors can take 
either an Eigen or an EigsResult because they have the same field names.

James Fairbanks

Reply via email to