@@ -362,25 +362,27 @@ def test_ISTA_FISTA_multiplerhs(par):
362362)
363363def test_SPGL1 (par ):
364364 """Invert problem with SPGL1"""
365- if int (np_version [0 ]) < 2 :
366- np .random .seed (42 )
367- Aop = MatrixMult (np .random .randn (par ["ny" ], par ["nx" ]))
368-
369- x = np .zeros (par ["nx" ])
370- x [par ["nx" ] // 2 ] = 1
371- x [3 ] = 1
372- x [par ["nx" ] - 4 ] = - 1
373-
374- x0 = (
375- np .random .normal (0 , 10 , par ["nx" ])
376- + par ["imag" ] * np .random .normal (0 , 10 , par ["nx" ])
377- if par ["x0" ]
378- else None
379- )
380- y = Aop * x
381- xinv = spgl1 (Aop , y , x0 = x0 , iter_lim = 5000 )[0 ]
365+ if int (np_version [0 ]) >= 2 :
366+ return
382367
383- assert_array_almost_equal (x , xinv , decimal = 1 )
368+ np .random .seed (42 )
369+ Aop = MatrixMult (np .random .randn (par ["ny" ], par ["nx" ]))
370+
371+ x = np .zeros (par ["nx" ])
372+ x [par ["nx" ] // 2 ] = 1
373+ x [3 ] = 1
374+ x [par ["nx" ] - 4 ] = - 1
375+
376+ x0 = (
377+ np .random .normal (0 , 10 , par ["nx" ])
378+ + par ["imag" ] * np .random .normal (0 , 10 , par ["nx" ])
379+ if par ["x0" ]
380+ else None
381+ )
382+ y = Aop * x
383+ xinv = spgl1 (Aop , y , x0 = x0 , iter_lim = 5000 )[0 ]
384+
385+ assert_array_almost_equal (x , xinv , decimal = 1 )
384386
385387
386388@pytest .mark .parametrize ("par" , [(par1 ), (par2 ), (par1j ), (par2j )])
@@ -416,6 +418,6 @@ def test_SplitBregman(par):
416418 x0 = x0 if par ["x0" ] else None ,
417419 restart = False ,
418420 show = False ,
419- ** dict (iter_lim = 5 , damp = 1e-3 )
421+ ** dict (iter_lim = 5 , damp = 1e-3 ),
420422 )
421423 assert (np .linalg .norm (x - xinv ) / np .linalg .norm (x )) < 1e-1
0 commit comments