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

        self.X = np.asarray(sl.lu_solve_ATAI(
            self.D, self.rho, self.DTS + self.rho * (self.Y - self.U), self.lu,
            self.piv),
                            dtype=self.dtype)
Esempio n. 2
0
    def xstep(self):
        r"""Minimise Augmented Lagrangian with respect to
        :math:`\mathbf{x}`.
        """

        YU = self.Y - self.U
        self.X = np.asarray(sl.lu_solve_ATAI(self.D, 1.0, self.block_sep0(YU) +
                    self.D.T.dot(self.block_sep1(YU)), self.lu, self.piv),
                    dtype=self.dtype)
Esempio n. 3
0
    def xistep(self, i):
        r"""
        Minimise Augmented Lagrangian with respect to :math:`\mathbf{x}`
        component :math:`\mathbf{x}_i`.
        """

        self.X[..., i] = spl.lu_solve_ATAI(self.A[i], self.rho,
                    self.ATS[i] + self.rho*(self.Y - self.U[..., i]),
                    self.lu[i], self.piv[i])
Esempio n. 4
0
    def xistep(self, i):
        r"""
        Minimise Augmented Lagrangian with respect to :math:`\mathbf{x}`
        component :math:`\mathbf{x}_i`.
        """

        self.X[..., i] = spl.lu_solve_ATAI(self.A[i], self.rho,
                    self.ATS[i] + self.rho*(self.Y - self.U[..., i]),
                    self.lu[i], self.piv[i])
Esempio n. 5
0
 def test_02(self):
     rho = 1e-1
     N = 128
     M = 64
     K = 32
     D = np.random.randn(N, M)
     X = np.random.randn(M, K)
     S = D.dot(X)
     Z = (D.T.dot(D).dot(X) + rho*X - D.T.dot(S)) / rho
     lu, piv = linalg.lu_factor(D, rho)
     Xslv = linalg.lu_solve_ATAI(D, rho, D.T.dot(S) + rho*Z, lu, piv)
     assert(linalg.rrs(D.T.dot(D).dot(Xslv) + rho*Xslv,
                     D.T.dot(S) + rho*Z) < 1e-14)
Esempio n. 6
0
 def test_02(self):
     rho = 1e-1
     N = 128
     M = 64
     K = 32
     D = np.random.randn(N, M)
     X = np.random.randn(M, K)
     S = D.dot(X)
     Z = (D.T.dot(D).dot(X) + rho*X - D.T.dot(S)) / rho
     lu, piv = linalg.lu_factor(D, rho)
     Xslv = linalg.lu_solve_ATAI(D, rho, D.T.dot(S) + rho*Z, lu, piv)
     assert(linalg.rrs(D.T.dot(D).dot(Xslv) + rho*Xslv,
                     D.T.dot(S) + rho*Z) < 1e-14)
Esempio n. 7
0
    def xstep(self):
        r"""Minimise Augmented Lagrangian with respect to :math:`\mathbf{x}`."""

        self.X = np.asarray(sl.lu_solve_ATAI(
            self.D, self.rho, self.DTS + self.rho * (self.Y - self.U), self.lu,
            self.piv),
                            dtype=self.dtype)

        if self.opt['LinSolveCheck']:
            b = self.DTS + self.rho * (self.Y - self.U)
            ax = self.D.T.dot(self.D.dot(self.X)) + self.rho * self.X
            self.xrrs = sl.rrs(ax, b)
        else:
            self.xrrs = None
Esempio n. 8
0
 def xstep(self):
     self.extra_timer.start('xstep')
     rhs = self.cnst_A0T(self._Y0 - self._U0) + \
         self.gamma * (self.gamma * self._Y1 - self._U1)
     # NOTE:
     # Here we solve the sparse code X for each batch index i, since X is
     # organized as [batch_size, num_atoms, num_signals].  This interface
     # may be modified for online setting.
     for i in range(self.X.shape[0]):
         self.X[i] = np.asarray(
             sl.lu_solve_ATAI(self.D, self.gamma**2, rhs[i], self.lu, self.piv),
             dtype=self.dtype
         )
     self.extra_timer.stop('xstep')