|
29 | 29 | get_real_dtype, |
30 | 30 | inplace_set, |
31 | 31 | ) |
32 | | -from pylops.utils.typing import InputDimsLike, NDArray, SamplingLike |
| 32 | +from pylops.utils.typing import ( |
| 33 | + InputDimsLike, |
| 34 | + NDArray, |
| 35 | + SamplingLike, |
| 36 | + Tirlskind, |
| 37 | + Tmemunit, |
| 38 | + Tsolverengine, |
| 39 | + Tthreshkind, |
| 40 | +) |
33 | 41 |
|
34 | 42 | spgl1_message = deps.spgl1_import("the spgl1 solver") |
35 | 43 |
|
@@ -363,9 +371,9 @@ def _print_step(self, x: NDArray) -> None: |
363 | 371 |
|
364 | 372 | def memory_usage( |
365 | 373 | self, |
366 | | - kind: str = "data", |
| 374 | + kind: Tirlskind = "data", |
367 | 375 | show: bool = False, |
368 | | - unit: str = "B", |
| 376 | + unit: Tmemunit = "B", |
369 | 377 | ) -> float: |
370 | 378 | """Compute memory usage of the solver |
371 | 379 |
|
@@ -415,7 +423,7 @@ def setup( |
415 | 423 | epsI: float = 1e-10, |
416 | 424 | tolIRLS: float = 1e-10, |
417 | 425 | warm: bool = False, |
418 | | - kind: str = "data", |
| 426 | + kind: Tirlskind = "data", |
419 | 427 | preallocate: bool = False, |
420 | 428 | show: bool = False, |
421 | 429 | ) -> None: |
@@ -498,7 +506,9 @@ def setup( |
498 | 506 | if show: |
499 | 507 | self._print_setup() |
500 | 508 |
|
501 | | - def _step_data(self, x: NDArray, engine: str = "scipy", **kwargs_solver) -> NDArray: |
| 509 | + def _step_data( |
| 510 | + self, x: NDArray, engine: Tsolverengine = "scipy", **kwargs_solver |
| 511 | + ) -> NDArray: |
502 | 512 | r"""Run one step of solver with L1 data term""" |
503 | 513 | # add preallocate to keywords of solver |
504 | 514 | if self.preallocate and (engine == "pylops" or self.ncp != np): |
@@ -552,7 +562,7 @@ def _step_data(self, x: NDArray, engine: str = "scipy", **kwargs_solver) -> NDAr |
552 | 562 | return x |
553 | 563 |
|
554 | 564 | def _step_model( |
555 | | - self, x: NDArray, engine: str = "scipy", **kwargs_solver |
| 565 | + self, x: NDArray, engine: Tsolverengine = "scipy", **kwargs_solver |
556 | 566 | ) -> NDArray: |
557 | 567 | r"""Run one step of solver with L1 model term""" |
558 | 568 | # add preallocate to keywords of solver |
@@ -615,7 +625,7 @@ def _step_model( |
615 | 625 | def step( |
616 | 626 | self, |
617 | 627 | x: NDArray, |
618 | | - engine: str = "scipy", |
| 628 | + engine: Tsolverengine = "scipy", |
619 | 629 | show: bool = False, |
620 | 630 | **kwargs_solver, |
621 | 631 | ) -> NDArray: |
@@ -666,7 +676,7 @@ def run( |
666 | 676 | self, |
667 | 677 | x: Optional[NDArray], |
668 | 678 | nouter: int = 10, |
669 | | - engine: str = "scipy", |
| 679 | + engine: Tsolverengine = "scipy", |
670 | 680 | show: bool = False, |
671 | 681 | itershow: Tuple[int, int, int] = (10, 10, 10), |
672 | 682 | **kwargs_solver, |
@@ -760,9 +770,9 @@ def solve( |
760 | 770 | epsR: float = 1e-10, |
761 | 771 | epsI: float = 1e-10, |
762 | 772 | tolIRLS: float = 1e-10, |
763 | | - kind: str = "data", |
| 773 | + kind: Tirlskind = "data", |
764 | 774 | warm: bool = False, |
765 | | - engine: str = "scipy", |
| 775 | + engine: Tsolverengine = "scipy", |
766 | 776 | preallocate: bool = False, |
767 | 777 | show: bool = False, |
768 | 778 | itershow: Tuple[int, int, int] = (10, 10, 10), |
@@ -969,7 +979,7 @@ def _print_step(self, x: NDArray) -> None: |
969 | 979 | def memory_usage( |
970 | 980 | self, |
971 | 981 | show: bool = False, |
972 | | - unit: str = "B", |
| 982 | + unit: Tmemunit = "B", |
973 | 983 | ) -> float: |
974 | 984 | """Compute memory usage of the solver |
975 | 985 |
|
@@ -1085,7 +1095,7 @@ def step( |
1085 | 1095 | self, |
1086 | 1096 | x: NDArray, |
1087 | 1097 | cols: InputDimsLike, |
1088 | | - engine: str = "scipy", |
| 1098 | + engine: Tsolverengine = "scipy", |
1089 | 1099 | show: bool = False, |
1090 | 1100 | **kwargs_solver, |
1091 | 1101 | ) -> NDArray: |
@@ -1208,7 +1218,7 @@ def run( |
1208 | 1218 | self, |
1209 | 1219 | x: NDArray, |
1210 | 1220 | cols: InputDimsLike, |
1211 | | - engine: str = "scipy", |
| 1221 | + engine: Tsolverengine = "scipy", |
1212 | 1222 | show: bool = False, |
1213 | 1223 | itershow: Tuple[int, int, int] = (10, 10, 10), |
1214 | 1224 | ) -> Tuple[NDArray, InputDimsLike]: |
@@ -1302,7 +1312,7 @@ def solve( |
1302 | 1312 | normalizecols: bool = False, |
1303 | 1313 | Opbasis: Optional["LinearOperator"] = None, |
1304 | 1314 | optimal_coeff: bool = False, |
1305 | | - engine: str = "scipy", |
| 1315 | + engine: Tsolverengine = "scipy", |
1306 | 1316 | preallocate: bool = False, |
1307 | 1317 | show: bool = False, |
1308 | 1318 | itershow: Tuple[int, int, int] = (10, 10, 10), |
@@ -1549,7 +1559,7 @@ def _print_step( |
1549 | 1559 | def memory_usage( |
1550 | 1560 | self, |
1551 | 1561 | show: bool = False, |
1552 | | - unit: str = "B", |
| 1562 | + unit: Tmemunit = "B", |
1553 | 1563 | ) -> float: |
1554 | 1564 | """Compute memory usage of the solver |
1555 | 1565 |
|
@@ -1591,7 +1601,7 @@ def setup( |
1591 | 1601 | alpha: Optional[float] = None, |
1592 | 1602 | eigsdict: Optional[Dict[str, Any]] = None, |
1593 | 1603 | tol: float = 1e-10, |
1594 | | - threshkind: str = "soft", |
| 1604 | + threshkind: Tthreshkind = "soft", |
1595 | 1605 | perc: Optional[float] = None, |
1596 | 1606 | decay: Optional[NDArray] = None, |
1597 | 1607 | monitorres: bool = False, |
@@ -1983,7 +1993,7 @@ def solve( |
1983 | 1993 | alpha: Optional[float] = None, |
1984 | 1994 | eigsdict: Optional[Dict[str, Any]] = None, |
1985 | 1995 | tol: float = 1e-10, |
1986 | | - threshkind: str = "soft", |
| 1996 | + threshkind: Tthreshkind = "soft", |
1987 | 1997 | perc: Optional[float] = None, |
1988 | 1998 | decay: Optional[NDArray] = None, |
1989 | 1999 | monitorres: bool = False, |
@@ -2189,7 +2199,7 @@ class FISTA(ISTA): |
2189 | 2199 | def memory_usage( |
2190 | 2200 | self, |
2191 | 2201 | show: bool = False, |
2192 | | - unit: str = "B", |
| 2202 | + unit: Tmemunit = "B", |
2193 | 2203 | ) -> float: |
2194 | 2204 | """Compute memory usage of the solver |
2195 | 2205 |
|
@@ -2473,7 +2483,7 @@ def _print_finalize(self) -> None: |
2473 | 2483 | def memory_usage( |
2474 | 2484 | self, |
2475 | 2485 | show: bool = False, |
2476 | | - unit: str = "B", |
| 2486 | + unit: Tmemunit = "B", |
2477 | 2487 | ) -> float: |
2478 | 2488 | pass |
2479 | 2489 |
|
@@ -2820,7 +2830,7 @@ def memory_usage( |
2820 | 2830 | nopRegsL1: Optional[Tuple[int]] = None, |
2821 | 2831 | nopRegsL2: Optional[Tuple[int]] = None, |
2822 | 2832 | show: bool = False, |
2823 | | - unit: str = "B", |
| 2833 | + unit: Tmemunit = "B", |
2824 | 2834 | ) -> float: |
2825 | 2835 | """Compute memory usage of the solver |
2826 | 2836 |
|
@@ -3008,7 +3018,7 @@ def setup( |
3008 | 3018 | def step( |
3009 | 3019 | self, |
3010 | 3020 | x: NDArray, |
3011 | | - engine: str = "scipy", |
| 3021 | + engine: Tsolverengine = "scipy", |
3012 | 3022 | show: bool = False, |
3013 | 3023 | show_inner: bool = False, |
3014 | 3024 | **kwargs_solver, |
@@ -3116,7 +3126,7 @@ def step( |
3116 | 3126 | def run( |
3117 | 3127 | self, |
3118 | 3128 | x: NDArray, |
3119 | | - engine: str = "scipy", |
| 3129 | + engine: Tsolverengine = "scipy", |
3120 | 3130 | show: bool = False, |
3121 | 3131 | itershow: Tuple[int, int, int] = (10, 10, 10), |
3122 | 3132 | show_inner: bool = False, |
@@ -3208,7 +3218,7 @@ def solve( |
3208 | 3218 | tol: float = 1e-10, |
3209 | 3219 | tau: float = 1.0, |
3210 | 3220 | restart: bool = False, |
3211 | | - engine: str = "scipy", |
| 3221 | + engine: Tsolverengine = "scipy", |
3212 | 3222 | preallocate: bool = False, |
3213 | 3223 | show: bool = False, |
3214 | 3224 | itershow: Tuple[int, int, int] = (10, 10, 10), |
|
0 commit comments