Skip to content

Commit

Permalink
[REF] Avoid cyclic import due to type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
f-dangel committed Jan 15, 2025
1 parent 6b97fe0 commit 5574b5b
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions curvlinops/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
from numpy import cumsum
from torch import Tensor

from curvlinops._torch_base import PyTorchLinearOperator


def split_list(x: Union[List, Tuple], sizes: List[int]) -> List[List]:
"""Split a list into multiple lists of specified size.
Expand Down Expand Up @@ -70,11 +68,11 @@ def allclose_report(
return close


def assert_is_square(A: Union[Tensor, PyTorchLinearOperator]) -> int:
def assert_is_square(A) -> int:
"""Assert that a matrix or linear operator is square.
Args:
A: Matrix or linear operator to be checked.
A: Matrix or linear operator to be checked. Must have a ``.shape`` attribute.
Returns:
The dimension of the square matrix.
Expand All @@ -88,13 +86,11 @@ def assert_is_square(A: Union[Tensor, PyTorchLinearOperator]) -> int:
return dim


def assert_matvecs_subseed_dim(
A: Union[Tensor, PyTorchLinearOperator], num_matvecs: int
):
def assert_matvecs_subseed_dim(A, num_matvecs: int):
"""Assert that the number of matrix-vector products is smaller than the dimension.
Args:
A: Matrix or linear operator to be checked.
A: Matrix or linear operator to be checked. Must have a ``.shape`` attribute.
num_matvecs: Number of matrix-vector products.
Raises:
Expand Down

0 comments on commit 5574b5b

Please sign in to comment.