Skip to content

Instantly share code, notes, and snippets.

@dlozeve
Last active March 20, 2019 16:38
Show Gist options
  • Save dlozeve/d312253bea20e2a7c9a7e9e5855f377f to your computer and use it in GitHub Desktop.
Save dlozeve/d312253bea20e2a7c9a7e9e5855f377f to your computer and use it in GitHub Desktop.
Eigenvalues of random matrices from the Ginibre ensemble
Eigenvalues of a 2000×2000 random matrix from the Ginibre ensemble
┌────────────────────────────────────────┐
1.5 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢀⡄⣠⣤⢤⣧⣄⡤⡠⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⣐⢔⡾⣿⠳⡽⣯⢿⢷⡯⡿⣹⡽⣿⣽⢾⣰⣠⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⠀⠠⣰⡺⣽⣷⢏⣶⢽⣻⣻⣫⣿⡯⣿⢟⡿⣿⢿⣟⣯⣺⢷⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⣀⣿⣻⡟⣷⣷⡕⣛⢯⢾⣾⠯⢾⣿⡷⣝⣯⡯⣷⣋⢟⣿⣟⣿⢳⣀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⢿⡯⣿⣷⡵⣷⣪⣿⣷⣫⢯⡾⡽⣿⡜⣿⡷⣕⡿⣟⣿⣻⣳⡿⣽⣋⡆⠀⠀⠀⠀⠀⠀│
│⠤⠤⠤⠤⠤⠤⢼⣿⣿⣿⢽⣯⡯⢿⣾⢽⡿⣽⢽⣽⡿⢷⡿⢿⣵⣿⣽⣿⢮⢿⣯⣧⣿⠥⠤⠤⠤⠤⠤⠤│
│⠀⠀⠀⠀⠀⠀⠐⣽⡟⣯⣳⣯⣿⣿⣷⣯⢾⢷⣽⣏⣷⠟⣺⣜⣯⡝⣾⡻⡿⣿⣃⣿⣷⠁⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⠰⡫⣿⣾⢾⠿⣳⡿⣽⣿⣫⣊⣿⣟⣟⡿⡷⣽⣻⣾⢟⡟⡯⡿⡿⠈⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⠀⠈⠺⢿⣗⣮⣿⣽⡽⣝⣯⣻⡽⣿⣾⣝⣯⣿⡿⡏⣾⡹⡿⠍⠁⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠾⢫⢽⣿⣻⣿⣗⣭⣗⡽⣞⡾⢽⣫⣿⠊⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠛⠉⠛⠙⡟⠙⠚⠊⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
-1.5 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
└────────────────────────────────────────┘
-1.5 1.5
using Distributions
using LinearAlgebra
using UnicodePlots
function ginibre(N)
d = Normal(0, sqrt(1/2N))
reshape(rand(d, N^2), (N,N)) + im*reshape(rand(d, N^2), (N,N))
end
v = eigvals(ginibre(2000))
scatterplot(real(v), imag(v), xlim=[-1.5,1.5], ylim=[-1.5,1.5], title="Eigenvalues of a 2000×2000 random matrix from the Ginibre ensemble")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment