Skip to content

Instantly share code, notes, and snippets.

View fgerick's full-sized avatar

Felix Gerick fgerick

View GitHub Profile
@fgerick
fgerick / subplots1cbar.jl
Created June 22, 2021 08:36
Two subplots with shared colorbar using PyPlot.jl
using PyPlot
f,ax = subplots(2)
y = randn(10,10)
y2 = randn(10,10)/maximum(abs.(y))
c1 = ax[1].pcolor(y)
c2 = ax[2].pcolor(y2)
f.colorbar(c2; ax=ax)
#gives same solution as mentioned in https://stackoverflow.com/questions/13784201/matplotlib-2-subplots-1-colorbar using ax=ax.ravel().tolist()
@fgerick
fgerick / quadgep.jl
Last active March 27, 2021 10:50
Quadruple precision sparse generalized eigen problem in Julia
# Solve for largest |λ| in Ax = λBx using quadruple precision :
# (B)^-1 Ax = λx
#as of now requires https://github.com/fgerick/ArnoldiMethod.jl and Julia >v1.4
using LinearAlgebra, SparseArrays, ArnoldiMethod, IncompleteLU, DoubleFloats, LinearMaps
n=100
T=Double64
A = sprandn(T,n,n,0.1)
B = sprandn(T,n,n,0.1) + I(n)

Keybase proof

I hereby claim:

  • I am fgerick on github.
  • I am felixg (https://keybase.io/felixg) on keybase.
  • I have a public key ASCKtmh1Fr-o7fPFedLk6xN0swd3W8PqgN65hBfwwySQiwo

To claim this, I am signing this object:

@fgerick
fgerick / atom.mplstyle
Created July 3, 2019 21:13
matplotlib theme for atom one-dark with color cycle from matplotlib dark_background theme
lines.color: abb2bf
patch.edgecolor: abb2bf
text.color: abb2bf
axes.facecolor: 282c34
axes.edgecolor: abb2bf
axes.labelcolor: abb2bf
axes.prop_cycle: cycler('color', ['8dd3c7', 'feffb3', 'bfbbd9', 'fa8174', '81b1d2', 'fdb462', 'b3de69', 'bc82bd', 'ccebc4', 'ffed6f'])
@fgerick
fgerick / eigstarget.jl
Last active July 4, 2019 08:04
Shift-invert Arnoldi for targeted generalised eigen problem in Julia
# Solve Ax = λBx using Shift-invert Arnoldi targeting complex σ:
# (A-σB)^-1 Bx = 1/(λ-σ)x
using LinearAlgebra, SparseArrays, Arpack, LinearMaps
n=100
A = sprandn(n,n,0.1)
B = sprandn(n,n,0.1) .+ sparse(1.0I,n,n)
# eigenvalue to target: