示例#1
0
    def xstep(self):
        r"""Minimise Augmented Lagrangian with respect to
        :math:`\mathbf{x}`.
        """

        self.YU[:] = self.Y - self.U
        self.block_sep0(self.YU)[:] += self.S
        Zf = sl.rfftn(self.YU, None, self.cri.axisN)
        Z0f = self.block_sep0(Zf)
        Z1f = self.block_sep1(Zf)

        DZ0f = np.conj(self.Df) * Z0f
        DZ0fBQ = sl.dot(self.B.dot(self.Q).T, DZ0f, axis=self.cri.axisC)
        Z1fQ = sl.dot(self.Q.T, Z1f, axis=self.cri.axisC)
        b = DZ0fBQ + Z1fQ

        Xh = sl.solvedbd_sm(self.gDf, (self.mu / self.rho) * self.GHGf + 1.0,
                            b, self.c, axis=self.cri.axisM)
        self.Xf[:] = sl.dot(self.Q, Xh, axis=self.cri.axisC)
        self.X = sl.irfftn(self.Xf, self.cri.Nv, self.cri.axisN)

        if self.opt['LinSolveCheck']:
            DDXf = np.conj(self.Df) *  sl.inner(self.Df, self.Xf,
                                                axis=self.cri.axisM)
            DDXfBB = sl.dot(self.B.T.dot(self.B), DDXf, axis=self.cri.axisC)
            ax = self.rho * (DDXfBB + self.Xf) + \
                 self.mu * self.GHGf * self.Xf
            b = self.rho * (sl.dot(self.B.T, DZ0f, axis=self.cri.axisC)
                            + Z1f)
            self.xrrs = sl.rrs(ax, b)
        else:
            self.xrrs = None
示例#2
0
文件: pdcsc.py 项目: bwohlberg/sporco
    def xstep(self):
        r"""Minimise Augmented Lagrangian with respect to
        :math:`\mathbf{x}`.
        """

        self.YU[:] = self.Y - self.U
        self.block_sep0(self.YU)[:] += self.S
        Zf = sl.rfftn(self.YU, None, self.cri.axisN)
        Z0f = self.block_sep0(Zf)
        Z1f = self.block_sep1(Zf)

        DZ0f = np.conj(self.Df) * Z0f
        DZ0fBQ = sl.dot(self.B.dot(self.Q).T, DZ0f, axis=self.cri.axisC)
        Z1fQ = sl.dot(self.Q.T, Z1f, axis=self.cri.axisC)
        b = DZ0fBQ + Z1fQ

        Xh = sl.solvedbd_sm(self.gDf, (self.mu / self.rho) * self.GHGf + 1.0,
                            b, self.c, axis=self.cri.axisM)
        self.Xf[:] = sl.dot(self.Q, Xh, axis=self.cri.axisC)
        self.X = sl.irfftn(self.Xf, self.cri.Nv, self.cri.axisN)

        if self.opt['LinSolveCheck']:
            DDXf = np.conj(self.Df) *  sl.inner(self.Df, self.Xf,
                                                axis=self.cri.axisM)
            DDXfBB = sl.dot(self.B.T.dot(self.B), DDXf, axis=self.cri.axisC)
            ax = self.rho * (DDXfBB + self.Xf) + \
                 self.mu * self.GHGf * self.Xf
            b = self.rho * (sl.dot(self.B.T, DZ0f, axis=self.cri.axisC)
                            + Z1f)
            self.xrrs = sl.rrs(ax, b)
        else:
            self.xrrs = None
示例#3
0
 def test_10(self):
     N = 32
     M = 16
     K = 8
     D = util.complex_randn(N, N, 1, 1, M)
     X = util.complex_randn(N, N, 1, K, M)
     S = np.sum(D*X, axis=4, keepdims=True)
     d = 1e-1 * (np.random.randn(N, N, 1, 1, M).astype('complex') +
         np.random.randn(N, N, 1, 1, M).astype('complex') * 1.0j)
     Z = (D.conj()*np.sum(D*X, axis=4, keepdims=True) +
          d*X - D.conj()*S) / d
     Xslv = linalg.solvedbd_sm(D, d, D.conj()*S + d*Z)
     assert(linalg.rrs(D.conj()*np.sum(D*Xslv, axis=4, keepdims=True) +
                     d*Xslv, D.conj()*S + d*Z) < 1e-11)
示例#4
0
 def test_10(self):
     N = 32
     M = 16
     K = 8
     D = util.complex_randn(N, N, 1, 1, M)
     X = util.complex_randn(N, N, 1, K, M)
     S = np.sum(D*X, axis=4, keepdims=True)
     d = 1e-1 * (np.random.randn(N, N, 1, 1, M).astype('complex') +
         np.random.randn(N, N, 1, 1, M).astype('complex') * 1.0j)
     Z = (D.conj()*np.sum(D*X, axis=4, keepdims=True) +
          d*X - D.conj()*S) / d
     Xslv = linalg.solvedbd_sm(D, d, D.conj()*S + d*Z)
     assert(linalg.rrs(D.conj()*np.sum(D*Xslv, axis=4, keepdims=True) +
                     d*Xslv, D.conj()*S + d*Z) < 1e-11)