test_RRR.py 1.22 KB
Newer Older
robin.requadt's avatar
robin.requadt committed
1
2
3
4
5
6
import numpy as np
import unittest
from proxtoolbox.Algorithms.RRR import *
from proxtoolbox.ProxOperators.P_binary import *
from proxtoolbox.ProxOperators.P_RN import *
from proxtoolbox.ProxOperators.P_M import *
7
8


robin.requadt's avatar
robin.requadt committed
9
10
class test_RRR(unittest.TestCase):
    def test_RRR(self):
11
12
13
14
15
16
17
18
19
20
21
        config = {'proxoperators': [P_RN, P_M], 'beta0': 2, 'beta_max': 2, 'beta_switch': 1, 'prox_idx': 2, 'iter': 10,
                  'prox_idx': 2, 'support_idx': np.array([1, 2]), 'Nx': 8, 'Ny': 0, 'Nz': 0, 'Prox': [P_binary, P_RN],
                  'norm_data': 1, 'product_space_dimension': 5, 'beta_0': 2, 'M': np.array([1, 2, 2, 2, 2, 12])}
        self.pro = RRR(config)
        u = np.array([1, 2, 5, 6, -5, -6])
        self.assertEqual(self.pro.evaluate(u).tolist(), np.array(
            [-2.93569806278751 + 3.0408182027976864j, -1.1419114597009248 + 2.7029495135979418j,
             -6.127136941692142 - 0.3378686891997414j, -7.779020587713914 - 3.0408182027976864j,
             6.062835004479652 - 2.7029495135979418j, 7.920932047414839 + 0.3378686891997414j]).tolist())


robin.requadt's avatar
robin.requadt committed
22
23
if __name__ == '__main__':
    unittest.main()
24
25
# input:u=[1,2,5,6,-5,-6]
# output:[-2.9357+3.0408j,-1.1419+2.7029j,-6.1271-0.3379j, -7.7790-3.0408j,6.0628-2.7029j,7.9209+0.3379j]