This problem arose using Julia 1.4.2, and I then got version 1.5.1 and the problem is still there.
If I create a matrix, then get its eigenvalues, then plot the eigenvalues, then get the eigenvalues again, I get the error:
ArgumentError: invalid argument #4 to LAPACK call
Stacktrace:
[1] chklapackerror at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\lapack.jl:36 [inlined]
[2] geevx!(::Char, ::Char, ::Char, ::Char, ::Array{Float64,2}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\lapack.jl:2082
[3] eigvals!(::Array{Float64,2}; permute::Bool, scale::Bool, sortby::typeof(LinearAlgebra.eigsortby)) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\eigen.jl:293
[4] eigvals! at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\eigen.jl:292 [inlined]
[5] #eigvals#73 at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\eigen.jl:326 [inlined]
[6] eigvals(::Array{Float64,2}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\eigen.jl:326
[7] top-level scope at In[242]:1
[8] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091
This was the easiest way I could reproduce the problem:
using LinearAlgebra
using Plots; pyplot();
A = [0.475 0.5 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0;
0.5 -0.475 0.5 0.5 0.0 0.0 0.0 0.0 0.0 0.0;
0.0 0.5 0.0 0.0 0.5 0.0 0.0 0.0 0.0 0.0;
0.0 0.5 0.0 -0.475 0.5 0.0 0.5 0.0 0.0 0.0;
0.0 0.0 0.5 0.0 -0.95 0.0 0.0 0.5 0.0 0.0;
0.0 0.0 0.0 0.0 0.5 0.0 0.0 0.0 0.5 0.0;
0.0 0.0 0.0 0.5 0.0 0.0 0.0 0.5 0.0 0.0;
0.0 0.0 0.0 0.0 0.5 0.0 0.5 -0.475 0.5 0.0;
0.0 0.0 0.0 0.0 0.0 0.5 0.0 0.5 -0.4749999999999999 0.5;
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.5 0.475]
e1 = eigvals(A);
Plots.plot(e1)
Then calling eigvals again leads to the errror above:
e1 = eigvals(A)
ArgumentError: invalid argument #4 to LAPACK call
Stacktrace:
[1] chklapackerror at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\lapack.jl:36 [inlined]
[2] geevx!(::Char, ::Char, ::Char, ::Char, ::Array{Float64,2}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\lapack.jl:2082
[3] eigvals!(::Array{Float64,2}; permute::Bool, scale::Bool, sortby::typeof(LinearAlgebra.eigsortby)) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\eigen.jl:293
[4] eigvals! at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\eigen.jl:292 [inlined]
[5] #eigvals#73 at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\eigen.jl:326 [inlined]
[6] eigvals(::Array{Float64,2}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\eigen.jl:326
[7] top-level scope at In[242]:1
[8] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091
The original error I was getting with my actual code,where I was calculating eigenvalue statistics and plotting a histogram with PyPlot.hist(), was:
LAPACKException(1)
Stacktrace:
[1] chklapackerror at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\lapack.jl:38 [inlined]
[2] syevr!(::Char, ::Char, ::Char, ::Array{Float64,2}, ::Float64, ::Float64, ::Int64, ::Int64, ::Float64) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\lapack.jl:5068
[3] eigvals! at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\symmetric.jl:731 [inlined]
[4] eigvals!(::Array{Float64,2}; permute::Bool, scale::Bool, sortby::typeof(LinearAlgebra.eigsortby)) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\eigen.jl:292
[5] eigvals! at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\eigen.jl:292 [inlined]
[6] #eigvals#73 at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\eigen.jl:326 [inlined]
[7] eigvals at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\eigen.jl:326 [inlined]
[8] get_stats(::Int64, ::Int64, ::Float64, ::Float64, ::Float64, ::Float64, ::Int64, ::Float64, ::Array{Float64,1}) at .\In[162]:12
[9] top-level scope at In[197]:1
[10] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091
But the minimal reproduction gave a slightly different error,.