コード例 #1
0
ファイル: ccmod.py プロジェクト: rprimet/dicodile
    def obfn_dfd(self):
        r"""Compute data fidelity term :math:`(1/2) \| \sum_m
        \mathbf{d}_m * \mathbf{x}_m - \mathbf{s} \|_2^2`.
        """

        Ef = self.eval_Rf(self.Xf)
        return sl.rfl2norm2(Ef, self.S.shape, axis=self.cri.axisN) / 2.0
コード例 #2
0
ファイル: ccmod.py プロジェクト: rprimet/dicodile
    def obfn_dfd(self):
        r"""Compute data fidelity term :math:`(1/2) \| \sum_m
        \mathbf{d}_m * \mathbf{x}_m - \mathbf{s} \|_2^2`.
        """

        Ef = sl.inner(self.Zf, self.obfn_fvarf(), axis=self.cri.axisM) \
          - self.Sf
        return sl.rfl2norm2(Ef, self.S.shape, axis=self.cri.axisN) / 2.0
コード例 #3
0
    def obfn_dfd(self):
        r"""Compute data fidelity term :math:`(1/2) \| \sum_m
        \mathbf{d}_m * \mathbf{x}_m - \mathbf{s} \|_2^2`.
        This function takes into account the unnormalised DFT scaling,
        i.e. given that the variables are the DFT of multi-dimensional
        arrays computed via :func:`rfftn`, this returns the data fidelity
        term in the original (spatial) domain.
        """

        Ef = self.eval_Rf(self.Xf)
        return sl.rfl2norm2(Ef, self.S.shape, axis=self.cri.axisN) / 2.0
コード例 #4
0
ファイル: prlcnscdl.py プロジェクト: rprimet/dicodile
    def evaluate(self):
        """Evaluate functional value of previous iteration."""

        X = mp_Z_Y
        Xf = mp_Zf
        Df = mp_Df
        Sf = mp_Sf
        Ef = spl.inner(Df[np.newaxis, ...], Xf,
                       axis=self.xstep.cri.axisM + 1) - Sf
        Ef = np.swapaxes(Ef, 0, self.xstep.cri.axisK + 1)[0]
        dfd = spl.rfl2norm2(Ef, self.xstep.S.shape,
                            axis=self.xstep.cri.axisN) / 2.0
        rl1 = np.sum(np.abs(X))
        obj = dfd + self.xstep.lmbda * rl1
        return (obj, dfd, rl1)
コード例 #5
0
    def evaluate(self):
        """Evaluate functional value of previous iteration."""

        if self.opt['AccurateDFid']:
            if self.dmethod == 'fista':
                D = self.dstep.getdict(crop=False)
            else:
                D = self.dstep.var_y()
            if self.xmethod == 'fista':
                X = self.xstep.getcoef()
            else:
                X = self.xstep.var_y()
            Df = sl.rfftn(D, self.xstep.cri.Nv, self.xstep.cri.axisN)
            Xf = sl.rfftn(X, self.xstep.cri.Nv, self.xstep.cri.axisN)
            Sf = self.xstep.Sf
            Ef = sl.inner(Df, Xf, axis=self.xstep.cri.axisM) - Sf
            dfd = sl.rfl2norm2(
                Ef, self.xstep.S.shape, axis=self.xstep.cri.axisN) / 2.0
            rl1 = np.sum(np.abs(X))
            return dict(DFid=dfd,
                        RegL1=rl1,
                        ObjFun=dfd + self.xstep.lmbda * rl1)
        else:
            return None
コード例 #6
0
    def rsdl(self):
        """Compute fixed point residual in Fourier domain."""

        diff = self.Xf - self.Yfprv
        return sl.rfl2norm2(diff, self.X.shape, axis=self.cri.axisN)