@@ -994,7 +994,6 @@ def solve_circulant(
994994) -> onp .ArrayND [npc .inexact ]: ...
995995
996996#
997-
998997@overload # 2d bool sequence
999998def inv (a : Sequence [Sequence [bool ]], overwrite_a : bool = False , check_finite : bool = True ) -> onp .Array2D [np .float32 ]: ...
1000999@overload # Nd bool sequence
@@ -1036,19 +1035,35 @@ def inv(
10361035 a : onp .CanArrayND [np .complex128 | np .clongdouble , _ShapeT ], overwrite_a : bool = False , check_finite : bool = True
10371036) -> onp .ArrayND [np .complex128 , _ShapeT ]: ...
10381037
1039- # TODO(jorenham): improve this
1040- @overload # floating 2d
1041- def det (a : onp .ToFloatStrict2D , overwrite_a : bool = False , check_finite : bool = True ) -> _Float : ...
1042- @overload # floating 3d
1043- def det (a : onp .ToFloatStrict3D , overwrite_a : bool = False , check_finite : bool = True ) -> _Float1D : ...
1044- @overload # floating
1045- def det (a : onp .ToFloatND , overwrite_a : bool = False , check_finite : bool = True ) -> _Float | _FloatND : ...
1046- @overload # complexfloating 2d
1047- def det (a : onp .ToJustComplexStrict2D , overwrite_a : bool = False , check_finite : bool = True ) -> _Inexact1D : ...
1048- @overload # complexfloating 3d
1049- def det (a : onp .ToJustComplexStrict3D , overwrite_a : bool = False , check_finite : bool = True ) -> _InexactND : ...
1050- @overload # complexfloating
1051- def det (a : onp .ToComplexND , overwrite_a : bool = False , check_finite : bool = True ) -> _Inexact | _InexactND : ...
1038+ # NOTE: The order of the overloads has been carefully chosen to avoid triggering a Pyright bug.
1039+ @overload # +float64 2d
1040+ def det (a : onp .ToFloat64Strict2D , overwrite_a : bool = False , check_finite : bool = True ) -> np .float64 : ...
1041+ @overload # complex128 | complex64 2d
1042+ def det (
1043+ a : onp .ToArrayStrict2D [op .JustComplex , np .complex128 | np .complex64 ], overwrite_a : bool = False , check_finite : bool = True
1044+ ) -> np .complex128 : ...
1045+ @overload # +float64 3d
1046+ def det (a : onp .ToFloat64Strict3D , overwrite_a : bool = False , check_finite : bool = True ) -> onp .Array1D [np .float64 ]: ...
1047+ @overload # complex128 | complex64 3d
1048+ def det (
1049+ a : onp .ToArrayStrict3D [op .JustComplex , np .complex128 | np .complex64 ], overwrite_a : bool = False , check_finite : bool = True
1050+ ) -> onp .Array1D [np .complex128 ]: ...
1051+ @overload # +float64 ND
1052+ def det (a : onp .ToFloat64_ND , overwrite_a : bool = False , check_finite : bool = True ) -> np .float64 | onp .ArrayND [np .float64 ]: ...
1053+ @overload # complex128 | complex64 Nd
1054+ def det (
1055+ a : onp .ToArrayND [op .JustComplex , np .complex128 | np .complex64 ], overwrite_a : bool = False , check_finite : bool = True
1056+ ) -> np .complex128 | onp .ArrayND [np .complex128 ]: ...
1057+ @overload # +complex128 2d
1058+ def det (a : onp .ToComplex128Strict2D , overwrite_a : bool = False , check_finite : bool = True ) -> np .float64 | np .complex128 : ...
1059+ @overload # +complex128 3d
1060+ def det (
1061+ a : onp .ToComplex128Strict3D , overwrite_a : bool = False , check_finite : bool = True
1062+ ) -> onp .Array1D [np .float64 | np .complex128 ]: ...
1063+ @overload # +complex128 Nd
1064+ def det (
1065+ a : onp .ToComplex128_ND , overwrite_a : bool = False , check_finite : bool = True
1066+ ) -> np .float64 | np .complex128 | onp .ArrayND [np .float64 | np .complex128 ]: ...
10521067
10531068# TODO(jorenham): improve this
10541069@overload # (float[:, :], float[:]) -> (float[:], float[], ...)
0 commit comments