Commit 09e874e6 authored by alexander.dornheim's avatar alexander.dornheim
Browse files

Replaced all variables called normM by norm_data to be consistent with matlab version

parent a89d2740
......@@ -75,7 +75,7 @@ class RAAR(Algorithm):
Maximum relaxation parameter
beta_switch:int
Iteration at which beta moves from beta0 -> beta_max
normM:number
norm_data:number
?
Nx:int
Row-dim of the product space elements
......@@ -88,7 +88,7 @@ class RAAR(Algorithm):
"""
self.proj1 = config['proj1'](config);
self.proj2 = config['proj2'](config);
self.normM = config['normM'];
self.norm_data = config['norm_data'];
self.beta0 = config['beta0'];
self.beta_max = config['beta_max'];
self.beta_switch = config['beta_switch'];
......@@ -99,7 +99,7 @@ class RAAR(Algorithm):
beta0 = self.beta0; beta_max = self.beta_max; beta_switch = self.beta_switch;
proj1 = self.proj1; proj2 = self.proj2;
normM = self.normM;
norm_data = self.norm_data;
Nx = self.Nx; Ny = self.Ny; Nz = self.Nz; dim = self.dim;
beta = beta0;
......@@ -123,17 +123,17 @@ class RAAR(Algorithm):
tmp_change = 0; tmp_gap = 0;
if Ny == 1 or Nx == 1:
tmp_change = (scipy.linalg.norm(u-tmp_u,'fro')/normM)**2;
tmp_gap = (scipy.linalg.norm(tmp3-tmp2,'fro')/normM)**2;
tmp_change = (scipy.linalg.norm(u-tmp_u,'fro')/norm_data)**2;
tmp_gap = (scipy.linalg.norm(tmp3-tmp2,'fro')/norm_data)**2;
elif Nz == 1:
for j in range(dim):
tmp_change += (scipy.linalg.norm(u[:,:,j]-tmp_u[:,:,j],'fro')/normM)**2;
tmp_gap += (scipy.linalg.norm(tmp3[:,:,j]-tmp2[:,:,j])/normM,'fro')**2;
tmp_change += (scipy.linalg.norm(u[:,:,j]-tmp_u[:,:,j],'fro')/norm_data)**2;
tmp_gap += (scipy.linalg.norm(tmp3[:,:,j]-tmp2[:,:,j])/norm_data,'fro')**2;
else:
for j in range(dim):
for k in range(Nz):
tmp_change += (scipy.linalg.norm(u[:,:,k,j]-tmp_u[:,:,k,j],'fro')/normM)**2;
tmp_gap += (scipy.linalg.norm(tmp3[:,:,k,j]-tmp2[:,:,k,j],'fro')/normM)**2;
tmp_change += (scipy.linalg.norm(u[:,:,k,j]-tmp_u[:,:,k,j],'fro')/norm_data)**2;
tmp_gap += (scipy.linalg.norm(tmp3[:,:,k,j]-tmp2[:,:,k,j],'fro')/norm_data)**2;
change[iters] = math.sqrt(tmp_change);
gap[iters] = math.sqrt(tmp_gap);
......@@ -195,7 +195,7 @@ class HPR(Algorithm):
Maximum relaxation parameter
beta_switch:int
Iteration at which beta moves from beta0 -> beta_max
normM:number
norm_data:number
?
Nx:int
Row-dim of the product space elements
......@@ -208,7 +208,7 @@ class HPR(Algorithm):
"""
self.proj1 = config['proj1'](config);
self.proj2 = config['proj2'](config);
self.normM = config['normM'];
self.norm_data = config['norm_data'];
self.beta0 = config['beta0'];
self.beta_max = config['beta_max'];
self.beta_switch = config['beta_switch'];
......@@ -219,7 +219,7 @@ class HPR(Algorithm):
def run(self, u, tol, maxiter):
beta0 = self.beta0; beta_max = self.beta_max; beta_switch = self.beta_switch;
proj1 = self.proj1; proj2 = self.proj2;
normM = self.normM;
norm_data = self.norm_data;
Nx = self.Nx; Ny = self.Ny; Nz = self.Nz; dim = self.dim;
beta = beta0;
......@@ -242,17 +242,17 @@ class HPR(Algorithm):
tmp_change = 0; tmp_gap = 0;
if Ny == 1 or Nx == 1:
tmp_change = (scipy.linalg.norm(u-tmp_u,'fro')/normM)**2;
tmp_gap = (scipy.linalg.norm(tmp3-tmp2,'fro')/normM)**2;
tmp_change = (scipy.linalg.norm(u-tmp_u,'fro')/norm_data)**2;
tmp_gap = (scipy.linalg.norm(tmp3-tmp2,'fro')/norm_data)**2;
elif Nz == 1:
for j in range(dim):
tmp_change += (scipy.linalg.norm(u[:,:,j]-tmp_u[:,:,j],'fro')/normM)**2;
tmp_gap += (scipy.linalg.norm(tmp3[:,:,j]-tmp2[:,:,j])/normM,'fro')**2;
tmp_change += (scipy.linalg.norm(u[:,:,j]-tmp_u[:,:,j],'fro')/norm_data)**2;
tmp_gap += (scipy.linalg.norm(tmp3[:,:,j]-tmp2[:,:,j])/norm_data,'fro')**2;
else:
for j in range(dim):
for k in range(Nz):
tmp_change += (scipy.linalg.norm(u[:,:,k,j]-tmp_u[:,:,k,j],'fro')/normM)**2;
tmp_gap += (scipy.linalg.norm(tmp3[:,:,k,j]-tmp2[:,:,k,j],'fro')/normM)**2;
tmp_change += (scipy.linalg.norm(u[:,:,k,j]-tmp_u[:,:,k,j],'fro')/norm_data)**2;
tmp_gap += (scipy.linalg.norm(tmp3[:,:,k,j]-tmp2[:,:,k,j],'fro')/norm_data)**2;
change[iters] = math.sqrt(tmp_change);
gap[iters] = math.sqrt(tmp_gap);
......@@ -304,7 +304,7 @@ class AP(Algorithm):
Maximum relaxation parameter
beta_switch:int
Iteration at which beta moves from beta0 -> beta_max
normM:number
norm_data:number
?
Nx:int
Row-dim of the product space elements
......@@ -316,14 +316,14 @@ class AP(Algorithm):
Size of the product space
"""
self.proj1 = config['proj1'](config); self.proj2 = config['proj2'](config);
self.normM = config['normM'];
self.norm_data = config['norm_data'];
self.Nx = config['Nx']; self.Ny = config['Ny']; self.Nz = config['Nz'];
self.dim = config['dim'];
def run(self, u, tol, maxiter):
proj1 = self.proj1; proj2 = self.proj2;
normM = self.normM;
norm_data = self.norm_data;
Nx = self.Nx; Ny = self.Ny; Nz = self.Nz; dim = self.dim;
iters = 0;
......@@ -341,17 +341,17 @@ class AP(Algorithm):
tmp_change = 0; tmp_gap = 0;
if Ny == 1 or Nx == 1:
tmp_change = (scipy.linalg.norm(u-tmp_u,'fro')/normM)**2;
tmp_gap = (scipy.linalg.norm(tmp1-tmp_u,'fro')/normM)**2;
tmp_change = (scipy.linalg.norm(u-tmp_u,'fro')/norm_data)**2;
tmp_gap = (scipy.linalg.norm(tmp1-tmp_u,'fro')/norm_data)**2;
elif Nz == 1:
for j in range(dim):
tmp_change += (scipy.linalg.norm(u[:,:,j]-tmp_u[:,:,j],'fro')/normM)**2;
tmp_gap += (scipy.linalg.norm(tmp1[:,:,j]-tmp_u[:,:,j])/normM,'fro')**2;
tmp_change += (scipy.linalg.norm(u[:,:,j]-tmp_u[:,:,j],'fro')/norm_data)**2;
tmp_gap += (scipy.linalg.norm(tmp1[:,:,j]-tmp_u[:,:,j])/norm_data,'fro')**2;
else:
for j in range(dim):
for k in range(Nz):
tmp_change += (scipy.linalg.norm(u[:,:,k,j]-tmp_u[:,:,k,j],'fro')/normM)**2;
tmp_gap += (scipy.linalg.norm(tmp1[:,:,k,j]-tmp_u[:,:,k,j],'fro')/normM)**2;
tmp_change += (scipy.linalg.norm(u[:,:,k,j]-tmp_u[:,:,k,j],'fro')/norm_data)**2;
tmp_gap += (scipy.linalg.norm(tmp1[:,:,k,j]-tmp_u[:,:,k,j],'fro')/norm_data)**2;
change[iters] = math.sqrt(tmp_change);
gap[iters] = math.sqrt(tmp_gap);
......
......@@ -851,7 +851,7 @@ class PtychographyStats():
self.Nx = config['Nx']; self.Ny = config['Ny'];
self.dim = config['dim'];
self.N_pie = config['N_pie'];
self.normM = config['normM'];
self.norm_data = config['norm_data'];
self.positions = config['positions'];
self.object_support = config['object_support'];
self.probe = config['probe'];
......@@ -913,18 +913,18 @@ class PtychographyStats():
number
The change
"""
normM = self.normM;
norm_data = self.norm_data;
changephi = 0.0;
if self.Nx == 1 or self.Ny == 1:
changephi = (scipy.linalg.norm(x1.phi-x2.phi,'fro')/normM)**2;
changephi = (scipy.linalg.norm(x1.phi-x2.phi,'fro')/norm_data)**2;
else:
for j in range(self.dim):
changephi += (scipy.linalg.norm(x1.phi[:,:,j]-x2.phi[:,:,j], \
'fro')/normM)**2;
changephi += (scipy.linalg.norm(x1.obj-x2.obj,'fro')/normM)**2;
changephi += (scipy.linalg.norm(x1.probe-x2.probe,'fro')/normM)**2;
'fro')/norm_data)**2;
changephi += (scipy.linalg.norm(x1.obj-x2.obj,'fro')/norm_data)**2;
changephi += (scipy.linalg.norm(x1.probe-x2.probe,'fro')/norm_data)**2;
return math.sqrt(changephi);
......@@ -952,7 +952,7 @@ class PtychographyStats():
fnorm = self.fnorm;
fmask = self.fmask;
amp_exp_norm = self.amp_exp_norm;
normM = self.normM;
norm_data = self.norm_data;
rangeNy = numpy.arange(self.Ny,dtype=numpy.int);
rangeNx = numpy.arange(self.Nx,dtype=numpy.int);
......@@ -987,10 +987,10 @@ class PtychographyStats():
change_phi = 0.0;
if self.Nx == 1 or self.Ny == 1:
change_phi = (scipy.linalg.norm(x1.phi-x2.phi,'fro')/normM)**2;
change_phi = (scipy.linalg.norm(x1.phi-x2.phi,'fro')/norm_data)**2;
else:
for j in range(self.dim):
change_phi += (scipy.linalg.norm(x1.phi[:,:,j]-x2.phi[:,:,j],'fro')/normM)**2;
change_phi += (scipy.linalg.norm(x1.phi[:,:,j]-x2.phi[:,:,j],'fro')/norm_data)**2;
if self.ptychography_prox == 'Thibault':
x2 = x2.copy();
......@@ -1401,7 +1401,7 @@ class PALM(Algorithm):
Depth-dim of the product space elements
dim:int
Size of the product space
normM:number
norm_data:number
?
ignore_error:boolean
Whether to ignore errors
......@@ -1497,7 +1497,7 @@ class RAAR_PALM(Algorithm):
Maximum relaxation parameter
beta_switch:int
Iteration at which beta moves from beta0 -> beta_max
normM:number
norm_data:number
?
ignore_error:boolean
Whether to ignore errors
......@@ -1641,7 +1641,7 @@ class Ptychography(Problem):
self.config['N_pie'] = self.config['nx']*self.config['ny'];
self.config['dim'] = self.config['N_pie'];
self.config['normM'] = 1;
self.config['norm_data'] = 1;
def _gaussu(self, rho, z, l, wnull):
......
......@@ -177,7 +177,7 @@ class Sudoku(Problem):
# in config
self.config = config.copy();
self.config['Nx'] = self.config['Ny'] = self.config['Nz'] = 9;
self.config['dim'] = 4; self.config['normM'] = 81;
self.config['dim'] = 4; self.config['norm_data'] = 81;
self.config['given_sudoku'] = config['given_sudoku'].copy();
self.algorithm = self.config['algorithm'](self.config);
......
......@@ -65,7 +65,7 @@ class Test_Problems(unittest.TestCase):
'Ny':9,
'Nz':9,
'dim':4,
'normM':81,
'norm_data':81,
# Just a random Sudoku. Not too easy, but no challenge for
# the mighty ProxToolbox!
'sudoku':((0,4,5,7,0,0,0,6,1),
......
......@@ -21,7 +21,7 @@ new_config = {
'Ny':9,
'Nz':9,
'dim':4,
'normM':81,
'norm_data':81,
# Just a random Sudoku. Not too easy, but no challenge for
# the mighty ProxToolbox!
'sudoku':((0,4,5,7,0,0,0,6,1),
......
......@@ -33,7 +33,7 @@ class AP_expert(Algorithm):
Maximum relaxation parameter
beta_switch: int
Iteration at which beta moves from beta0 -> beta_max
normM: number
norm_data: number
?
Nx: int
Row-dim of the product space elements
......@@ -45,7 +45,7 @@ class AP_expert(Algorithm):
Size of the product space
"""
self.prox1 = config['proxoperators'][0](config); self.prox2 = config['proxoperators'][1](config);
self.normM = config['normM'];
self.norm_data = config['norm_data'];
self.Nx = config['Nx']; self.Ny = config['Ny']; self.Nz = config['Nz'];
self.product_space_dimension = config['product_space_dimension'];
self.iters = 0
......@@ -72,7 +72,7 @@ class AP_expert(Algorithm):
q = u.shape[3]
normM = self.normM;
norm_data = self.norm_data;
iters = self.iters
change = zeros(maxiter+1);
......@@ -93,8 +93,8 @@ class AP_expert(Algorithm):
tmp_change = 0; tmp_gap = 0;
if p==1 and q==1:
tmp_change= (norm(u-tmp_u, 'fro')/normM)**2
tmp_gap = (norm(tmp1-tmp_u,'fro')/normM)**2
tmp_change= (norm(u-tmp_u, 'fro')/norm_data)**2
tmp_gap = (norm(tmp1-tmp_u,'fro')/norm_data)**2
if hasattr(self, 'truth'):
if self.truth_dim[0] == 1:
z=tmp_u[0,:]
......@@ -106,15 +106,15 @@ class AP_expert(Algorithm):
elif q==1:
for j in range(self.product_space_dimension):
tmp_change= tmp_change+(norm(u[:,:,j]-tmp_u[:,:,j], 'fro')/normM)**2
# compute (||P_SP_Mx-P_Mx||/normM)^2:
tmp_gap = tmp_gap+(norm(tmp1[:,:,j]-tmp_u[:,:,j],'fro')/normM)**2
tmp_change= tmp_change+(norm(u[:,:,j]-tmp_u[:,:,j], 'fro')/norm_data)**2
# compute (||P_SP_Mx-P_Mx||/norm_data)^2:
tmp_gap = tmp_gap+(norm(tmp1[:,:,j]-tmp_u[:,:,j],'fro')/norm_data)**2
else:
for j in range(self.product_space_dimension):
for k in range(self.Nz):
tmp_change= tmp_change+(norm(u[:,:,k,j]-tmp_u[:,:,k,j], 'fro')/normM)**2
# compute (||P_Sx-P_Mx||/normM)^2:
tmp_gap = tmp_gap+(norm(tmp1[:,:,k,j]-tmp_u[:,:,k,j],'fro')/(normM))**2
tmp_change= tmp_change+(norm(u[:,:,k,j]-tmp_u[:,:,k,j], 'fro')/norm_data)**2
# compute (||P_Sx-P_Mx||/norm_data)^2:
tmp_gap = tmp_gap+(norm(tmp1[:,:,k,j]-tmp_u[:,:,k,j],'fro')/(norm_data))**2
change[iters] = sqrt(tmp_change);
gap[iters] = sqrt(tmp_gap);
......
......@@ -49,7 +49,7 @@ class GRAAL(SimpleAlgorithm):
Maximum relaxation parameter
beta_switch: int
Iteration at which beta moves from beta_0 -> beta_max
normM: number
norm_data: number
?
Nx: int
Row-dim of the product space elements
......@@ -63,7 +63,7 @@ class GRAAL(SimpleAlgorithm):
self.prox1 = config['proxoperators'][0](config)
self.prox2 = config['proxoperators'][1](config)
self.normM = config['normM']
self.norm_data = config['norm_data']
self.Nx = config['Nx']; self.Ny = config['Ny']; self.Nz = config['Nz'];
self.product_space_dimension = config['product_space_dimension']
self.iter = 0
......
......@@ -56,7 +56,7 @@ class HAAR(Algorithm):
Maximum relaxation parameter
beta_switch: int
Iteration at which beta moves from beta0 -> beta_max
normM: number
norm_data: number
?
Nx: int
Row-dim of the product space elements
......@@ -68,7 +68,7 @@ class HAAR(Algorithm):
Size of the product space
"""
self.prox1 = config['proxoperators'][0](config); self.prox2 = config['proxoperators'][1](config)
self.normM = config['normM']
self.norm_data = config['norm_data']
self.Nx = config['Nx']; self.Ny = config['Ny']; self.Nz = config['Nz']
self.product_space_dimension = config['product_space_dimension']
self.iter = 0
......@@ -100,7 +100,7 @@ class HAAR(Algorithm):
Runs the algorithm for the specified input data
"""
prox1 = self.prox1; prox2 = self.prox2;
normM = self.normM
norm_data = self.norm_data
y0 = self.y0
......@@ -186,18 +186,18 @@ class HAAR(Algorithm):
tmp2 = prox1.work(tmp)
# compute the normalized change in successive iterates:
# change(iter) = sum(sum((feval('P_M',M,u)-tmp).^2))/normM;
# change(iter) = sum(sum((feval('P_M',M,u)-tmp).^2))/norm_data;
tmp_change=0; tmp_gap=0; tmp_shadow=0;
if dim_number <= 2:
tmp_change= (norm(y-y_new, 'fro')/normM)**2
tmp_change= (norm(y-y_new, 'fro')/norm_data)**2
if self.diagnostic == True:
# For Douglas-Rachford,in general it is appropriate to monitor the
# SHADOWS of the iterates, since in the convex case these converge
# even for beta=1.
# (see Bauschke-Combettes-Luke, J. Approx. Theory, 2004)
tmp_shadow = (norm(tmp-shadow,'fro')/normM)**2
tmp_gap = (norm(tmp-tmp2,'fro')/normM)**2
tmp_shadow = (norm(tmp-shadow,'fro')/norm_data)**2
tmp_gap = (norm(tmp-tmp2,'fro')/norm_data)**2
if hasattr(self, 'truth'):
if self.truth_dim[0] == 1:
......@@ -210,11 +210,11 @@ class HAAR(Algorithm):
elif dim_number == 3:
for j in range(self.product_space_dimension):
tmp_change= tmp_change+ (norm(y[:,:,j]-y_new[:,:,j], 'fro')/normM)**2
tmp_change= tmp_change+ (norm(y[:,:,j]-y_new[:,:,j], 'fro')/norm_data)**2
if self.diagnostic == True:
# compute (||P_SP_Mx-P_Mx||/normM)^2:
tmp_gap = tmp_gap+(norm(tmp[:,:,j]-tmp2[:,:,j],'fro')/normM)**2
tmp_shadow = tmp_shadow+(norm(tmp[:,:,j]-shadow[:,:,j],'fro')/normM)**2
# compute (||P_SP_Mx-P_Mx||/norm_data)^2:
tmp_gap = tmp_gap+(norm(tmp[:,:,j]-tmp2[:,:,j],'fro')/norm_data)**2
tmp_shadow = tmp_shadow+(norm(tmp[:,:,j]-shadow[:,:,j],'fro')/norm_data)**2
if self.diagnostic == True:
if hasattr(self, 'truth'):
z=tmp[:,:,0]
......
......@@ -40,7 +40,7 @@ class HPR(Algorithm):
Maximum relaxation parameter
beta_switch: int
Iteration at which beta moves from beta0 -> beta_max
normM: number
norm_data: number
?
Nx: int
Row-dim of the product space elements
......@@ -53,7 +53,7 @@ class HPR(Algorithm):
"""
self.proj1 = config['proj1'](config);
self.proj2 = config['proj2'](config);
self.normM = config['normM'];
self.norm_data = config['norm_data'];
self.beta0 = config['beta0'];
self.beta_max = config['beta_max'];
self.beta_switch = config['beta_switch'];
......@@ -70,7 +70,7 @@ class HPR(Algorithm):
beta_max = self.beta_max;
beta_switch = self.beta_switch;
proj1 = self.proj1; proj2 = self.proj2;
normM = self.normM;
norm_data = self.norm_data;
beta = self.beta0;
iters = self.iters
......@@ -93,17 +93,17 @@ class HPR(Algorithm):
tmp_change = 0; tmp_gap = 0;
if self.Ny == 1 or self.Nx == 1:
tmp_change = (norm(u-tmp_u,'fro')/normM)**2;
tmp_gap = (norm(tmp3-tmp2,'fro')/normM)**2;
tmp_change = (norm(u-tmp_u,'fro')/norm_data)**2;
tmp_gap = (norm(tmp3-tmp2,'fro')/norm_data)**2;
elif self.Nz == 1:
for j in range(self.dim):
tmp_change += (norm(u[:,:,j]-tmp_u[:,:,j],'fro')/normM)**2;
tmp_gap += (norm(tmp3[:,:,j]-tmp2[:,:,j])/normM,'fro')**2;
tmp_change += (norm(u[:,:,j]-tmp_u[:,:,j],'fro')/norm_data)**2;
tmp_gap += (norm(tmp3[:,:,j]-tmp2[:,:,j])/norm_data,'fro')**2;
else:
for j in range(self.dim):
for k in range(self.Nz):
tmp_change += (norm(u[:,:,k,j]-tmp_u[:,:,k,j],'fro')/normM)**2;
tmp_gap += (norm(tmp3[:,:,k,j]-tmp2[:,:,k,j],'fro')/normM)**2;
tmp_change += (norm(u[:,:,k,j]-tmp_u[:,:,k,j],'fro')/norm_data)**2;
tmp_gap += (norm(tmp3[:,:,k,j]-tmp2[:,:,k,j],'fro')/norm_data)**2;
change[iters] = sqrt(tmp_change);
gap[iters] = sqrt(tmp_gap);
......
......@@ -32,7 +32,7 @@ class PALM(Algorithm):
Depth-dim of the product space elements
dim:int
Size of the product space
normM:number
norm_data:number
?
ignore_error:boolean
Whether to ignore errors
......
......@@ -41,7 +41,7 @@ class QNAP(Algorithm):
self.iter = 0
self.prox1 = config['proxoperators'][0](config)
self.prox2 = config['proxoperators'][1](config)
self.normM = config['normM']
self.norm_data = config['norm_data']
self.Nx = config['Nx']; self.Ny = config['Ny']; self.Nz = config['Nz']
self.product_space_dimension = config['product_space_dimension']
......@@ -90,7 +90,7 @@ class QNAP(Algorithm):
if hasattr(self, 'truth'):
Relerrs = change.copy()
normM = self.normM
norm_data = self.norm_data
tmp1 = self.prox2.work(u)
......
......@@ -32,7 +32,7 @@ class RAAR_expert(Algorithm):
Maximum relaxation parameter
beta_switch: int
Iteration at which beta moves from beta_0 -> beta_max
normM: number
norm_data: number
?
Nx: int
Row-dim of the product space elements
......@@ -46,7 +46,7 @@ class RAAR_expert(Algorithm):
self.prox1 = config['proxoperators'][0](config)
self.prox2 = config['proxoperators'][1](config)
self.normM = config['normM']
self.norm_data = config['norm_data']
self.beta_0 = config['beta_0']
self.beta_max = config['beta_max']
self.beta_switch = config['beta_switch']
......@@ -65,7 +65,7 @@ class RAAR_expert(Algorithm):
"""
##### PREPROCESSING
normM = self.normM
norm_data = self.norm_data
beta = self.beta_0
iter = self.iter
......@@ -110,9 +110,9 @@ class RAAR_expert(Algorithm):
#print(norm(tmp_u))
if p==1 and q==1:
tmp_change= (norm(u-tmp_u, 'fro')/normM)**2
tmp_shadow = (norm(tmp3-shadow,'fro')/normM)**2
tmp_gap = (norm(tmp3-tmp2,'fro')/normM)**2
tmp_change= (norm(u-tmp_u, 'fro')/norm_data)**2
tmp_shadow = (norm(tmp3-shadow,'fro')/norm_data)**2
tmp_gap = (norm(tmp3-tmp2,'fro')/norm_data)**2
if hasattr(self, 'truth'):
if self.truth_dim[0] == 1:
......@@ -125,10 +125,10 @@ class RAAR_expert(Algorithm):
elif q==1:
for j in range(self.product_space_dimension):
tmp_change= tmp_change+ (norm(u[:,:,j]-tmp_u[:,:,j], 'fro')/normM)**2
# compute (||P_SP_Mx-P_Mx||/normM)^2:
tmp_gap = tmp_gap+(norm(tmp3[:,:,j]-tmp2[:,:,j],'fro')/normM)**2
tmp_shadow = tmp_shadow+(norm(tmp3[:,:,j]-shadow[:,:,j],'fro')/normM)**2
tmp_change= tmp_change+ (norm(u[:,:,j]-tmp_u[:,:,j], 'fro')/norm_data)**2
# compute (||P_SP_Mx-P_Mx||/norm_data)^2:
tmp_gap = tmp_gap+(norm(tmp3[:,:,j]-tmp2[:,:,j],'fro')/norm_data)**2
tmp_shadow = tmp_shadow+(norm(tmp3[:,:,j]-shadow[:,:,j],'fro')/norm_data)**2
if hasattr(self, 'truth'):
z=tmp3[:,:,0]
......@@ -137,10 +137,10 @@ class RAAR_expert(Algorithm):
else:
for j in range(self.product_space_dimension):
for k in range(Nz):
tmp_change= tmp_change+ (norm(u[:,:,k,j]-tmp_u[:,:,k,j], 'fro')/normM)**2
# compute (||P_Sx-P_Mx||/normM)^2:
tmp_gap = tmp_gap+(norm(tmp3[:,:,k,j]-tmp2[:,:,k,j],'fro')/(normM))**2
tmp_shadow = tmp_shadow+(norm(tmp3[:,:,k,j]-shadow[:,:,k,j],'fro')/(normM))**2
tmp_change= tmp_change+ (norm(u[:,:,k,j]-tmp_u[:,:,k,j], 'fro')/norm_data)**2
# compute (||P_Sx-P_Mx||/norm_data)^2:
tmp_gap = tmp_gap+(norm(tmp3[:,:,k,j]-tmp2[:,:,k,j],'fro')/(norm_data))**2
tmp_shadow = tmp_shadow+(norm(tmp3[:,:,k,j]-shadow[:,:,k,j],'fro')/(norm_data))**2
change[iter] = sqrt(tmp_change)
gap[iter] = sqrt(tmp_gap)
......
......@@ -25,7 +25,7 @@ class SimpleAlgorithm:
Maximum relaxation parameter
beta_switch: int
Iteration at which beta moves from beta_0 -> beta_max
normM: number
norm_data: number
?
Nx: int
Row-dim of the product space elements
......@@ -39,7 +39,7 @@ class SimpleAlgorithm:
self.prox1 = config['proxoperators'][0](config)
self.prox2 = config['proxoperators'][1](config)
self.normM = config['normM']
self.norm_data = config['norm_data']
self.Nx = config['Nx']; self.Ny = config['Ny']; self.Nz = config['Nz']
self.product_space_dimension = config['product_space_dimension']
self.iter = 0
......@@ -63,7 +63,7 @@ class SimpleAlgorithm:
##### PREPROCESSING
config = self.config
normM = self.normM
norm_data = self.norm_data
iter = self.iter
if u.ndim < 3:
......@@ -111,18 +111,18 @@ class SimpleAlgorithm:
u1 = self.prox1.work(u2)
# compute the normalized change in successive iterates:
# change(iter) = sum(sum((feval('P_M',M,u)-tmp).^2))/normM;