-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotresidues.py
29 lines (26 loc) · 1.08 KB
/
plotresidues.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import matplotlib.pyplot as plt
import numpy as np
from pow import pow
from innerouter import innerouter
from readandsavegraph import load_graph
import sys
basename = sys.argv[1]
a = 0.85
##compute everytime the methods
#P,d=load_graph(basename)
#xpow,respow = pow(P,d,alpha=a)
#xinout,resinout = innerouter(P,d,alpha = a)
#or better load residue vector from previous computtation
respow = np.loadtxt(basename+"-pow-residues")
resinout = np.loadtxt(basename+"-inout-residues")
resio2pi = np.loadtxt(basename+"-inoutpi-residues")
resgs = np.loadtxt(basename+"-gs-residues")
plt.plot(respow,'-g.', resinout, '-r.', resgs, '-b.', resio2pi, '-k.')
#plt.plot(respow,'.g-', resinout, '-r.', resio2pi, '-k.')
#plt.legend(('power method','inner-outer', 'inner-outer switch to pi'))
plt.legend(('power method','inner-outer', 'Gauss-Seidel', 'inner-outer switch to pi'))
plt.yscale('log')
#plt.text(20.0,-1.0,'Residues',fontsize=24)#, bbox=dict(edgecolor = 'black', facecolor='white'))
#plt.suptitle(r'Residues for $\alpha = %.2f$' % a,y=0.8,fontsize=24)
#plt.show()
plt.savefig(basename+"-plot.png", format='png')