コード例 #1
0
ファイル: test_math.py プロジェクト: sfarrens/ModOpt
 def test_nuclear_norm(self):
     """Test nuclear_norm."""
     npt.assert_almost_equal(
         matrix.nuclear_norm(self.data1),
         15.49193338482967,
         err_msg='Incorrect nuclear norm',
     )
コード例 #2
0
    def _cost_method(self, *args, **kwargs):
        """Calculate low-rank component of the cost.

        This method returns the nuclear norm error of the deconvolved data in
        matrix form.

        Parameters
        ----------
        args : interable
            Positional arguments
        kwargs : dict
            Keyword arguments

        Returns
        -------
        float
            Low-rank cost component

        """
        cost_val = self.thresh * nuclear_norm(cube2matrix(args[0]))

        if 'verbose' in kwargs and kwargs['verbose']:
            print(' - NUCLEAR NORM (X):', cost_val)

        return cost_val
コード例 #3
0
    def _cost_method(self, *args, **kwargs):
        """Calculate low-rank component of the cost

        This method returns the nuclear norm error of the deconvolved data in
        matrix form

        Returns
        -------
        float low-rank cost component

        """

        cost_val = self.thresh * nuclear_norm(cube2matrix(args[0]))

        if 'verbose' in kwargs and kwargs['verbose']:
            print(' - NUCLEAR NORM (X):', cost_val)

        return cost_val