Coverage for src\pqlattice\typing\_types.py: 82%

1 from fractions import Fraction

2 from typing import Any

3

4 from numpy.typing import NDArray

5

6 type Array = NDArray[Any]

7

8 type Vector = NDArray[Any]

9 type Matrix = NDArray[Any]

10 type SquareMatrix = NDArray[Any]

11

12

13 def is_rational(a: Array) -> bool:

14 return isinstance(a.flat[0], Fraction)

15

16

17 def is_integer(a: Array) -> bool:

18 return isinstance(a.flat[0], int)