Esempio n. 1
0
 def test_22(self):
     N = 32
     M = 4
     Nd = 8
     D = cp.random.randn(Nd, Nd, M)
     D /= cp.sqrt(cp.sum(D**2, axis=(0, 1)))
     X0 = cp.zeros((N, N, M))
     xr = cp.random.randn(N, N, M)
     xp = cp.abs(xr) > 3
     X0[xp] = cp.random.randn(X0[xp].size)
     S = cp.sum(fftconv(D, X0), axis=2)
     lmbda = 1e-3
     opt = cbpdn.ConvBPDN.Options(
         {'Verbose': False, 'MaxMainIter': 500, 'RelStopTol': 1e-5,
          'rho': 5e-1, 'AutoRho': {'Enabled': False}})
     bp = cbpdn.ConvBPDN(D, S, lmbda, opt)
     Xp = bp.solve()
     epsilon = cp.linalg.norm(bp.reconstruct(Xp).squeeze() - S)
     opt = cbpdn.ConvMinL1InL2Ball.Options(
         {'Verbose': False, 'MaxMainIter': 500, 'RelStopTol': 1e-5,
          'rho': 2e2, 'RelaxParam': 1.0, 'AutoRho': {'Enabled': False}})
     bc = cbpdn.ConvMinL1InL2Ball(D, S, epsilon=epsilon, opt=opt)
     Xc = bc.solve()
     assert cp.linalg.norm(Xp - Xc) / cp.linalg.norm(Xp) < 1e-3
     assert cp.abs(cp.linalg.norm(Xp.ravel(), 1) -
                   cp.linalg.norm(Xc.ravel(), 1)) < 1e-3
Esempio n. 2
0
 def test_20(self):
     N = 16
     Nd = 5
     M = 4
     D = cp.random.randn(Nd, Nd, M)
     s = cp.random.randn(N, N)
     epsilon = 1e0
     try:
         b = cbpdn.ConvMinL1InL2Ball(D, s, epsilon)
         b.solve()
     except Exception as e:
         print(e)
         assert 0
Esempio n. 3
0
 def test_21(self):
     N = 16
     Nd = 5
     K = 2
     M = 4
     D = cp.random.randn(Nd, Nd, M)
     s = cp.random.randn(N, N, K)
     dt = cp.float32
     opt = cbpdn.ConvMinL1InL2Ball.Options(
         {'Verbose': False, 'MaxMainIter': 20, 'AutoRho':
          {'Enabled': True}, 'DataType': dt})
     epsilon = 1e0
     b = cbpdn.ConvMinL1InL2Ball(D, s, epsilon, opt=opt)
     b.solve()
     assert b.X.dtype == dt
     assert b.Y.dtype == dt
     assert b.U.dtype == dt