Linear algebra tells us Symmetric matrices have real eigenvalues and
general matrices have complex eigenvalues in general. `eigvecs` can be
called with an upper and lower bound on the eigenvalues of the eigenvectors
to be found, but upper and lower bounds are applicable only to Real
numbers, which means we need to use the Symmetric matrix version of
`eigvals` and `eigvecs` and then things work out better.
In code:
julia> A = rand(3,3)
3x3 Array{Float64,2}:
0.63668 0.252549 0.467667
0.0372453 0.288091 0.0918441
0.383552 0.478298 0.148384
julia> B = Symmetric(A+A')
3x3 Symmetric{Float64,Array{Float64,2}}:
1.27336 0.289794 0.851219
0.289794 0.576181 0.570142
0.851219 0.570142 0.296767
julia> eigvals(B)
3-element Array{Float64,1}:
-0.349693
0.516073
1.97993
julia> eigvecs(B,1.9,2.0)
3x1 Array{Float64,2}:
-0.772992
-0.369141
-0.515963
Because of numerical errors, when looking for a specific eigenvalue it
might be prudent to use enlarge the range by some small factor. This info
is the outcome of using `help` and `methods` in the REPL, so more
information might be available with a little more investigation.
On Wednesday, December 16, 2015 at 11:43:42 AM UTC+2, Robert DJ wrote:
>
> I would like to compute the eigenvector of a particular eigenvalue and
> according to the docs, eigvecs is up for the job.
> However, I get errors. The following call should give the same output as
> eigvecs(A):
>
> julia> A = rand(3,3)
> 3x3 Array{Float64,2}:
> 0.165111 0.995671 0.393572
> 0.496099 0.640361 0.595876
> 0.632881 0.3909 0.723987
>
> julia> v = eigvals(A)
> 3-element Array{Float64,1}:
> 1.68982
> -0.230301
> 0.0699443
>
> julia> eigvecs(A, v)
> ERROR: MethodError: `eigfact` has no method matching
> eigfact(::Array{Float64,2}, ::Array{Float64,1})
> Closest candidates are:
>
> eigfact{T}(::Union{DenseArray{T,2},SubArray{T,2,A<:DenseArray{T,N},I<:Tuple{Vararg{Union{Colon,Int64,Range{Int64}}}},LD}})
> eigfact{TA,TB}(::AbstractArray{TA,2}, ::AbstractArray{TB,2})
> in eigvecs at linalg/eigen.jl:70
>
> julia> eigvecs(A, v)
>
> I have
>
> julia> versioninfo()
> Julia Version 0.4.0
> Commit 0ff703b (2015-10-08 06:20 UTC)
> Platform Info:
> System: Darwin (x86_64-apple-darwin14.5.0)
> CPU: Intel(R) Core(TM)2 Duo CPU P7350 @ 2.00GHz
> WORD_SIZE: 64
> BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Penryn)
> LAPACK: libopenblas64_
> LIBM: libopenlibm
> LLVM: libLLVM-3.3
>
>
>