In [1]:
## How to compute eigenvalues of large sparse matrices.
using Plots
A = sprand(10^4,10^4, 5/10^4)
A = A + A' # make it symmetric to make it easy
Plots.spy(A, colorbar = false)
gui()
UndefVarError: sprand not defined

Stacktrace:
 [1] top-level scope at In[1]:3
In [2]:
##
using Arpack
lams,Vs = eigs(A)
┌ Info: Recompiling stale cache file /Users/dgleich/.julia/compiled/v1.2/Arpack/X5VZL.ji for Arpack [7d9fca2a-8960-54d3-9f78-7d1dccf2cb97]
└ @ Base loading.jl:1240
UndefVarError: A not defined

Stacktrace:
 [1] top-level scope at In[2]:3
In [3]:
## This gives us 6 eigenvalues and vectors "where 6" is by convention.
# For sparse matries, we only get a subset of the eigenvalues and vectors.
@show lams
UndefVarError: lams not defined

Stacktrace:
 [1] top-level scope at show.jl:576
 [2] top-level scope at In[3]:1
In [4]:
##
lams,Vs = eigs(A; nev=20) # get 20!
@show lams
UndefVarError: A not defined

Stacktrace:
 [1] top-level scope at In[4]:1
In [5]:
##
norm(A*Vs[:,2] - lams[2]*Vs[:,2])
UndefVarError: Vs not defined

Stacktrace:
 [1] top-level scope at In[5]:1
In [6]:
## How does this work?? See the notes :)