@@ -149,9 +149,10 @@ def test_IRLS_datamodel(par):
149149 Aop = MatrixMult (np .asarray (A ), dtype = par ["dtype" ])
150150
151151 x = np .zeros (par ["nx" ]) + par ["imag" ] * np .zeros (par ["nx" ])
152- x [par ["nx" ] // 2 ] = 1
153- x [3 ] = 1
154- x [par ["nx" ] - 4 ] = - 1
152+ x [par ["nx" ] // 2 ] = 1.0 + par ["imag" ] * 1.0
153+ x [3 ] = 1.0 + par ["imag" ] * 1.0
154+ x [par ["nx" ] - 4 ] = - 1.0 - par ["imag" ] * 1.0
155+
155156 x0 = (
156157 np .asarray (
157158 npp .random .normal (0 , 1 , par ["nx" ])
@@ -186,15 +187,15 @@ def test_IRLS_datamodel(par):
186187def test_IRLS_model (par ):
187188 """Invert problem with model IRLS"""
188189 npp .random .seed (42 )
189- A = npp .random .normal ( 0 , 10 , ( par ["ny" ], par ["nx" ])) + par [
190- "imag"
191- ] * npp . random . normal ( 0 , 10 , ( par [ "ny" ], par [ "nx" ]) )
190+ A = npp .random .randn ( par ["ny" ], par ["nx" ]) + par ["imag" ] * npp . random . randn (
191+ par [ "ny" ], par [ "nx" ]
192+ )
192193 Aop = MatrixMult (np .asarray (A ), dtype = par ["dtype" ])
193194
194195 x = np .zeros (par ["nx" ]) + par ["imag" ] * np .zeros (par ["nx" ])
195- x [par ["nx" ] // 2 ] = 1
196- x [3 ] = 1
197- x [par ["nx" ] - 4 ] = - 1
196+ x [par ["nx" ] // 2 ] = 1.0 + par [ "imag" ] * 1.0
197+ x [3 ] = 1.0 + par [ "imag" ] * 1.0
198+ x [par ["nx" ] - 4 ] = - 1.0 - par [ "imag" ] * 1.0
198199 y = Aop * x
199200
200201 maxit = 100
@@ -210,15 +211,15 @@ def test_IRLS_model_stopping(par):
210211 """IRLS model testing stopping criterion rtol (here the class based
211212 solver is used as cost is not returned by the function based one)"""
212213 npp .random .seed (42 )
213- A = npp .random .normal ( 0 , 10 , ( par ["ny" ], par ["nx" ])) + par [
214- "imag"
215- ] * npp . random . normal ( 0 , 10 , ( par [ "ny" ], par [ "nx" ]) )
214+ A = npp .random .randn ( par ["ny" ], par ["nx" ]) + par ["imag" ] * npp . random . randn (
215+ par [ "ny" ], par [ "nx" ]
216+ )
216217 Aop = MatrixMult (np .asarray (A ), dtype = par ["dtype" ])
217218
218219 x = np .zeros (par ["nx" ]) + par ["imag" ] * np .zeros (par ["nx" ])
219- x [par ["nx" ] // 2 ] = 1
220- x [3 ] = 1
221- x [par ["nx" ] - 4 ] = - 1
220+ x [par ["nx" ] // 2 ] = 1.0 + par [ "imag" ] * 1.0
221+ x [3 ] = 1.0 + par [ "imag" ] * 1.0
222+ x [par ["nx" ] - 4 ] = - 1.0 - par [ "imag" ] * 1.0
222223 y = Aop * x
223224
224225 maxit = 100
@@ -247,15 +248,15 @@ def test_IRLS_model_stopping(par):
247248def test_MP (par ):
248249 """Invert problem with MP"""
249250 npp .random .seed (42 )
250- A = npp .random .normal ( 0 , 10 , ( par ["ny" ], par ["nx" ])) + par [
251- "imag"
252- ] * npp . random . normal ( 0 , 10 , ( par [ "ny" ], par [ "nx" ]) )
251+ A = npp .random .randn ( par ["ny" ], par ["nx" ]) + par ["imag" ] * npp . random . randn (
252+ par [ "ny" ], par [ "nx" ]
253+ )
253254 Aop = MatrixMult (np .asarray (A ), dtype = par ["dtype" ])
254255
255256 x = np .zeros (par ["nx" ]) + par ["imag" ] * np .zeros (par ["nx" ])
256- x [par ["nx" ] // 2 ] = 1
257- x [3 ] = 1
258- x [par ["nx" ] - 4 ] = - 1
257+ x [par ["nx" ] // 2 ] = 1.0 + par [ "imag" ] * 1.0
258+ x [3 ] = 1.0 + par [ "imag" ] * 1.0
259+ x [par ["nx" ] - 4 ] = - 1.0 - par [ "imag" ] * 1.0
259260 y = Aop * x
260261
261262 sigma = 1e-4
@@ -277,15 +278,15 @@ def test_MP(par):
277278def test_OMP (par ):
278279 """Invert problem with OMP"""
279280 npp .random .seed (42 )
280- A = npp .random .normal ( 0 , 10 , ( par ["ny" ], par ["nx" ])) + par [
281- "imag"
282- ] * npp . random . normal ( 0 , 10 , ( par [ "ny" ], par [ "nx" ]) )
281+ A = npp .random .randn ( par ["ny" ], par ["nx" ]) + par ["imag" ] * npp . random . randn (
282+ par [ "ny" ], par [ "nx" ]
283+ )
283284 Aop = MatrixMult (np .asarray (A ), dtype = par ["dtype" ])
284285
285286 x = np .zeros (par ["nx" ]) + par ["imag" ] * np .zeros (par ["nx" ])
286- x [par ["nx" ] // 2 ] = 1
287- x [3 ] = 1
288- x [par ["nx" ] - 4 ] = - 1
287+ x [par ["nx" ] // 2 ] = 1.0 + par [ "imag" ] * 1.0
288+ x [3 ] = 1.0 + par [ "imag" ] * 1.0
289+ x [par ["nx" ] - 4 ] = - 1.0 - par [ "imag" ] * 1.0
289290 y = Aop * x
290291
291292 sigma = 1e-4
@@ -299,15 +300,15 @@ def test_OMP(par):
299300def test_OMP_stopping (par ):
300301 """OMP testing stopping criterion rtol"""
301302 npp .random .seed (42 )
302- A = npp .random .normal ( 0 , 10 , ( par ["ny" ], par ["nx" ])) + par [
303- "imag"
304- ] * npp . random . normal ( 0 , 10 , ( par [ "ny" ], par [ "nx" ]) )
303+ A = npp .random .randn ( par ["ny" ], par ["nx" ]) + par ["imag" ] * npp . random . randn (
304+ par [ "ny" ], par [ "nx" ]
305+ )
305306 Aop = MatrixMult (np .asarray (A ), dtype = par ["dtype" ])
306307
307308 x = np .zeros (par ["nx" ]) + par ["imag" ] * np .zeros (par ["nx" ])
308- x [par ["nx" ] // 2 ] = 1
309- x [3 ] = 1
310- x [par ["nx" ] - 4 ] = - 1
309+ x [par ["nx" ] // 2 ] = 1.0 + par [ "imag" ] * 1.0
310+ x [3 ] = 1.0 + par [ "imag" ] * 1.0
311+ x [par ["nx" ] - 4 ] = - 1.0 - par [ "imag" ] * 1.0
311312 y = Aop * x
312313
313314 maxit = 100
@@ -505,15 +506,15 @@ def test_ISTA_FISTA_multiplerhs(par):
505506def test_ISTA_FISTA_stopping (par ):
506507 """ISTA/FISTA testing stopping criterion rtol"""
507508 npp .random .seed (42 )
508- A = npp .random .normal ( 0 , 10 , ( par ["ny" ], par ["nx" ])) + par [
509- "imag"
510- ] * npp . random . normal ( 0 , 10 , ( par [ "ny" ], par [ "nx" ]) )
509+ A = npp .random .randn ( par ["ny" ], par ["nx" ]) + par ["imag" ] * npp . random . randn (
510+ par [ "ny" ], par [ "nx" ]
511+ )
511512 Aop = MatrixMult (np .asarray (A ), dtype = par ["dtype" ])
512513
513514 x = np .zeros (par ["nx" ]) + par ["imag" ] * np .zeros (par ["nx" ])
514- x [par ["nx" ] // 2 ] = 1
515- x [3 ] = 1
516- x [par ["nx" ] - 4 ] = - 1
515+ x [par ["nx" ] // 2 ] = 1.0 + par [ "imag" ] * 1.0
516+ x [3 ] = 1.0 + par [ "imag" ] * 1.0
517+ x [par ["nx" ] - 4 ] = - 1.0 - par [ "imag" ] * 1.0
517518 y = Aop * x
518519
519520 eps = 0.5
0 commit comments