Commit ab43cbce authored by Alessandro Mirone's avatar Alessandro Mirone

aggiunto progetto Jerome

parent b2cf2700
This diff is collapsed.
import time
import numpy
#import random
from numpy import *
from numpy.fft import ifft
from pylab import *
import matplotlib.pyplot as plt
import moduleJL2 as JL2
N = 40
A = JL2.gen_base(N)
[source,b] = JL2.gen_image(N,0.1)
rho = linspace(0.1,1,10)
s = linspace(0.01,0.1,10)
e_FISTA = zeros(10)
e_PRCG = zeros(10)
e_CP = zeros(10)
for i in range(10):
P1 = JL2.Problem(A,b,rho[i],0.01,source)
P1.fista_n(False,True)
e_FISTA[i] = P1.err_F[30]
P1.PR_CG()
e_PRCG[i] = P1.err_CG[30]
P1.CP()
e_CP[i] = P1.err_CP[30]
show()
plot(rho,e_FISTA,'r',label='FISTA')
plot(rho,e_PRCG,'g',label='PR-CG')
plot(rho,e_CP,'c',label='CP')
ylim(0,1)
title('Analyse de l''erreur apres 30 iterations - sigma = 0.1 - s = 0.01')
xlabel("s")
ylabel("erreur")
show()
import time
import numpy
#import random
from numpy import *
from numpy.fft import ifft
from pylab import *
import matplotlib.pyplot as plt
import moduleJL2 as JL2
N = 40
A = JL2.gen_base(N)
[source,b] = JL2.gen_image(N,0.1)
rho = linspace(0.1,1,10)
s = linspace(0.005,0.015,10)
e_FISTA = zeros(10)
e_PRCG = zeros(10)
e_CP = zeros(10)
for i in range(10):
P1 = JL2.Problem(A,b,0.5,s[i],source)
P1.fista_n(False,True)
e_FISTA[i] = P1.err_F[30]
P1.PR_CG()
e_PRCG[i] = P1.err_CG[30]
P1.CP()
e_CP[i] = P1.err_CP[30]
show()
plot(s,e_FISTA,'r',label='FISTA')
plot(s,e_PRCG,'g',label='PR-CG')
plot(s,e_CP,'c',label='CP')
ylim(0,1)
title("Analyse de l'erreur apres 30 iterations - sigma = 0.1 - rho = 0.5")
xlabel("s")
ylabel("erreur")
show()
import time
import numpy
#import random
from numpy import *
from numpy.fft import ifft
from pylab import *
import matplotlib.pyplot as plt
import moduleJL2 as JL2
N = 40
A = JL2.gen_base(N)
[source,b] = JL2.gen_image(N,0.1)
P1 = JL2.Problem(A,b,0.5,0.01,source)
#P1.niter(40)
a=time.clock()
P1.fista_n(False,True)
b=time.clock()
P1.PR_CG()
c=time.clock()
P1.CP()
d = time.clock()
print("FISTA : ",str(b-a))
print("PR_CG : ",str(c-b))
print("CP : ",str(d-c))
x = arange(P1.niter_CG+1)
plot(x,P1.err_F,'r',label='FISTA')
plot(x,P1.err_CG,'g',label='PR-CG')
plot(x,P1.err_CP,'c',label='CP')
legend()
show()
#P1.graph()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment