# Does eig() which need Arpack.jl not support zygote?

**URL:** <https://discourse.julialang.org/t/does-eig-which-need-arpack-jl-not-support-zygote/86538>\
**Category:** General Usage\
**Created:** [August 30, 2022, 7:28am UTC](https://discourse.julialang.org/t/does-eig-which-need-arpack-jl-not-support-zygote/86538 "2022-08-30T07:28:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![F-YF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/f-yf/32/17363_2.png) [@F-YF](https://discourse.julialang.org/u/F-YF)\
**Post date:** [August 30, 2022, 7:28am UTC](https://discourse.julialang.org/t/does-eig-which-need-arpack-jl-not-support-zygote/86538/1 "2022-08-30T07:28:26Z")

</div>

```julia
julia> using Arpack

julia> function f(x)
       val, vec = eigs( x; nev = 1, which = :LM, maxiter = 300 )
           return log(real(val[1]))
       end
f (generic function with 1 method)

julia> x0 = rand(4,4)
4×4 Matrix{Float64}:
 0.817398 0.922428 0.819335 0.940888
 0.0612446 0.514584 0.979874 0.496911
 0.936561 0.282771 0.659465 0.618731
 0.207618 0.304318 0.504621 0.247501

julia> 

julia> using Zygote

julia> gradient(f,x0)
ERROR: Compiling Tuple{Arpack.var"##_eigs#17", Int64, Int64, Symbol, Float64, Int64, Nothing, Vector{Float64}, Bool, Symbol, Int64, typeof(Arpack._eigs), Matrix{Float64}, LinearAlgebra.UniformScaling{Bool}}: try/catch is not supported.
Refer to the Zygote documentation for fixes.
https://fluxml.ai/Zygote.jl/latest/limitations

```

I only need the largest eigenvalue of a matrix in my calculation, so I call the eig() function, but it doesn’t seem to support zygote.
