### Uploaded algorithm for Wirtinger Flow, removed some printouts and undid the...

`Uploaded algorithm for Wirtinger Flow, removed some printouts and undid the namechange for truth/Truth`
parent 47c6e1d9
 ... ... @@ -10,7 +10,7 @@ from numpy import zeros, angle from numpy import all as a from scipy.linalg import norm from .algorithms import Algorithm from trace import Trace class AP_expert(Algorithm): """ ... ... @@ -53,9 +53,9 @@ class AP_expert(Algorithm): self.iters = 0 if 'truth' in config: self.Truth = config['truth'] self.Truth_dim = config['truth_dim'] self.norm_Truth = config['norm_truth'] self.truth = config['truth'] self.truth_dim = config['truth_dim'] self.norm_truth = config['norm_truth'] def run(self, u, tol, maxiter): ... ... @@ -99,13 +99,13 @@ class AP_expert(Algorithm): tmp_gap = (norm(tmp1-tmp_u,'fro')/norm_data)**2 if hasattr(self, 'truth'): if self.Truth_dim == 1: if self.truth_dim == 1: z=tmp_u[0,:] elif self.Truth_dim==1: elif self.truth_dim==1: z=tmp_u[:,0] else: z=tmp_u Relerrs[iter] = norm(self.Truth - exp(-1j*angle(Trace(self.Truth.T*z))) * z, 'fro')/self.norm_Truth Relerrs[iter] = norm(self.truth - exp(-1j*angle(trace(self.truth.T*z))) * z, 'fro')/self.norm_truth elif q==1: for j in range(self.product_space_dimension): ... ...
 ... ... @@ -53,9 +53,9 @@ class SimpleAlgorithm: self.config = config if 'truth' in config: self.Truth = config['truth'] self.Truth_dim = config['truth_dim'] self.norm_Truth = config['norm_truth'] self.truth = config['truth'] self.truth_dim = config['truth_dim'] self.norm_truth = config['norm_truth'] if 'diagnostic' in config: self.diagnostic = True ... ... @@ -143,15 +143,15 @@ class SimpleAlgorithm: tmp_gap = phase_offset_compensated_norm(u1, u2, norm_factor=norm_data, norm_type='fro') ** 2 if hasattr(self, 'truth'): if self.Truth_dim == 1: if self.truth_dim == 1: z = u1[0, :] elif self.Truth_dim == 1: elif self.truth_dim == 1: z = u1[:, 0] else: z = u1 # Relerrs[iter] = norm(self.truth - exp(-1j * angle(trace(self.truth.T * z))) * z, # 'fro') / self.norm_truth Relerrs[iter] = phase_offset_compensated_norm(self.Truth, z, norm_factor=self.norm_Truth, Relerrs[iter] = phase_offset_compensated_norm(self.truth, z, norm_factor=self.norm_truth, norm_type='fro') elif q == 1: ... ... @@ -164,9 +164,8 @@ class SimpleAlgorithm: if 'diagnostic' in self.config: if hasattr(self, 'truth'): z = u1[:, :, 0] print(z.shape) print(self.Truth.T.shape) Relerrs[iter] = norm((self.Truth - exp(-1j * angle(trace(self.Truth.T * z))) * z),'fro') / self.norm_Truth Relerrs[iter] = norm((self.truth - exp(-1j * angle(trace(self.truth.T.transpose() * z))) * z),'fro') / self.norm_truth else: if 'diagnostic' in self.config: ... ... @@ -182,7 +181,7 @@ class SimpleAlgorithm: norm(u2[:, :, k, j] - shadow[:, :, k, j], 'fro') / (norm_data)) ** 2 if hasattr(self, 'truth') and (j == 0): Relerrs[iter] = Relerrs[iter] + norm( self.Truth - exp(-1j * angle(trace(self.truth.T * u1[:, :, k, 1]))) * u1[:, :, k, 1], self.truth - exp(-1j * angle(trace(self.truth.T * u1[:, :, k, 1]))) * u1[:, :, k, 1], 'fro') / self.norm_Truth change[iter] = sqrt(tmp_change) ... ...