增加环绕侦察场景适配
This commit is contained in:
@@ -10,12 +10,18 @@ from .polynomial import Polynomial
|
||||
|
||||
__all__ = [
|
||||
"set_default_printstyle",
|
||||
"polynomial", "Polynomial",
|
||||
"chebyshev", "Chebyshev",
|
||||
"legendre", "Legendre",
|
||||
"hermite", "Hermite",
|
||||
"hermite_e", "HermiteE",
|
||||
"laguerre", "Laguerre",
|
||||
"polynomial",
|
||||
"Polynomial",
|
||||
"chebyshev",
|
||||
"Chebyshev",
|
||||
"legendre",
|
||||
"Legendre",
|
||||
"hermite",
|
||||
"Hermite",
|
||||
"hermite_e",
|
||||
"HermiteE",
|
||||
"laguerre",
|
||||
"Laguerre",
|
||||
]
|
||||
|
||||
def set_default_printstyle(style: Literal["ascii", "unicode"]) -> None: ...
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
import abc
|
||||
import decimal
|
||||
import numbers
|
||||
from collections.abc import Iterator, Mapping, Sequence
|
||||
from collections.abc import Iterator, Sequence
|
||||
from typing import (
|
||||
Any,
|
||||
ClassVar,
|
||||
Generic,
|
||||
Literal,
|
||||
LiteralString,
|
||||
Self,
|
||||
SupportsIndex,
|
||||
TypeAlias,
|
||||
overload,
|
||||
)
|
||||
|
||||
from typing_extensions import TypeIs, TypeVar
|
||||
|
||||
import numpy as np
|
||||
@@ -40,92 +37,72 @@ from ._polytypes import (
|
||||
|
||||
__all__ = ["ABCPolyBase"]
|
||||
|
||||
_NameCo = TypeVar(
|
||||
"_NameCo",
|
||||
bound=LiteralString | None,
|
||||
covariant=True,
|
||||
default=LiteralString | None
|
||||
)
|
||||
_Other = TypeVar("_Other", bound=ABCPolyBase)
|
||||
|
||||
_NameT_co = TypeVar("_NameT_co", bound=str | None, default=str | None, covariant=True)
|
||||
_PolyT = TypeVar("_PolyT", bound=ABCPolyBase)
|
||||
_AnyOther: TypeAlias = ABCPolyBase | _CoefLike_co | _SeriesLikeCoef_co
|
||||
_Hundred: TypeAlias = Literal[100]
|
||||
|
||||
class ABCPolyBase(Generic[_NameCo], abc.ABC):
|
||||
__hash__: ClassVar[None] # type: ignore[assignment] # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
__array_ufunc__: ClassVar[None]
|
||||
class ABCPolyBase(Generic[_NameT_co], abc.ABC):
|
||||
__hash__: ClassVar[None] = None # type: ignore[assignment] # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
__array_ufunc__: ClassVar[None] = None
|
||||
maxpower: ClassVar[Literal[100]] = 100
|
||||
|
||||
maxpower: ClassVar[_Hundred]
|
||||
_superscript_mapping: ClassVar[Mapping[int, str]]
|
||||
_subscript_mapping: ClassVar[Mapping[int, str]]
|
||||
_use_unicode: ClassVar[bool]
|
||||
_superscript_mapping: ClassVar[dict[int, str]] = ...
|
||||
_subscript_mapping: ClassVar[dict[int, str]] = ...
|
||||
_use_unicode: ClassVar[bool] = ...
|
||||
|
||||
basis_name: _NameCo
|
||||
coef: _CoefSeries
|
||||
domain: _Array2[np.inexact | np.object_]
|
||||
window: _Array2[np.inexact | np.object_]
|
||||
|
||||
_symbol: LiteralString
|
||||
_symbol: str
|
||||
@property
|
||||
def symbol(self, /) -> LiteralString: ...
|
||||
def symbol(self, /) -> str: ...
|
||||
@property
|
||||
@abc.abstractmethod
|
||||
def domain(self) -> _Array2[np.float64 | Any]: ...
|
||||
@property
|
||||
@abc.abstractmethod
|
||||
def window(self) -> _Array2[np.float64 | Any]: ...
|
||||
@property
|
||||
@abc.abstractmethod
|
||||
def basis_name(self) -> _NameT_co: ...
|
||||
|
||||
coef: _CoefSeries
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
/,
|
||||
coef: _SeriesLikeCoef_co,
|
||||
domain: _SeriesLikeCoef_co | None = ...,
|
||||
window: _SeriesLikeCoef_co | None = ...,
|
||||
symbol: str = ...,
|
||||
domain: _SeriesLikeCoef_co | None = None,
|
||||
window: _SeriesLikeCoef_co | None = None,
|
||||
symbol: str = "x",
|
||||
) -> None: ...
|
||||
|
||||
#
|
||||
@overload
|
||||
def __call__(self, /, arg: _Other) -> _Other: ...
|
||||
# TODO: Once `_ShapeT@ndarray` is covariant and bounded (see #26081),
|
||||
# additionally include 0-d arrays as input types with scalar return type.
|
||||
def __call__(self, /, arg: _PolyT) -> _PolyT: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
arg: _FloatLike_co | decimal.Decimal | numbers.Real | np.object_,
|
||||
) -> np.float64 | np.complex128: ...
|
||||
def __call__(self, /, arg: _FloatLike_co | decimal.Decimal) -> np.float64 | Any: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
arg: _NumberLike_co | numbers.Complex,
|
||||
) -> np.complex128: ...
|
||||
def __call__(self, /, arg: _NumberLike_co) -> np.complex128 | Any: ...
|
||||
@overload
|
||||
def __call__(self, /, arg: _ArrayLikeFloat_co) -> (
|
||||
npt.NDArray[np.float64]
|
||||
| npt.NDArray[np.complex128]
|
||||
| npt.NDArray[np.object_]
|
||||
): ...
|
||||
def __call__(self, /, arg: _ArrayLikeFloat_co) -> npt.NDArray[np.float64 | Any]: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
arg: _ArrayLikeComplex_co,
|
||||
) -> npt.NDArray[np.complex128] | npt.NDArray[np.object_]: ...
|
||||
def __call__(self, /, arg: _ArrayLikeComplex_co) -> npt.NDArray[np.complex128 | Any]: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
arg: _ArrayLikeCoefObject_co,
|
||||
) -> npt.NDArray[np.object_]: ...
|
||||
def __call__(self, /, arg: _ArrayLikeCoefObject_co) -> npt.NDArray[np.object_]: ...
|
||||
|
||||
def __format__(self, fmt_str: str, /) -> str: ...
|
||||
def __eq__(self, x: object, /) -> bool: ...
|
||||
def __ne__(self, x: object, /) -> bool: ...
|
||||
# unary ops
|
||||
def __neg__(self, /) -> Self: ...
|
||||
def __pos__(self, /) -> Self: ...
|
||||
|
||||
# binary ops
|
||||
def __add__(self, x: _AnyOther, /) -> Self: ...
|
||||
def __sub__(self, x: _AnyOther, /) -> Self: ...
|
||||
def __mul__(self, x: _AnyOther, /) -> Self: ...
|
||||
def __pow__(self, x: _AnyOther, /) -> Self: ...
|
||||
def __truediv__(self, x: _AnyOther, /) -> Self: ...
|
||||
def __floordiv__(self, x: _AnyOther, /) -> Self: ...
|
||||
def __mod__(self, x: _AnyOther, /) -> Self: ...
|
||||
def __divmod__(self, x: _AnyOther, /) -> _Tuple2[Self]: ...
|
||||
def __pow__(self, x: _AnyOther, /) -> Self: ...
|
||||
|
||||
# reflected binary ops
|
||||
def __radd__(self, x: _AnyOther, /) -> Self: ...
|
||||
def __rsub__(self, x: _AnyOther, /) -> Self: ...
|
||||
def __rmul__(self, x: _AnyOther, /) -> Self: ...
|
||||
@@ -133,72 +110,74 @@ class ABCPolyBase(Generic[_NameCo], abc.ABC):
|
||||
def __rfloordiv__(self, x: _AnyOther, /) -> Self: ...
|
||||
def __rmod__(self, x: _AnyOther, /) -> Self: ...
|
||||
def __rdivmod__(self, x: _AnyOther, /) -> _Tuple2[Self]: ...
|
||||
|
||||
# iterable and sized
|
||||
def __len__(self, /) -> int: ...
|
||||
def __iter__(self, /) -> Iterator[np.inexact | object]: ...
|
||||
def __iter__(self, /) -> Iterator[np.float64 | Any]: ...
|
||||
|
||||
# pickling
|
||||
def __getstate__(self, /) -> dict[str, Any]: ...
|
||||
def __setstate__(self, dict: dict[str, Any], /) -> None: ...
|
||||
|
||||
#
|
||||
def has_samecoef(self, /, other: ABCPolyBase) -> bool: ...
|
||||
def has_samedomain(self, /, other: ABCPolyBase) -> bool: ...
|
||||
def has_samewindow(self, /, other: ABCPolyBase) -> bool: ...
|
||||
@overload
|
||||
def has_sametype(self, /, other: ABCPolyBase) -> TypeIs[Self]: ...
|
||||
@overload
|
||||
def has_sametype(self, /, other: object) -> Literal[False]: ...
|
||||
def has_sametype(self, /, other: object) -> TypeIs[Self]: ...
|
||||
|
||||
#
|
||||
def copy(self, /) -> Self: ...
|
||||
def degree(self, /) -> int: ...
|
||||
def cutdeg(self, /) -> Self: ...
|
||||
def trim(self, /, tol: _FloatLike_co = ...) -> Self: ...
|
||||
def cutdeg(self, /, deg: int) -> Self: ...
|
||||
def trim(self, /, tol: _FloatLike_co = 0) -> Self: ...
|
||||
def truncate(self, /, size: _AnyInt) -> Self: ...
|
||||
|
||||
#
|
||||
@overload
|
||||
def convert(
|
||||
self,
|
||||
/,
|
||||
domain: _SeriesLikeCoef_co | None,
|
||||
kind: type[_Other],
|
||||
window: _SeriesLikeCoef_co | None = ...,
|
||||
) -> _Other: ...
|
||||
kind: type[_PolyT],
|
||||
window: _SeriesLikeCoef_co | None = None,
|
||||
) -> _PolyT: ...
|
||||
@overload
|
||||
def convert(
|
||||
self,
|
||||
/,
|
||||
domain: _SeriesLikeCoef_co | None = ...,
|
||||
domain: _SeriesLikeCoef_co | None = None,
|
||||
*,
|
||||
kind: type[_Other],
|
||||
window: _SeriesLikeCoef_co | None = ...,
|
||||
) -> _Other: ...
|
||||
kind: type[_PolyT],
|
||||
window: _SeriesLikeCoef_co | None = None,
|
||||
) -> _PolyT: ...
|
||||
@overload
|
||||
def convert(
|
||||
self,
|
||||
/,
|
||||
domain: _SeriesLikeCoef_co | None = ...,
|
||||
domain: _SeriesLikeCoef_co | None = None,
|
||||
kind: None = None,
|
||||
window: _SeriesLikeCoef_co | None = ...,
|
||||
window: _SeriesLikeCoef_co | None = None,
|
||||
) -> Self: ...
|
||||
|
||||
#
|
||||
def mapparms(self, /) -> _Tuple2[Any]: ...
|
||||
|
||||
def integ(
|
||||
self,
|
||||
/,
|
||||
m: SupportsIndex = ...,
|
||||
k: _CoefLike_co | _SeriesLikeCoef_co = ...,
|
||||
lbnd: _CoefLike_co | None = ...,
|
||||
m: SupportsIndex = 1,
|
||||
k: _CoefLike_co | _SeriesLikeCoef_co = [],
|
||||
lbnd: _CoefLike_co | None = None,
|
||||
) -> Self: ...
|
||||
|
||||
def deriv(self, /, m: SupportsIndex = ...) -> Self: ...
|
||||
|
||||
def deriv(self, /, m: SupportsIndex = 1) -> Self: ...
|
||||
def roots(self, /) -> _CoefSeries: ...
|
||||
|
||||
def linspace(
|
||||
self,
|
||||
/,
|
||||
n: SupportsIndex = ...,
|
||||
domain: _SeriesLikeCoef_co | None = ...,
|
||||
n: SupportsIndex = 100,
|
||||
domain: _SeriesLikeCoef_co | None = None,
|
||||
) -> _Tuple2[_Series[np.float64 | np.complex128]]: ...
|
||||
|
||||
#
|
||||
@overload
|
||||
@classmethod
|
||||
def fit(
|
||||
@@ -206,12 +185,12 @@ class ABCPolyBase(Generic[_NameCo], abc.ABC):
|
||||
x: _SeriesLikeCoef_co,
|
||||
y: _SeriesLikeCoef_co,
|
||||
deg: int | _SeriesLikeInt_co,
|
||||
domain: _SeriesLikeCoef_co | None = ...,
|
||||
rcond: _FloatLike_co = ...,
|
||||
full: Literal[False] = ...,
|
||||
w: _SeriesLikeCoef_co | None = ...,
|
||||
window: _SeriesLikeCoef_co | None = ...,
|
||||
symbol: str = ...,
|
||||
domain: _SeriesLikeCoef_co | None = None,
|
||||
rcond: _FloatLike_co | None = None,
|
||||
full: Literal[False] = False,
|
||||
w: _SeriesLikeCoef_co | None = None,
|
||||
window: _SeriesLikeCoef_co | None = None,
|
||||
symbol: str = "x",
|
||||
) -> Self: ...
|
||||
@overload
|
||||
@classmethod
|
||||
@@ -220,13 +199,13 @@ class ABCPolyBase(Generic[_NameCo], abc.ABC):
|
||||
x: _SeriesLikeCoef_co,
|
||||
y: _SeriesLikeCoef_co,
|
||||
deg: int | _SeriesLikeInt_co,
|
||||
domain: _SeriesLikeCoef_co | None = ...,
|
||||
rcond: _FloatLike_co = ...,
|
||||
domain: _SeriesLikeCoef_co | None = None,
|
||||
rcond: _FloatLike_co | None = None,
|
||||
*,
|
||||
full: Literal[True],
|
||||
w: _SeriesLikeCoef_co | None = ...,
|
||||
window: _SeriesLikeCoef_co | None = ...,
|
||||
symbol: str = ...,
|
||||
w: _SeriesLikeCoef_co | None = None,
|
||||
window: _SeriesLikeCoef_co | None = None,
|
||||
symbol: str = "x",
|
||||
) -> tuple[Self, Sequence[np.inexact | np.int32]]: ...
|
||||
@overload
|
||||
@classmethod
|
||||
@@ -237,49 +216,47 @@ class ABCPolyBase(Generic[_NameCo], abc.ABC):
|
||||
deg: int | _SeriesLikeInt_co,
|
||||
domain: _SeriesLikeCoef_co | None,
|
||||
rcond: _FloatLike_co,
|
||||
full: Literal[True], /,
|
||||
w: _SeriesLikeCoef_co | None = ...,
|
||||
window: _SeriesLikeCoef_co | None = ...,
|
||||
symbol: str = ...,
|
||||
full: Literal[True],
|
||||
/,
|
||||
w: _SeriesLikeCoef_co | None = None,
|
||||
window: _SeriesLikeCoef_co | None = None,
|
||||
symbol: str = "x",
|
||||
) -> tuple[Self, Sequence[np.inexact | np.int32]]: ...
|
||||
|
||||
#
|
||||
@classmethod
|
||||
def fromroots(
|
||||
cls,
|
||||
roots: _ArrayLikeCoef_co,
|
||||
domain: _SeriesLikeCoef_co | None = ...,
|
||||
window: _SeriesLikeCoef_co | None = ...,
|
||||
symbol: str = ...,
|
||||
domain: _SeriesLikeCoef_co | None = [],
|
||||
window: _SeriesLikeCoef_co | None = None,
|
||||
symbol: str = "x",
|
||||
) -> Self: ...
|
||||
|
||||
@classmethod
|
||||
def identity(
|
||||
cls,
|
||||
domain: _SeriesLikeCoef_co | None = ...,
|
||||
window: _SeriesLikeCoef_co | None = ...,
|
||||
symbol: str = ...,
|
||||
domain: _SeriesLikeCoef_co | None = None,
|
||||
window: _SeriesLikeCoef_co | None = None,
|
||||
symbol: str = "x",
|
||||
) -> Self: ...
|
||||
|
||||
@classmethod
|
||||
def basis(
|
||||
cls,
|
||||
deg: _AnyInt,
|
||||
domain: _SeriesLikeCoef_co | None = ...,
|
||||
window: _SeriesLikeCoef_co | None = ...,
|
||||
symbol: str = ...,
|
||||
domain: _SeriesLikeCoef_co | None = None,
|
||||
window: _SeriesLikeCoef_co | None = None,
|
||||
symbol: str = "x",
|
||||
) -> Self: ...
|
||||
|
||||
@classmethod
|
||||
def cast(
|
||||
cls,
|
||||
series: ABCPolyBase,
|
||||
domain: _SeriesLikeCoef_co | None = ...,
|
||||
window: _SeriesLikeCoef_co | None = ...,
|
||||
domain: _SeriesLikeCoef_co | None = None,
|
||||
window: _SeriesLikeCoef_co | None = None,
|
||||
) -> Self: ...
|
||||
|
||||
@classmethod
|
||||
def _str_term_unicode(cls, /, i: str, arg_str: str) -> str: ...
|
||||
@staticmethod
|
||||
def _str_term_ascii(i: str, arg_str: str) -> str: ...
|
||||
@staticmethod
|
||||
def _repr_latex_term(i: str, arg_str: str, needs_parens: bool) -> str: ...
|
||||
@classmethod
|
||||
def _str_term_ascii(cls, /, i: str, arg_str: str) -> str: ...
|
||||
@classmethod
|
||||
def _repr_latex_term(cls, /, i: str, arg_str: str, needs_parens: bool) -> str: ...
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
# ruff: noqa: PYI046, PYI047
|
||||
# ruff: noqa: PYI046
|
||||
|
||||
from collections.abc import Callable, Sequence
|
||||
from collections.abc import Sequence
|
||||
from typing import (
|
||||
Any,
|
||||
Literal,
|
||||
LiteralString,
|
||||
NoReturn,
|
||||
Protocol,
|
||||
Self,
|
||||
@@ -23,7 +22,6 @@ from numpy._typing import (
|
||||
# array-likes
|
||||
_ArrayLikeFloat_co,
|
||||
_ArrayLikeNumber_co,
|
||||
_ArrayLikeObject_co,
|
||||
_ComplexLike_co,
|
||||
_FloatLike_co,
|
||||
# scalar-likes
|
||||
@@ -42,15 +40,12 @@ _ScalarT = TypeVar("_ScalarT", bound=np.number | np.bool | np.object_)
|
||||
class _SupportsCoefOps(Protocol[_T_contra]):
|
||||
def __eq__(self, x: object, /) -> bool: ...
|
||||
def __ne__(self, x: object, /) -> bool: ...
|
||||
|
||||
def __neg__(self, /) -> Self: ...
|
||||
def __pos__(self, /) -> Self: ...
|
||||
|
||||
def __add__(self, x: _T_contra, /) -> Self: ...
|
||||
def __sub__(self, x: _T_contra, /) -> Self: ...
|
||||
def __mul__(self, x: _T_contra, /) -> Self: ...
|
||||
def __pow__(self, x: _T_contra, /) -> Self | float: ...
|
||||
|
||||
def __radd__(self, x: _T_contra, /) -> Self: ...
|
||||
def __rsub__(self, x: _T_contra, /) -> Self: ...
|
||||
def __rmul__(self, x: _T_contra, /) -> Self: ...
|
||||
@@ -77,58 +72,20 @@ _CoefObjectLike_co: TypeAlias = np.object_ | _SupportsCoefOps[Any]
|
||||
_CoefLike_co: TypeAlias = _NumberLike_co | _CoefObjectLike_co
|
||||
|
||||
# The term "series" is used here to refer to 1-d arrays of numeric scalars.
|
||||
_SeriesLikeBool_co: TypeAlias = (
|
||||
_SupportsArray[np.dtype[np.bool]]
|
||||
| Sequence[bool | np.bool]
|
||||
)
|
||||
_SeriesLikeInt_co: TypeAlias = (
|
||||
_SupportsArray[np.dtype[np.integer | np.bool]]
|
||||
| Sequence[_IntLike_co]
|
||||
)
|
||||
_SeriesLikeFloat_co: TypeAlias = (
|
||||
_SupportsArray[np.dtype[np.floating | np.integer | np.bool]]
|
||||
| Sequence[_FloatLike_co]
|
||||
)
|
||||
_SeriesLikeComplex_co: TypeAlias = (
|
||||
_SupportsArray[np.dtype[np.inexact | np.integer | np.bool]]
|
||||
| Sequence[_ComplexLike_co]
|
||||
)
|
||||
_SeriesLikeObject_co: TypeAlias = (
|
||||
_SupportsArray[np.dtype[np.object_]]
|
||||
| Sequence[_CoefObjectLike_co]
|
||||
)
|
||||
_SeriesLikeCoef_co: TypeAlias = (
|
||||
_SupportsArray[np.dtype[np.number | np.bool | np.object_]]
|
||||
| Sequence[_CoefLike_co]
|
||||
)
|
||||
_SeriesLikeBool_co: TypeAlias = _SupportsArray[np.dtype[np.bool]] | Sequence[bool | np.bool]
|
||||
_SeriesLikeInt_co: TypeAlias = _SupportsArray[np.dtype[np.integer | np.bool]] | Sequence[_IntLike_co]
|
||||
_SeriesLikeFloat_co: TypeAlias = _SupportsArray[np.dtype[np.floating | np.integer | np.bool]] | Sequence[_FloatLike_co]
|
||||
_SeriesLikeComplex_co: TypeAlias = _SupportsArray[np.dtype[np.number | np.bool]] | Sequence[_ComplexLike_co]
|
||||
_SeriesLikeObject_co: TypeAlias = _SupportsArray[np.dtype[np.object_]] | Sequence[_CoefObjectLike_co]
|
||||
_SeriesLikeCoef_co: TypeAlias = _SupportsArray[np.dtype[np.number | np.bool | np.object_]] | Sequence[_CoefLike_co]
|
||||
|
||||
_ArrayLikeCoefObject_co: TypeAlias = (
|
||||
_CoefObjectLike_co
|
||||
| _SeriesLikeObject_co
|
||||
| _NestedSequence[_SeriesLikeObject_co]
|
||||
)
|
||||
_ArrayLikeCoef_co: TypeAlias = (
|
||||
npt.NDArray[np.number | np.bool | np.object_]
|
||||
| _ArrayLikeNumber_co
|
||||
| _ArrayLikeCoefObject_co
|
||||
)
|
||||
_ArrayLikeCoefObject_co: TypeAlias = _CoefObjectLike_co | _SeriesLikeObject_co | _NestedSequence[_SeriesLikeObject_co]
|
||||
_ArrayLikeCoef_co: TypeAlias = npt.NDArray[np.number | np.bool | np.object_] | _ArrayLikeNumber_co | _ArrayLikeCoefObject_co
|
||||
|
||||
_Name_co = TypeVar(
|
||||
"_Name_co",
|
||||
bound=LiteralString,
|
||||
covariant=True,
|
||||
default=LiteralString
|
||||
)
|
||||
_Line: TypeAlias = np.ndarray[tuple[int], np.dtype[_ScalarT]]
|
||||
|
||||
@type_check_only
|
||||
class _Named(Protocol[_Name_co]):
|
||||
@property
|
||||
def __name__(self, /) -> _Name_co: ...
|
||||
|
||||
_Line: TypeAlias = np.ndarray[tuple[Literal[1, 2]], np.dtype[_ScalarT]]
|
||||
|
||||
@type_check_only
|
||||
class _FuncLine(_Named[_Name_co], Protocol[_Name_co]):
|
||||
class _FuncLine(Protocol):
|
||||
@overload
|
||||
def __call__(self, /, off: _ScalarT, scl: _ScalarT) -> _Line[_ScalarT]: ...
|
||||
@overload
|
||||
@@ -136,22 +93,12 @@ class _FuncLine(_Named[_Name_co], Protocol[_Name_co]):
|
||||
@overload
|
||||
def __call__(self, /, off: float, scl: float) -> _Line[np.float64]: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
off: complex,
|
||||
scl: complex,
|
||||
) -> _Line[np.complex128]: ...
|
||||
def __call__(self, /, off: complex, scl: complex) -> _Line[np.complex128]: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
off: _SupportsCoefOps[Any],
|
||||
scl: _SupportsCoefOps[Any],
|
||||
) -> _Line[np.object_]: ...
|
||||
def __call__(self, /, off: _SupportsCoefOps[Any], scl: _SupportsCoefOps[Any]) -> _Line[np.object_]: ...
|
||||
|
||||
@type_check_only
|
||||
class _FuncFromRoots(_Named[_Name_co], Protocol[_Name_co]):
|
||||
class _FuncFromRoots(Protocol):
|
||||
@overload
|
||||
def __call__(self, /, roots: _SeriesLikeFloat_co) -> _FloatSeries: ...
|
||||
@overload
|
||||
@@ -160,38 +107,18 @@ class _FuncFromRoots(_Named[_Name_co], Protocol[_Name_co]):
|
||||
def __call__(self, /, roots: _SeriesLikeCoef_co) -> _ObjectSeries: ...
|
||||
|
||||
@type_check_only
|
||||
class _FuncBinOp(_Named[_Name_co], Protocol[_Name_co]):
|
||||
class _FuncBinOp(Protocol):
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c1: _SeriesLikeBool_co,
|
||||
c2: _SeriesLikeBool_co,
|
||||
) -> NoReturn: ...
|
||||
def __call__(self, /, c1: _SeriesLikeBool_co, c2: _SeriesLikeBool_co) -> NoReturn: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c1: _SeriesLikeFloat_co,
|
||||
c2: _SeriesLikeFloat_co,
|
||||
) -> _FloatSeries: ...
|
||||
def __call__(self, /, c1: _SeriesLikeFloat_co, c2: _SeriesLikeFloat_co) -> _FloatSeries: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c1: _SeriesLikeComplex_co,
|
||||
c2: _SeriesLikeComplex_co,
|
||||
) -> _ComplexSeries: ...
|
||||
def __call__(self, /, c1: _SeriesLikeComplex_co, c2: _SeriesLikeComplex_co) -> _ComplexSeries: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c1: _SeriesLikeCoef_co,
|
||||
c2: _SeriesLikeCoef_co,
|
||||
) -> _ObjectSeries: ...
|
||||
def __call__(self, /, c1: _SeriesLikeCoef_co, c2: _SeriesLikeCoef_co) -> _ObjectSeries: ...
|
||||
|
||||
@type_check_only
|
||||
class _FuncUnOp(_Named[_Name_co], Protocol[_Name_co]):
|
||||
class _FuncUnOp(Protocol):
|
||||
@overload
|
||||
def __call__(self, /, c: _SeriesLikeFloat_co) -> _FloatSeries: ...
|
||||
@overload
|
||||
@@ -200,7 +127,7 @@ class _FuncUnOp(_Named[_Name_co], Protocol[_Name_co]):
|
||||
def __call__(self, /, c: _SeriesLikeCoef_co) -> _ObjectSeries: ...
|
||||
|
||||
@type_check_only
|
||||
class _FuncPoly2Ortho(_Named[_Name_co], Protocol[_Name_co]):
|
||||
class _FuncPoly2Ortho(Protocol):
|
||||
@overload
|
||||
def __call__(self, /, pol: _SeriesLikeFloat_co) -> _FloatSeries: ...
|
||||
@overload
|
||||
@@ -209,253 +136,112 @@ class _FuncPoly2Ortho(_Named[_Name_co], Protocol[_Name_co]):
|
||||
def __call__(self, /, pol: _SeriesLikeCoef_co) -> _ObjectSeries: ...
|
||||
|
||||
@type_check_only
|
||||
class _FuncPow(_Named[_Name_co], Protocol[_Name_co]):
|
||||
class _FuncPow(Protocol):
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c: _SeriesLikeFloat_co,
|
||||
pow: _IntLike_co,
|
||||
maxpower: _IntLike_co | None = ...,
|
||||
) -> _FloatSeries: ...
|
||||
def __call__(self, /, c: _SeriesLikeFloat_co, pow: _IntLike_co, maxpower: _IntLike_co | None = ...) -> _FloatSeries: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c: _SeriesLikeComplex_co,
|
||||
pow: _IntLike_co,
|
||||
maxpower: _IntLike_co | None = ...,
|
||||
) -> _ComplexSeries: ...
|
||||
def __call__(self, /, c: _SeriesLikeComplex_co, pow: _IntLike_co, maxpower: _IntLike_co | None = ...) -> _ComplexSeries: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c: _SeriesLikeCoef_co,
|
||||
pow: _IntLike_co,
|
||||
maxpower: _IntLike_co | None = ...,
|
||||
) -> _ObjectSeries: ...
|
||||
def __call__(self, /, c: _SeriesLikeCoef_co, pow: _IntLike_co, maxpower: _IntLike_co | None = ...) -> _ObjectSeries: ...
|
||||
|
||||
@type_check_only
|
||||
class _FuncDer(_Named[_Name_co], Protocol[_Name_co]):
|
||||
class _FuncDer(Protocol):
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c: _ArrayLikeFloat_co,
|
||||
m: SupportsIndex = ...,
|
||||
scl: _FloatLike_co = ...,
|
||||
axis: SupportsIndex = ...,
|
||||
m: SupportsIndex = 1,
|
||||
scl: _FloatLike_co = 1,
|
||||
axis: SupportsIndex = 0,
|
||||
) -> _FloatArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c: _ArrayLikeComplex_co,
|
||||
m: SupportsIndex = ...,
|
||||
scl: _ComplexLike_co = ...,
|
||||
axis: SupportsIndex = ...,
|
||||
m: SupportsIndex = 1,
|
||||
scl: _ComplexLike_co = 1,
|
||||
axis: SupportsIndex = 0,
|
||||
) -> _ComplexArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c: _ArrayLikeCoef_co,
|
||||
m: SupportsIndex = ...,
|
||||
scl: _CoefLike_co = ...,
|
||||
axis: SupportsIndex = ...,
|
||||
m: SupportsIndex = 1,
|
||||
scl: _CoefLike_co = 1,
|
||||
axis: SupportsIndex = 0,
|
||||
) -> _ObjectArray: ...
|
||||
|
||||
@type_check_only
|
||||
class _FuncInteg(_Named[_Name_co], Protocol[_Name_co]):
|
||||
class _FuncInteg(Protocol):
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c: _ArrayLikeFloat_co,
|
||||
m: SupportsIndex = ...,
|
||||
k: _FloatLike_co | _SeriesLikeFloat_co = ...,
|
||||
lbnd: _FloatLike_co = ...,
|
||||
scl: _FloatLike_co = ...,
|
||||
axis: SupportsIndex = ...,
|
||||
m: SupportsIndex = 1,
|
||||
k: _FloatLike_co | _SeriesLikeFloat_co = [],
|
||||
lbnd: _FloatLike_co = 0,
|
||||
scl: _FloatLike_co = 1,
|
||||
axis: SupportsIndex = 0,
|
||||
) -> _FloatArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c: _ArrayLikeComplex_co,
|
||||
m: SupportsIndex = ...,
|
||||
k: _ComplexLike_co | _SeriesLikeComplex_co = ...,
|
||||
lbnd: _ComplexLike_co = ...,
|
||||
scl: _ComplexLike_co = ...,
|
||||
axis: SupportsIndex = ...,
|
||||
m: SupportsIndex = 1,
|
||||
k: _ComplexLike_co | _SeriesLikeComplex_co = [],
|
||||
lbnd: _ComplexLike_co = 0,
|
||||
scl: _ComplexLike_co = 1,
|
||||
axis: SupportsIndex = 0,
|
||||
) -> _ComplexArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c: _ArrayLikeCoef_co,
|
||||
m: SupportsIndex = ...,
|
||||
k: _CoefLike_co | _SeriesLikeCoef_co = ...,
|
||||
lbnd: _CoefLike_co = ...,
|
||||
scl: _CoefLike_co = ...,
|
||||
axis: SupportsIndex = ...,
|
||||
m: SupportsIndex = 1,
|
||||
k: _CoefLike_co | _SeriesLikeCoef_co = [],
|
||||
lbnd: _CoefLike_co = 0,
|
||||
scl: _CoefLike_co = 1,
|
||||
axis: SupportsIndex = 0,
|
||||
) -> _ObjectArray: ...
|
||||
|
||||
@type_check_only
|
||||
class _FuncValFromRoots(_Named[_Name_co], Protocol[_Name_co]):
|
||||
class _FuncVal(Protocol):
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _FloatLike_co,
|
||||
r: _FloatLike_co,
|
||||
tensor: bool = ...,
|
||||
) -> np.floating: ...
|
||||
def __call__(self, /, x: _FloatLike_co, c: _SeriesLikeFloat_co, tensor: bool = True) -> np.floating: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _NumberLike_co,
|
||||
r: _NumberLike_co,
|
||||
tensor: bool = ...,
|
||||
) -> np.complexfloating: ...
|
||||
def __call__(self, /, x: _NumberLike_co, c: _SeriesLikeComplex_co, tensor: bool = True) -> np.complexfloating: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _FloatLike_co | _ArrayLikeFloat_co,
|
||||
r: _ArrayLikeFloat_co,
|
||||
tensor: bool = ...,
|
||||
) -> _FloatArray: ...
|
||||
def __call__(self, /, x: _ArrayLikeFloat_co, c: _ArrayLikeFloat_co, tensor: bool = True) -> _FloatArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _NumberLike_co | _ArrayLikeComplex_co,
|
||||
r: _ArrayLikeComplex_co,
|
||||
tensor: bool = ...,
|
||||
) -> _ComplexArray: ...
|
||||
def __call__(self, /, x: _ArrayLikeComplex_co, c: _ArrayLikeComplex_co, tensor: bool = True) -> _ComplexArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _CoefLike_co | _ArrayLikeCoef_co,
|
||||
r: _ArrayLikeCoef_co,
|
||||
tensor: bool = ...,
|
||||
) -> _ObjectArray: ...
|
||||
def __call__(self, /, x: _ArrayLikeCoef_co, c: _ArrayLikeCoef_co, tensor: bool = True) -> _ObjectArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _CoefLike_co,
|
||||
r: _CoefLike_co,
|
||||
tensor: bool = ...,
|
||||
) -> _SupportsCoefOps[Any]: ...
|
||||
def __call__(self, /, x: _CoefLike_co, c: _SeriesLikeObject_co, tensor: bool = True) -> _SupportsCoefOps[Any]: ...
|
||||
|
||||
@type_check_only
|
||||
class _FuncVal(_Named[_Name_co], Protocol[_Name_co]):
|
||||
class _FuncVal2D(Protocol):
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _FloatLike_co,
|
||||
c: _SeriesLikeFloat_co,
|
||||
tensor: bool = ...,
|
||||
) -> np.floating: ...
|
||||
def __call__(self, /, x: _FloatLike_co, y: _FloatLike_co, c: _SeriesLikeFloat_co) -> np.floating: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _NumberLike_co,
|
||||
c: _SeriesLikeComplex_co,
|
||||
tensor: bool = ...,
|
||||
) -> np.complexfloating: ...
|
||||
def __call__(self, /, x: _NumberLike_co, y: _NumberLike_co, c: _SeriesLikeComplex_co) -> np.complexfloating: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _ArrayLikeFloat_co,
|
||||
c: _ArrayLikeFloat_co,
|
||||
tensor: bool = ...,
|
||||
) -> _FloatArray: ...
|
||||
def __call__(self, /, x: _ArrayLikeFloat_co, y: _ArrayLikeFloat_co, c: _ArrayLikeFloat_co) -> _FloatArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _ArrayLikeComplex_co,
|
||||
c: _ArrayLikeComplex_co,
|
||||
tensor: bool = ...,
|
||||
) -> _ComplexArray: ...
|
||||
def __call__(self, /, x: _ArrayLikeComplex_co, y: _ArrayLikeComplex_co, c: _ArrayLikeComplex_co) -> _ComplexArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _ArrayLikeCoef_co,
|
||||
c: _ArrayLikeCoef_co,
|
||||
tensor: bool = ...,
|
||||
) -> _ObjectArray: ...
|
||||
def __call__(self, /, x: _ArrayLikeCoef_co, y: _ArrayLikeCoef_co, c: _ArrayLikeCoef_co) -> _ObjectArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _CoefLike_co,
|
||||
c: _SeriesLikeObject_co,
|
||||
tensor: bool = ...,
|
||||
) -> _SupportsCoefOps[Any]: ...
|
||||
def __call__(self, /, x: _CoefLike_co, y: _CoefLike_co, c: _SeriesLikeCoef_co) -> _SupportsCoefOps[Any]: ...
|
||||
|
||||
@type_check_only
|
||||
class _FuncVal2D(_Named[_Name_co], Protocol[_Name_co]):
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _FloatLike_co,
|
||||
y: _FloatLike_co,
|
||||
c: _SeriesLikeFloat_co,
|
||||
) -> np.floating: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _NumberLike_co,
|
||||
y: _NumberLike_co,
|
||||
c: _SeriesLikeComplex_co,
|
||||
) -> np.complexfloating: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _ArrayLikeFloat_co,
|
||||
y: _ArrayLikeFloat_co,
|
||||
c: _ArrayLikeFloat_co,
|
||||
) -> _FloatArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _ArrayLikeComplex_co,
|
||||
y: _ArrayLikeComplex_co,
|
||||
c: _ArrayLikeComplex_co,
|
||||
) -> _ComplexArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _ArrayLikeCoef_co,
|
||||
y: _ArrayLikeCoef_co,
|
||||
c: _ArrayLikeCoef_co,
|
||||
) -> _ObjectArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _CoefLike_co,
|
||||
y: _CoefLike_co,
|
||||
c: _SeriesLikeCoef_co,
|
||||
) -> _SupportsCoefOps[Any]: ...
|
||||
|
||||
@type_check_only
|
||||
class _FuncVal3D(_Named[_Name_co], Protocol[_Name_co]):
|
||||
class _FuncVal3D(Protocol):
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
@@ -463,7 +249,7 @@ class _FuncVal3D(_Named[_Name_co], Protocol[_Name_co]):
|
||||
x: _FloatLike_co,
|
||||
y: _FloatLike_co,
|
||||
z: _FloatLike_co,
|
||||
c: _SeriesLikeFloat_co
|
||||
c: _SeriesLikeFloat_co,
|
||||
) -> np.floating: ...
|
||||
@overload
|
||||
def __call__(
|
||||
@@ -511,132 +297,32 @@ class _FuncVal3D(_Named[_Name_co], Protocol[_Name_co]):
|
||||
c: _SeriesLikeCoef_co,
|
||||
) -> _SupportsCoefOps[Any]: ...
|
||||
|
||||
_AnyValF: TypeAlias = Callable[
|
||||
[npt.ArrayLike, npt.ArrayLike, bool],
|
||||
_CoefArray,
|
||||
]
|
||||
|
||||
@type_check_only
|
||||
class _FuncValND(_Named[_Name_co], Protocol[_Name_co]):
|
||||
class _FuncVander(Protocol):
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
val_f: _AnyValF,
|
||||
c: _SeriesLikeFloat_co,
|
||||
/,
|
||||
*args: _FloatLike_co,
|
||||
) -> np.floating: ...
|
||||
def __call__(self, /, x: _ArrayLikeFloat_co, deg: SupportsIndex) -> _FloatArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
val_f: _AnyValF,
|
||||
c: _SeriesLikeComplex_co,
|
||||
/,
|
||||
*args: _NumberLike_co,
|
||||
) -> np.complexfloating: ...
|
||||
def __call__(self, /, x: _ArrayLikeComplex_co, deg: SupportsIndex) -> _ComplexArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
val_f: _AnyValF,
|
||||
c: _ArrayLikeFloat_co,
|
||||
/,
|
||||
*args: _ArrayLikeFloat_co,
|
||||
) -> _FloatArray: ...
|
||||
def __call__(self, /, x: _ArrayLikeCoef_co, deg: SupportsIndex) -> _ObjectArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
val_f: _AnyValF,
|
||||
c: _ArrayLikeComplex_co,
|
||||
/,
|
||||
*args: _ArrayLikeComplex_co,
|
||||
) -> _ComplexArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
val_f: _AnyValF,
|
||||
c: _SeriesLikeObject_co,
|
||||
/,
|
||||
*args: _CoefObjectLike_co,
|
||||
) -> _SupportsCoefOps[Any]: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
val_f: _AnyValF,
|
||||
c: _ArrayLikeCoef_co,
|
||||
/,
|
||||
*args: _ArrayLikeCoef_co,
|
||||
) -> _ObjectArray: ...
|
||||
|
||||
@type_check_only
|
||||
class _FuncVander(_Named[_Name_co], Protocol[_Name_co]):
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _ArrayLikeFloat_co,
|
||||
deg: SupportsIndex,
|
||||
) -> _FloatArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _ArrayLikeComplex_co,
|
||||
deg: SupportsIndex,
|
||||
) -> _ComplexArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _ArrayLikeCoef_co,
|
||||
deg: SupportsIndex,
|
||||
) -> _ObjectArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: npt.ArrayLike,
|
||||
deg: SupportsIndex,
|
||||
) -> _CoefArray: ...
|
||||
def __call__(self, /, x: npt.ArrayLike, deg: SupportsIndex) -> _CoefArray: ...
|
||||
|
||||
_AnyDegrees: TypeAlias = Sequence[SupportsIndex]
|
||||
|
||||
@type_check_only
|
||||
class _FuncVander2D(_Named[_Name_co], Protocol[_Name_co]):
|
||||
class _FuncVander2D(Protocol):
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _ArrayLikeFloat_co,
|
||||
y: _ArrayLikeFloat_co,
|
||||
deg: _AnyDegrees,
|
||||
) -> _FloatArray: ...
|
||||
def __call__(self, /, x: _ArrayLikeFloat_co, y: _ArrayLikeFloat_co, deg: _AnyDegrees) -> _FloatArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _ArrayLikeComplex_co,
|
||||
y: _ArrayLikeComplex_co,
|
||||
deg: _AnyDegrees,
|
||||
) -> _ComplexArray: ...
|
||||
def __call__(self, /, x: _ArrayLikeComplex_co, y: _ArrayLikeComplex_co, deg: _AnyDegrees) -> _ComplexArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: _ArrayLikeCoef_co,
|
||||
y: _ArrayLikeCoef_co,
|
||||
deg: _AnyDegrees,
|
||||
) -> _ObjectArray: ...
|
||||
def __call__(self, /, x: _ArrayLikeCoef_co, y: _ArrayLikeCoef_co, deg: _AnyDegrees) -> _ObjectArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
x: npt.ArrayLike,
|
||||
y: npt.ArrayLike,
|
||||
deg: _AnyDegrees,
|
||||
) -> _CoefArray: ...
|
||||
def __call__(self, /, x: npt.ArrayLike, y: npt.ArrayLike, deg: _AnyDegrees) -> _CoefArray: ...
|
||||
|
||||
@type_check_only
|
||||
class _FuncVander3D(_Named[_Name_co], Protocol[_Name_co]):
|
||||
class _FuncVander3D(Protocol):
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
@@ -674,53 +360,10 @@ class _FuncVander3D(_Named[_Name_co], Protocol[_Name_co]):
|
||||
deg: _AnyDegrees,
|
||||
) -> _CoefArray: ...
|
||||
|
||||
# keep in sync with the broadest overload of `._FuncVander`
|
||||
_AnyFuncVander: TypeAlias = Callable[
|
||||
[npt.ArrayLike, SupportsIndex],
|
||||
_CoefArray,
|
||||
]
|
||||
|
||||
@type_check_only
|
||||
class _FuncVanderND(_Named[_Name_co], Protocol[_Name_co]):
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
vander_fs: Sequence[_AnyFuncVander],
|
||||
points: Sequence[_ArrayLikeFloat_co],
|
||||
degrees: Sequence[SupportsIndex],
|
||||
) -> _FloatArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
vander_fs: Sequence[_AnyFuncVander],
|
||||
points: Sequence[_ArrayLikeComplex_co],
|
||||
degrees: Sequence[SupportsIndex],
|
||||
) -> _ComplexArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
vander_fs: Sequence[_AnyFuncVander],
|
||||
points: Sequence[
|
||||
_ArrayLikeObject_co | _ArrayLikeComplex_co,
|
||||
],
|
||||
degrees: Sequence[SupportsIndex],
|
||||
) -> _ObjectArray: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
vander_fs: Sequence[_AnyFuncVander],
|
||||
points: Sequence[npt.ArrayLike],
|
||||
degrees: Sequence[SupportsIndex],
|
||||
) -> _CoefArray: ...
|
||||
|
||||
_FullFitResult: TypeAlias = Sequence[np.inexact | np.int32]
|
||||
|
||||
@type_check_only
|
||||
class _FuncFit(_Named[_Name_co], Protocol[_Name_co]):
|
||||
class _FuncFit(Protocol):
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
@@ -729,7 +372,7 @@ class _FuncFit(_Named[_Name_co], Protocol[_Name_co]):
|
||||
y: _ArrayLikeFloat_co,
|
||||
deg: int | _SeriesLikeInt_co,
|
||||
rcond: float | None = ...,
|
||||
full: Literal[False] = ...,
|
||||
full: Literal[False] = False,
|
||||
w: _SeriesLikeFloat_co | None = ...,
|
||||
) -> _FloatArray: ...
|
||||
@overload
|
||||
@@ -755,7 +398,6 @@ class _FuncFit(_Named[_Name_co], Protocol[_Name_co]):
|
||||
full: Literal[True],
|
||||
w: _SeriesLikeFloat_co | None = ...,
|
||||
) -> tuple[_FloatArray, _FullFitResult]: ...
|
||||
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
@@ -764,7 +406,7 @@ class _FuncFit(_Named[_Name_co], Protocol[_Name_co]):
|
||||
y: _ArrayLikeComplex_co,
|
||||
deg: int | _SeriesLikeInt_co,
|
||||
rcond: float | None = ...,
|
||||
full: Literal[False] = ...,
|
||||
full: Literal[False] = False,
|
||||
w: _SeriesLikeFloat_co | None = ...,
|
||||
) -> _ComplexArray: ...
|
||||
@overload
|
||||
@@ -790,7 +432,6 @@ class _FuncFit(_Named[_Name_co], Protocol[_Name_co]):
|
||||
full: Literal[True],
|
||||
w: _SeriesLikeFloat_co | None = ...,
|
||||
) -> tuple[_ComplexArray, _FullFitResult]: ...
|
||||
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
@@ -799,7 +440,7 @@ class _FuncFit(_Named[_Name_co], Protocol[_Name_co]):
|
||||
y: _ArrayLikeCoef_co,
|
||||
deg: int | _SeriesLikeInt_co,
|
||||
rcond: float | None = ...,
|
||||
full: Literal[False] = ...,
|
||||
full: Literal[False] = False,
|
||||
w: _SeriesLikeFloat_co | None = ...,
|
||||
) -> _ObjectArray: ...
|
||||
@overload
|
||||
@@ -827,66 +468,34 @@ class _FuncFit(_Named[_Name_co], Protocol[_Name_co]):
|
||||
) -> tuple[_ObjectArray, _FullFitResult]: ...
|
||||
|
||||
@type_check_only
|
||||
class _FuncRoots(_Named[_Name_co], Protocol[_Name_co]):
|
||||
class _FuncRoots(Protocol):
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c: _SeriesLikeFloat_co,
|
||||
) -> _Series[np.float64]: ...
|
||||
def __call__(self, /, c: _SeriesLikeFloat_co) -> _Series[np.float64]: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c: _SeriesLikeComplex_co,
|
||||
) -> _Series[np.complex128]: ...
|
||||
def __call__(self, /, c: _SeriesLikeComplex_co) -> _Series[np.complex128]: ...
|
||||
@overload
|
||||
def __call__(self, /, c: _SeriesLikeCoef_co) -> _ObjectSeries: ...
|
||||
|
||||
_Companion: TypeAlias = np.ndarray[tuple[int, int], np.dtype[_ScalarT]]
|
||||
|
||||
@type_check_only
|
||||
class _FuncCompanion(_Named[_Name_co], Protocol[_Name_co]):
|
||||
class _FuncCompanion(Protocol):
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c: _SeriesLikeFloat_co,
|
||||
) -> _Companion[np.float64]: ...
|
||||
def __call__(self, /, c: _SeriesLikeFloat_co) -> _Companion[np.float64]: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c: _SeriesLikeComplex_co,
|
||||
) -> _Companion[np.complex128]: ...
|
||||
def __call__(self, /, c: _SeriesLikeComplex_co) -> _Companion[np.complex128]: ...
|
||||
@overload
|
||||
def __call__(self, /, c: _SeriesLikeCoef_co) -> _Companion[np.object_]: ...
|
||||
|
||||
@type_check_only
|
||||
class _FuncGauss(_Named[_Name_co], Protocol[_Name_co]):
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
deg: SupportsIndex,
|
||||
) -> _Tuple2[_Series[np.float64]]: ...
|
||||
class _FuncGauss(Protocol):
|
||||
def __call__(self, /, deg: SupportsIndex) -> _Tuple2[_Series[np.float64]]: ...
|
||||
|
||||
@type_check_only
|
||||
class _FuncWeight(_Named[_Name_co], Protocol[_Name_co]):
|
||||
class _FuncWeight(Protocol):
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c: _ArrayLikeFloat_co,
|
||||
) -> npt.NDArray[np.float64]: ...
|
||||
def __call__(self, /, x: _ArrayLikeFloat_co) -> npt.NDArray[np.float64]: ...
|
||||
@overload
|
||||
def __call__(
|
||||
self,
|
||||
/,
|
||||
c: _ArrayLikeComplex_co,
|
||||
) -> npt.NDArray[np.complex128]: ...
|
||||
def __call__(self, /, x: _ArrayLikeComplex_co) -> npt.NDArray[np.complex128]: ...
|
||||
@overload
|
||||
def __call__(self, /, c: _ArrayLikeCoef_co) -> _ObjectArray: ...
|
||||
|
||||
@type_check_only
|
||||
class _FuncPts(_Named[_Name_co], Protocol[_Name_co]):
|
||||
def __call__(self, /, npts: _AnyInt) -> _Series[np.float64]: ...
|
||||
def __call__(self, /, x: _ArrayLikeCoef_co) -> _ObjectArray: ...
|
||||
|
||||
@@ -108,8 +108,6 @@ References
|
||||
|
||||
""" # noqa: E501
|
||||
import numpy as np
|
||||
import numpy.linalg as la
|
||||
from numpy.lib.array_utils import normalize_axis_index
|
||||
|
||||
from . import polyutils as pu
|
||||
from ._polybase import ABCPolyBase
|
||||
@@ -936,7 +934,7 @@ def chebder(c, m=1, scl=1, axis=0):
|
||||
iaxis = pu._as_int(axis, "the axis")
|
||||
if cnt < 0:
|
||||
raise ValueError("The order of derivation must be non-negative")
|
||||
iaxis = normalize_axis_index(iaxis, c.ndim)
|
||||
iaxis = np.lib.array_utils.normalize_axis_index(iaxis, c.ndim)
|
||||
|
||||
if cnt == 0:
|
||||
return c
|
||||
@@ -1059,7 +1057,7 @@ def chebint(c, m=1, k=[], lbnd=0, scl=1, axis=0):
|
||||
raise ValueError("lbnd must be a scalar.")
|
||||
if np.ndim(scl) != 0:
|
||||
raise ValueError("scl must be a scalar.")
|
||||
iaxis = normalize_axis_index(iaxis, c.ndim)
|
||||
iaxis = np.lib.array_utils.normalize_axis_index(iaxis, c.ndim)
|
||||
|
||||
if cnt == 0:
|
||||
return c
|
||||
@@ -1721,7 +1719,7 @@ def chebroots(c):
|
||||
|
||||
# rotated companion matrix reduces error
|
||||
m = chebcompanion(c)[::-1, ::-1]
|
||||
r = la.eigvals(m)
|
||||
r = np.linalg.eigvals(m)
|
||||
r.sort()
|
||||
return r
|
||||
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
from _typeshed import ConvertibleToInt
|
||||
from collections.abc import Callable, Iterable
|
||||
from typing import Any, Concatenate, Final, Self, TypeVar, overload
|
||||
from typing import Literal as L
|
||||
from typing import (
|
||||
Any,
|
||||
ClassVar,
|
||||
Concatenate,
|
||||
Final,
|
||||
Literal as L,
|
||||
Self,
|
||||
TypeVar,
|
||||
overload,
|
||||
)
|
||||
|
||||
import numpy as np
|
||||
import numpy.typing as npt
|
||||
@@ -21,13 +30,11 @@ from ._polytypes import (
|
||||
_FuncLine,
|
||||
_FuncPoly2Ortho,
|
||||
_FuncPow,
|
||||
_FuncPts,
|
||||
_FuncRoots,
|
||||
_FuncUnOp,
|
||||
_FuncVal,
|
||||
_FuncVal2D,
|
||||
_FuncVal3D,
|
||||
_FuncValFromRoots,
|
||||
_FuncVander,
|
||||
_FuncVander2D,
|
||||
_FuncVander3D,
|
||||
@@ -75,95 +82,90 @@ __all__ = [
|
||||
]
|
||||
|
||||
_NumberOrObjectT = TypeVar("_NumberOrObjectT", bound=np.number | np.object_)
|
||||
_CoefScalarT = TypeVar("_CoefScalarT", bound=np.number | np.bool | np.object_)
|
||||
|
||||
def _cseries_to_zseries(c: npt.NDArray[_NumberOrObjectT]) -> _Series[_NumberOrObjectT]: ...
|
||||
def _zseries_to_cseries(zs: npt.NDArray[_NumberOrObjectT]) -> _Series[_NumberOrObjectT]: ...
|
||||
def _zseries_mul(
|
||||
z1: npt.NDArray[_NumberOrObjectT],
|
||||
z2: npt.NDArray[_NumberOrObjectT],
|
||||
) -> _Series[_NumberOrObjectT]: ...
|
||||
def _zseries_div(
|
||||
z1: npt.NDArray[_NumberOrObjectT],
|
||||
z2: npt.NDArray[_NumberOrObjectT],
|
||||
) -> _Series[_NumberOrObjectT]: ...
|
||||
def _zseries_mul(z1: npt.NDArray[_NumberOrObjectT], z2: npt.NDArray[_NumberOrObjectT]) -> _Series[_NumberOrObjectT]: ...
|
||||
def _zseries_div(z1: npt.NDArray[_NumberOrObjectT], z2: npt.NDArray[_NumberOrObjectT]) -> _Series[_NumberOrObjectT]: ...
|
||||
def _zseries_der(zs: npt.NDArray[_NumberOrObjectT]) -> _Series[_NumberOrObjectT]: ...
|
||||
def _zseries_int(zs: npt.NDArray[_NumberOrObjectT]) -> _Series[_NumberOrObjectT]: ...
|
||||
|
||||
poly2cheb: _FuncPoly2Ortho[L["poly2cheb"]]
|
||||
cheb2poly: _FuncUnOp[L["cheb2poly"]]
|
||||
poly2cheb: Final[_FuncPoly2Ortho] = ...
|
||||
cheb2poly: Final[_FuncUnOp] = ...
|
||||
|
||||
chebdomain: Final[_Array2[np.float64]]
|
||||
chebzero: Final[_Array1[np.int_]]
|
||||
chebone: Final[_Array1[np.int_]]
|
||||
chebx: Final[_Array2[np.int_]]
|
||||
chebdomain: Final[_Array2[np.float64]] = ...
|
||||
chebzero: Final[_Array1[np.int_]] = ...
|
||||
chebone: Final[_Array1[np.int_]] = ...
|
||||
chebx: Final[_Array2[np.int_]] = ...
|
||||
|
||||
chebline: _FuncLine[L["chebline"]]
|
||||
chebfromroots: _FuncFromRoots[L["chebfromroots"]]
|
||||
chebadd: _FuncBinOp[L["chebadd"]]
|
||||
chebsub: _FuncBinOp[L["chebsub"]]
|
||||
chebmulx: _FuncUnOp[L["chebmulx"]]
|
||||
chebmul: _FuncBinOp[L["chebmul"]]
|
||||
chebdiv: _FuncBinOp[L["chebdiv"]]
|
||||
chebpow: _FuncPow[L["chebpow"]]
|
||||
chebder: _FuncDer[L["chebder"]]
|
||||
chebint: _FuncInteg[L["chebint"]]
|
||||
chebval: _FuncVal[L["chebval"]]
|
||||
chebval2d: _FuncVal2D[L["chebval2d"]]
|
||||
chebval3d: _FuncVal3D[L["chebval3d"]]
|
||||
chebvalfromroots: _FuncValFromRoots[L["chebvalfromroots"]]
|
||||
chebgrid2d: _FuncVal2D[L["chebgrid2d"]]
|
||||
chebgrid3d: _FuncVal3D[L["chebgrid3d"]]
|
||||
chebvander: _FuncVander[L["chebvander"]]
|
||||
chebvander2d: _FuncVander2D[L["chebvander2d"]]
|
||||
chebvander3d: _FuncVander3D[L["chebvander3d"]]
|
||||
chebfit: _FuncFit[L["chebfit"]]
|
||||
chebcompanion: _FuncCompanion[L["chebcompanion"]]
|
||||
chebroots: _FuncRoots[L["chebroots"]]
|
||||
chebgauss: _FuncGauss[L["chebgauss"]]
|
||||
chebweight: _FuncWeight[L["chebweight"]]
|
||||
chebpts1: _FuncPts[L["chebpts1"]]
|
||||
chebpts2: _FuncPts[L["chebpts2"]]
|
||||
chebline: Final[_FuncLine] = ...
|
||||
chebfromroots: Final[_FuncFromRoots] = ...
|
||||
chebadd: Final[_FuncBinOp] = ...
|
||||
chebsub: Final[_FuncBinOp] = ...
|
||||
chebmulx: Final[_FuncUnOp] = ...
|
||||
chebmul: Final[_FuncBinOp] = ...
|
||||
chebdiv: Final[_FuncBinOp] = ...
|
||||
chebpow: Final[_FuncPow] = ...
|
||||
chebder: Final[_FuncDer] = ...
|
||||
chebint: Final[_FuncInteg] = ...
|
||||
chebval: Final[_FuncVal] = ...
|
||||
chebval2d: Final[_FuncVal2D] = ...
|
||||
chebval3d: Final[_FuncVal3D] = ...
|
||||
chebgrid2d: Final[_FuncVal2D] = ...
|
||||
chebgrid3d: Final[_FuncVal3D] = ...
|
||||
chebvander: Final[_FuncVander] = ...
|
||||
chebvander2d: Final[_FuncVander2D] = ...
|
||||
chebvander3d: Final[_FuncVander3D] = ...
|
||||
chebfit: Final[_FuncFit] = ...
|
||||
chebcompanion: Final[_FuncCompanion] = ...
|
||||
chebroots: Final[_FuncRoots] = ...
|
||||
chebgauss: Final[_FuncGauss] = ...
|
||||
chebweight: Final[_FuncWeight] = ...
|
||||
def chebpts1(npts: ConvertibleToInt) -> np.ndarray[tuple[int], np.dtype[np.float64]]: ...
|
||||
def chebpts2(npts: ConvertibleToInt) -> np.ndarray[tuple[int], np.dtype[np.float64]]: ...
|
||||
|
||||
# keep in sync with `Chebyshev.interpolate`
|
||||
_RT = TypeVar("_RT", bound=np.number | np.bool | np.object_)
|
||||
# keep in sync with `Chebyshev.interpolate` (minus `domain` parameter)
|
||||
@overload
|
||||
def chebinterpolate(
|
||||
func: np.ufunc,
|
||||
deg: _IntLike_co,
|
||||
args: tuple[()] = ...,
|
||||
args: tuple[()] = (),
|
||||
) -> npt.NDArray[np.float64 | np.complex128 | np.object_]: ...
|
||||
@overload
|
||||
def chebinterpolate(
|
||||
func: Callable[[npt.NDArray[np.float64]], _RT],
|
||||
func: Callable[[npt.NDArray[np.float64]], _CoefScalarT],
|
||||
deg: _IntLike_co,
|
||||
args: tuple[()] = ...,
|
||||
) -> npt.NDArray[_RT]: ...
|
||||
args: tuple[()] = (),
|
||||
) -> npt.NDArray[_CoefScalarT]: ...
|
||||
@overload
|
||||
def chebinterpolate(
|
||||
func: Callable[Concatenate[npt.NDArray[np.float64], ...], _RT],
|
||||
func: Callable[Concatenate[npt.NDArray[np.float64], ...], _CoefScalarT],
|
||||
deg: _IntLike_co,
|
||||
args: Iterable[Any],
|
||||
) -> npt.NDArray[_RT]: ...
|
||||
) -> npt.NDArray[_CoefScalarT]: ...
|
||||
|
||||
class Chebyshev(ABCPolyBase[L["T"]]):
|
||||
basis_name: ClassVar[L["T"]] = "T" # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
domain: _Array2[np.float64 | Any] = ... # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
window: _Array2[np.float64 | Any] = ... # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
|
||||
@overload
|
||||
@classmethod
|
||||
def interpolate(
|
||||
cls,
|
||||
func: Callable[[npt.NDArray[np.float64]], _CoefSeries],
|
||||
deg: _IntLike_co,
|
||||
domain: _SeriesLikeCoef_co | None = ...,
|
||||
args: tuple[()] = ...,
|
||||
domain: _SeriesLikeCoef_co | None = None,
|
||||
args: tuple[()] = (),
|
||||
) -> Self: ...
|
||||
@overload
|
||||
@classmethod
|
||||
def interpolate(
|
||||
cls,
|
||||
func: Callable[
|
||||
Concatenate[npt.NDArray[np.float64], ...],
|
||||
_CoefSeries,
|
||||
],
|
||||
func: Callable[Concatenate[npt.NDArray[np.float64], ...], _CoefSeries],
|
||||
deg: _IntLike_co,
|
||||
domain: _SeriesLikeCoef_co | None = ...,
|
||||
domain: _SeriesLikeCoef_co | None = None,
|
||||
*,
|
||||
args: Iterable[Any],
|
||||
) -> Self: ...
|
||||
@@ -171,10 +173,7 @@ class Chebyshev(ABCPolyBase[L["T"]]):
|
||||
@classmethod
|
||||
def interpolate(
|
||||
cls,
|
||||
func: Callable[
|
||||
Concatenate[npt.NDArray[np.float64], ...],
|
||||
_CoefSeries,
|
||||
],
|
||||
func: Callable[Concatenate[npt.NDArray[np.float64], ...], _CoefSeries],
|
||||
deg: _IntLike_co,
|
||||
domain: _SeriesLikeCoef_co | None,
|
||||
args: Iterable[Any],
|
||||
|
||||
@@ -76,8 +76,6 @@ See also
|
||||
|
||||
"""
|
||||
import numpy as np
|
||||
import numpy.linalg as la
|
||||
from numpy.lib.array_utils import normalize_axis_index
|
||||
|
||||
from . import polyutils as pu
|
||||
from ._polybase import ABCPolyBase
|
||||
@@ -655,7 +653,7 @@ def hermder(c, m=1, scl=1, axis=0):
|
||||
iaxis = pu._as_int(axis, "the axis")
|
||||
if cnt < 0:
|
||||
raise ValueError("The order of derivation must be non-negative")
|
||||
iaxis = normalize_axis_index(iaxis, c.ndim)
|
||||
iaxis = np.lib.array_utils.normalize_axis_index(iaxis, c.ndim)
|
||||
|
||||
if cnt == 0:
|
||||
return c
|
||||
@@ -772,7 +770,7 @@ def hermint(c, m=1, k=[], lbnd=0, scl=1, axis=0):
|
||||
raise ValueError("lbnd must be a scalar.")
|
||||
if np.ndim(scl) != 0:
|
||||
raise ValueError("scl must be a scalar.")
|
||||
iaxis = normalize_axis_index(iaxis, c.ndim)
|
||||
iaxis = np.lib.array_utils.normalize_axis_index(iaxis, c.ndim)
|
||||
|
||||
if cnt == 0:
|
||||
return c
|
||||
@@ -798,7 +796,7 @@ def hermint(c, m=1, k=[], lbnd=0, scl=1, axis=0):
|
||||
|
||||
def hermval(x, c, tensor=True):
|
||||
"""
|
||||
Evaluate an Hermite series at points x.
|
||||
Evaluate a Hermite series at points x.
|
||||
|
||||
If `c` is of length ``n + 1``, this function returns the value:
|
||||
|
||||
@@ -1441,7 +1439,7 @@ def hermcompanion(c):
|
||||
"""Return the scaled companion matrix of c.
|
||||
|
||||
The basis polynomials are scaled so that the companion matrix is
|
||||
symmetric when `c` is an Hermite basis polynomial. This provides
|
||||
symmetric when `c` is a Hermite basis polynomial. This provides
|
||||
better eigenvalue estimates than the unscaled case and for basis
|
||||
polynomials the eigenvalues are guaranteed to be real if
|
||||
`numpy.linalg.eigvalsh` is used to obtain them.
|
||||
@@ -1543,7 +1541,7 @@ def hermroots(c):
|
||||
|
||||
# rotated companion matrix reduces error
|
||||
m = hermcompanion(c)[::-1, ::-1]
|
||||
r = la.eigvals(m)
|
||||
r = np.linalg.eigvals(m)
|
||||
r.sort()
|
||||
return r
|
||||
|
||||
@@ -1636,7 +1634,7 @@ def hermgauss(deg):
|
||||
# matrix is symmetric in this case in order to obtain better zeros.
|
||||
c = np.array([0] * deg + [1], dtype=np.float64)
|
||||
m = hermcompanion(c)
|
||||
x = la.eigvalsh(m)
|
||||
x = np.linalg.eigvalsh(m)
|
||||
|
||||
# improve roots by one application of Newton
|
||||
dy = _normed_hermite_n(x, ideg)
|
||||
@@ -1695,7 +1693,7 @@ def hermweight(x):
|
||||
#
|
||||
|
||||
class Hermite(ABCPolyBase):
|
||||
"""An Hermite series class.
|
||||
"""A Hermite series class.
|
||||
|
||||
The Hermite class provides the standard Python numerical methods
|
||||
'+', '-', '*', '//', '%', 'divmod', '**', and '()' as well as the
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from typing import Any, Final, TypeVar
|
||||
from typing import Literal as L
|
||||
from typing import Any, ClassVar, Final, Literal as L, TypeVar
|
||||
|
||||
import numpy as np
|
||||
from numpy._typing import _Shape
|
||||
|
||||
from ._polybase import ABCPolyBase
|
||||
from ._polytypes import (
|
||||
@@ -22,7 +22,6 @@ from ._polytypes import (
|
||||
_FuncVal,
|
||||
_FuncVal2D,
|
||||
_FuncVal3D,
|
||||
_FuncValFromRoots,
|
||||
_FuncVander,
|
||||
_FuncVander2D,
|
||||
_FuncVander3D,
|
||||
@@ -64,44 +63,44 @@ __all__ = [
|
||||
"hermweight",
|
||||
]
|
||||
|
||||
poly2herm: _FuncPoly2Ortho[L["poly2herm"]]
|
||||
herm2poly: _FuncUnOp[L["herm2poly"]]
|
||||
_ShapeT = TypeVar("_ShapeT", bound=_Shape)
|
||||
|
||||
hermdomain: Final[_Array2[np.float64]]
|
||||
hermzero: Final[_Array1[np.int_]]
|
||||
hermone: Final[_Array1[np.int_]]
|
||||
hermx: Final[_Array2[np.int_]]
|
||||
poly2herm: Final[_FuncPoly2Ortho] = ...
|
||||
herm2poly: Final[_FuncUnOp] = ...
|
||||
|
||||
hermline: _FuncLine[L["hermline"]]
|
||||
hermfromroots: _FuncFromRoots[L["hermfromroots"]]
|
||||
hermadd: _FuncBinOp[L["hermadd"]]
|
||||
hermsub: _FuncBinOp[L["hermsub"]]
|
||||
hermmulx: _FuncUnOp[L["hermmulx"]]
|
||||
hermmul: _FuncBinOp[L["hermmul"]]
|
||||
hermdiv: _FuncBinOp[L["hermdiv"]]
|
||||
hermpow: _FuncPow[L["hermpow"]]
|
||||
hermder: _FuncDer[L["hermder"]]
|
||||
hermint: _FuncInteg[L["hermint"]]
|
||||
hermval: _FuncVal[L["hermval"]]
|
||||
hermval2d: _FuncVal2D[L["hermval2d"]]
|
||||
hermval3d: _FuncVal3D[L["hermval3d"]]
|
||||
hermvalfromroots: _FuncValFromRoots[L["hermvalfromroots"]]
|
||||
hermgrid2d: _FuncVal2D[L["hermgrid2d"]]
|
||||
hermgrid3d: _FuncVal3D[L["hermgrid3d"]]
|
||||
hermvander: _FuncVander[L["hermvander"]]
|
||||
hermvander2d: _FuncVander2D[L["hermvander2d"]]
|
||||
hermvander3d: _FuncVander3D[L["hermvander3d"]]
|
||||
hermfit: _FuncFit[L["hermfit"]]
|
||||
hermcompanion: _FuncCompanion[L["hermcompanion"]]
|
||||
hermroots: _FuncRoots[L["hermroots"]]
|
||||
hermdomain: Final[_Array2[np.float64]] = ...
|
||||
hermzero: Final[_Array1[np.int_]] = ...
|
||||
hermone: Final[_Array1[np.int_]] = ...
|
||||
hermx: Final[_Array2[np.int_]] = ...
|
||||
|
||||
_ND = TypeVar("_ND", bound=Any)
|
||||
def _normed_hermite_n(
|
||||
x: np.ndarray[_ND, np.dtype[np.float64]],
|
||||
n: int | np.intp,
|
||||
) -> np.ndarray[_ND, np.dtype[np.float64]]: ...
|
||||
hermline: Final[_FuncLine] = ...
|
||||
hermfromroots: Final[_FuncFromRoots] = ...
|
||||
hermadd: Final[_FuncBinOp] = ...
|
||||
hermsub: Final[_FuncBinOp] = ...
|
||||
hermmulx: Final[_FuncUnOp] = ...
|
||||
hermmul: Final[_FuncBinOp] = ...
|
||||
hermdiv: Final[_FuncBinOp] = ...
|
||||
hermpow: Final[_FuncPow] = ...
|
||||
hermder: Final[_FuncDer] = ...
|
||||
hermint: Final[_FuncInteg] = ...
|
||||
hermval: Final[_FuncVal] = ...
|
||||
hermval2d: Final[_FuncVal2D] = ...
|
||||
hermval3d: Final[_FuncVal3D] = ...
|
||||
hermgrid2d: Final[_FuncVal2D] = ...
|
||||
hermgrid3d: Final[_FuncVal3D] = ...
|
||||
hermvander: Final[_FuncVander] = ...
|
||||
hermvander2d: Final[_FuncVander2D] = ...
|
||||
hermvander3d: Final[_FuncVander3D] = ...
|
||||
hermfit: Final[_FuncFit] = ...
|
||||
hermcompanion: Final[_FuncCompanion] = ...
|
||||
hermroots: Final[_FuncRoots] = ...
|
||||
|
||||
hermgauss: _FuncGauss[L["hermgauss"]]
|
||||
hermweight: _FuncWeight[L["hermweight"]]
|
||||
def _normed_hermite_n(x: np.ndarray[_ShapeT, np.dtype[np.float64]], n: int) -> np.ndarray[_ShapeT, np.dtype[np.float64]]: ...
|
||||
|
||||
class Hermite(ABCPolyBase[L["H"]]): ...
|
||||
hermgauss: Final[_FuncGauss] = ...
|
||||
hermweight: Final[_FuncWeight] = ...
|
||||
|
||||
class Hermite(ABCPolyBase[L["H"]]):
|
||||
basis_name: ClassVar[L["H"]] = "H" # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
domain: _Array2[np.float64 | Any] = ... # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
window: _Array2[np.float64 | Any] = ... # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
|
||||
@@ -76,8 +76,6 @@ See also
|
||||
|
||||
"""
|
||||
import numpy as np
|
||||
import numpy.linalg as la
|
||||
from numpy.lib.array_utils import normalize_axis_index
|
||||
|
||||
from . import polyutils as pu
|
||||
from ._polybase import ABCPolyBase
|
||||
@@ -653,7 +651,7 @@ def hermeder(c, m=1, scl=1, axis=0):
|
||||
iaxis = pu._as_int(axis, "the axis")
|
||||
if cnt < 0:
|
||||
raise ValueError("The order of derivation must be non-negative")
|
||||
iaxis = normalize_axis_index(iaxis, c.ndim)
|
||||
iaxis = np.lib.array_utils.normalize_axis_index(iaxis, c.ndim)
|
||||
|
||||
if cnt == 0:
|
||||
return c
|
||||
@@ -770,7 +768,7 @@ def hermeint(c, m=1, k=[], lbnd=0, scl=1, axis=0):
|
||||
raise ValueError("lbnd must be a scalar.")
|
||||
if np.ndim(scl) != 0:
|
||||
raise ValueError("scl must be a scalar.")
|
||||
iaxis = normalize_axis_index(iaxis, c.ndim)
|
||||
iaxis = np.lib.array_utils.normalize_axis_index(iaxis, c.ndim)
|
||||
|
||||
if cnt == 0:
|
||||
return c
|
||||
@@ -796,7 +794,7 @@ def hermeint(c, m=1, k=[], lbnd=0, scl=1, axis=0):
|
||||
|
||||
def hermeval(x, c, tensor=True):
|
||||
"""
|
||||
Evaluate an HermiteE series at points x.
|
||||
Evaluate a HermiteE series at points x.
|
||||
|
||||
If `c` is of length ``n + 1``, this function returns the value:
|
||||
|
||||
@@ -1367,7 +1365,7 @@ def hermecompanion(c):
|
||||
Return the scaled companion matrix of c.
|
||||
|
||||
The basis polynomials are scaled so that the companion matrix is
|
||||
symmetric when `c` is an HermiteE basis polynomial. This provides
|
||||
symmetric when `c` is a HermiteE basis polynomial. This provides
|
||||
better eigenvalue estimates than the unscaled case and for basis
|
||||
polynomials the eigenvalues are guaranteed to be real if
|
||||
`numpy.linalg.eigvalsh` is used to obtain them.
|
||||
@@ -1461,7 +1459,7 @@ def hermeroots(c):
|
||||
|
||||
# rotated companion matrix reduces error
|
||||
m = hermecompanion(c)[::-1, ::-1]
|
||||
r = la.eigvals(m)
|
||||
r = np.linalg.eigvals(m)
|
||||
r.sort()
|
||||
return r
|
||||
|
||||
@@ -1548,7 +1546,7 @@ def hermegauss(deg):
|
||||
# matrix is symmetric in this case in order to obtain better zeros.
|
||||
c = np.array([0] * deg + [1])
|
||||
m = hermecompanion(c)
|
||||
x = la.eigvalsh(m)
|
||||
x = np.linalg.eigvalsh(m)
|
||||
|
||||
# improve roots by one application of Newton
|
||||
dy = _normed_hermite_e_n(x, ideg)
|
||||
@@ -1597,7 +1595,7 @@ def hermeweight(x):
|
||||
#
|
||||
|
||||
class HermiteE(ABCPolyBase):
|
||||
"""An HermiteE series class.
|
||||
"""A HermiteE series class.
|
||||
|
||||
The HermiteE class provides the standard Python numerical methods
|
||||
'+', '-', '*', '//', '%', 'divmod', '**', and '()' as well as the
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from typing import Any, Final, TypeVar
|
||||
from typing import Literal as L
|
||||
from typing import Any, ClassVar, Final, Literal as L, TypeVar
|
||||
|
||||
import numpy as np
|
||||
from numpy._typing import _Shape
|
||||
|
||||
from ._polybase import ABCPolyBase
|
||||
from ._polytypes import (
|
||||
@@ -22,7 +22,6 @@ from ._polytypes import (
|
||||
_FuncVal,
|
||||
_FuncVal2D,
|
||||
_FuncVal3D,
|
||||
_FuncValFromRoots,
|
||||
_FuncVander,
|
||||
_FuncVander2D,
|
||||
_FuncVander3D,
|
||||
@@ -64,44 +63,44 @@ __all__ = [
|
||||
"hermeweight",
|
||||
]
|
||||
|
||||
poly2herme: _FuncPoly2Ortho[L["poly2herme"]]
|
||||
herme2poly: _FuncUnOp[L["herme2poly"]]
|
||||
_ShapeT = TypeVar("_ShapeT", bound=_Shape)
|
||||
|
||||
hermedomain: Final[_Array2[np.float64]]
|
||||
hermezero: Final[_Array1[np.int_]]
|
||||
hermeone: Final[_Array1[np.int_]]
|
||||
hermex: Final[_Array2[np.int_]]
|
||||
poly2herme: Final[_FuncPoly2Ortho] = ...
|
||||
herme2poly: Final[_FuncUnOp] = ...
|
||||
|
||||
hermeline: _FuncLine[L["hermeline"]]
|
||||
hermefromroots: _FuncFromRoots[L["hermefromroots"]]
|
||||
hermeadd: _FuncBinOp[L["hermeadd"]]
|
||||
hermesub: _FuncBinOp[L["hermesub"]]
|
||||
hermemulx: _FuncUnOp[L["hermemulx"]]
|
||||
hermemul: _FuncBinOp[L["hermemul"]]
|
||||
hermediv: _FuncBinOp[L["hermediv"]]
|
||||
hermepow: _FuncPow[L["hermepow"]]
|
||||
hermeder: _FuncDer[L["hermeder"]]
|
||||
hermeint: _FuncInteg[L["hermeint"]]
|
||||
hermeval: _FuncVal[L["hermeval"]]
|
||||
hermeval2d: _FuncVal2D[L["hermeval2d"]]
|
||||
hermeval3d: _FuncVal3D[L["hermeval3d"]]
|
||||
hermevalfromroots: _FuncValFromRoots[L["hermevalfromroots"]]
|
||||
hermegrid2d: _FuncVal2D[L["hermegrid2d"]]
|
||||
hermegrid3d: _FuncVal3D[L["hermegrid3d"]]
|
||||
hermevander: _FuncVander[L["hermevander"]]
|
||||
hermevander2d: _FuncVander2D[L["hermevander2d"]]
|
||||
hermevander3d: _FuncVander3D[L["hermevander3d"]]
|
||||
hermefit: _FuncFit[L["hermefit"]]
|
||||
hermecompanion: _FuncCompanion[L["hermecompanion"]]
|
||||
hermeroots: _FuncRoots[L["hermeroots"]]
|
||||
hermedomain: Final[_Array2[np.float64]] = ...
|
||||
hermezero: Final[_Array1[np.int_]] = ...
|
||||
hermeone: Final[_Array1[np.int_]] = ...
|
||||
hermex: Final[_Array2[np.int_]] = ...
|
||||
|
||||
_ND = TypeVar("_ND", bound=Any)
|
||||
def _normed_hermite_e_n(
|
||||
x: np.ndarray[_ND, np.dtype[np.float64]],
|
||||
n: int | np.intp,
|
||||
) -> np.ndarray[_ND, np.dtype[np.float64]]: ...
|
||||
hermeline: Final[_FuncLine] = ...
|
||||
hermefromroots: Final[_FuncFromRoots] = ...
|
||||
hermeadd: Final[_FuncBinOp] = ...
|
||||
hermesub: Final[_FuncBinOp] = ...
|
||||
hermemulx: Final[_FuncUnOp] = ...
|
||||
hermemul: Final[_FuncBinOp] = ...
|
||||
hermediv: Final[_FuncBinOp] = ...
|
||||
hermepow: Final[_FuncPow] = ...
|
||||
hermeder: Final[_FuncDer] = ...
|
||||
hermeint: Final[_FuncInteg] = ...
|
||||
hermeval: Final[_FuncVal] = ...
|
||||
hermeval2d: Final[_FuncVal2D] = ...
|
||||
hermeval3d: Final[_FuncVal3D] = ...
|
||||
hermegrid2d: Final[_FuncVal2D] = ...
|
||||
hermegrid3d: Final[_FuncVal3D] = ...
|
||||
hermevander: Final[_FuncVander] = ...
|
||||
hermevander2d: Final[_FuncVander2D] = ...
|
||||
hermevander3d: Final[_FuncVander3D] = ...
|
||||
hermefit: Final[_FuncFit] = ...
|
||||
hermecompanion: Final[_FuncCompanion] = ...
|
||||
hermeroots: Final[_FuncRoots] = ...
|
||||
|
||||
hermegauss: _FuncGauss[L["hermegauss"]]
|
||||
hermeweight: _FuncWeight[L["hermeweight"]]
|
||||
def _normed_hermite_e_n(x: np.ndarray[_ShapeT, np.dtype[np.float64]], n: int) -> np.ndarray[_ShapeT, np.dtype[np.float64]]: ...
|
||||
|
||||
class HermiteE(ABCPolyBase[L["He"]]): ...
|
||||
hermegauss: Final[_FuncGauss] = ...
|
||||
hermeweight: Final[_FuncWeight] = ...
|
||||
|
||||
class HermiteE(ABCPolyBase[L["He"]]):
|
||||
basis_name: ClassVar[L["He"]] = "He" # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
domain: _Array2[np.float64 | Any] = ... # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
window: _Array2[np.float64 | Any] = ... # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
|
||||
@@ -76,8 +76,6 @@ See also
|
||||
|
||||
"""
|
||||
import numpy as np
|
||||
import numpy.linalg as la
|
||||
from numpy.lib.array_utils import normalize_axis_index
|
||||
|
||||
from . import polyutils as pu
|
||||
from ._polybase import ABCPolyBase
|
||||
@@ -650,7 +648,7 @@ def lagder(c, m=1, scl=1, axis=0):
|
||||
iaxis = pu._as_int(axis, "the axis")
|
||||
if cnt < 0:
|
||||
raise ValueError("The order of derivation must be non-negative")
|
||||
iaxis = normalize_axis_index(iaxis, c.ndim)
|
||||
iaxis = np.lib.array_utils.normalize_axis_index(iaxis, c.ndim)
|
||||
|
||||
if cnt == 0:
|
||||
return c
|
||||
@@ -770,7 +768,7 @@ def lagint(c, m=1, k=[], lbnd=0, scl=1, axis=0):
|
||||
raise ValueError("lbnd must be a scalar.")
|
||||
if np.ndim(scl) != 0:
|
||||
raise ValueError("scl must be a scalar.")
|
||||
iaxis = normalize_axis_index(iaxis, c.ndim)
|
||||
iaxis = np.lib.array_utils.normalize_axis_index(iaxis, c.ndim)
|
||||
|
||||
if cnt == 0:
|
||||
return c
|
||||
@@ -1185,7 +1183,7 @@ def lagvander2d(x, y, deg):
|
||||
correspond to the elements of a 2-D coefficient array `c` of shape
|
||||
(xdeg + 1, ydeg + 1) in the order
|
||||
|
||||
.. math:: c_{00}, c_{01}, c_{02} ... , c_{10}, c_{11}, c_{12} ...
|
||||
.. math:: c_{00}, c_{01}, c_{02}, ... , c_{10}, c_{11}, c_{12}, ...
|
||||
|
||||
and ``np.dot(V, c.flat)`` and ``lagval2d(x, y, c)`` will be the same
|
||||
up to roundoff. This equivalence is useful both for least squares
|
||||
@@ -1525,7 +1523,7 @@ def lagroots(c):
|
||||
|
||||
# rotated companion matrix reduces error
|
||||
m = lagcompanion(c)[::-1, ::-1]
|
||||
r = la.eigvals(m)
|
||||
r = np.linalg.eigvals(m)
|
||||
r.sort()
|
||||
return r
|
||||
|
||||
@@ -1577,7 +1575,7 @@ def laggauss(deg):
|
||||
# matrix is symmetric in this case in order to obtain better zeros.
|
||||
c = np.array([0] * deg + [1])
|
||||
m = lagcompanion(c)
|
||||
x = la.eigvalsh(m)
|
||||
x = np.linalg.eigvalsh(m)
|
||||
|
||||
# improve roots by one application of Newton
|
||||
dy = lagval(x, c)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from typing import Final
|
||||
from typing import Literal as L
|
||||
from typing import Any, ClassVar, Final, Literal as L
|
||||
|
||||
import numpy as np
|
||||
|
||||
@@ -22,7 +21,6 @@ from ._polytypes import (
|
||||
_FuncVal,
|
||||
_FuncVal2D,
|
||||
_FuncVal3D,
|
||||
_FuncValFromRoots,
|
||||
_FuncVander,
|
||||
_FuncVander2D,
|
||||
_FuncVander3D,
|
||||
@@ -64,37 +62,39 @@ __all__ = [
|
||||
"lagweight",
|
||||
]
|
||||
|
||||
poly2lag: _FuncPoly2Ortho[L["poly2lag"]]
|
||||
lag2poly: _FuncUnOp[L["lag2poly"]]
|
||||
poly2lag: Final[_FuncPoly2Ortho] = ...
|
||||
lag2poly: Final[_FuncUnOp] = ...
|
||||
|
||||
lagdomain: Final[_Array2[np.float64]]
|
||||
lagzero: Final[_Array1[np.int_]]
|
||||
lagone: Final[_Array1[np.int_]]
|
||||
lagx: Final[_Array2[np.int_]]
|
||||
lagdomain: Final[_Array2[np.float64]] = ...
|
||||
lagzero: Final[_Array1[np.int_]] = ...
|
||||
lagone: Final[_Array1[np.int_]] = ...
|
||||
lagx: Final[_Array2[np.int_]] = ...
|
||||
|
||||
lagline: _FuncLine[L["lagline"]]
|
||||
lagfromroots: _FuncFromRoots[L["lagfromroots"]]
|
||||
lagadd: _FuncBinOp[L["lagadd"]]
|
||||
lagsub: _FuncBinOp[L["lagsub"]]
|
||||
lagmulx: _FuncUnOp[L["lagmulx"]]
|
||||
lagmul: _FuncBinOp[L["lagmul"]]
|
||||
lagdiv: _FuncBinOp[L["lagdiv"]]
|
||||
lagpow: _FuncPow[L["lagpow"]]
|
||||
lagder: _FuncDer[L["lagder"]]
|
||||
lagint: _FuncInteg[L["lagint"]]
|
||||
lagval: _FuncVal[L["lagval"]]
|
||||
lagval2d: _FuncVal2D[L["lagval2d"]]
|
||||
lagval3d: _FuncVal3D[L["lagval3d"]]
|
||||
lagvalfromroots: _FuncValFromRoots[L["lagvalfromroots"]]
|
||||
laggrid2d: _FuncVal2D[L["laggrid2d"]]
|
||||
laggrid3d: _FuncVal3D[L["laggrid3d"]]
|
||||
lagvander: _FuncVander[L["lagvander"]]
|
||||
lagvander2d: _FuncVander2D[L["lagvander2d"]]
|
||||
lagvander3d: _FuncVander3D[L["lagvander3d"]]
|
||||
lagfit: _FuncFit[L["lagfit"]]
|
||||
lagcompanion: _FuncCompanion[L["lagcompanion"]]
|
||||
lagroots: _FuncRoots[L["lagroots"]]
|
||||
laggauss: _FuncGauss[L["laggauss"]]
|
||||
lagweight: _FuncWeight[L["lagweight"]]
|
||||
lagline: Final[_FuncLine] = ...
|
||||
lagfromroots: Final[_FuncFromRoots] = ...
|
||||
lagadd: Final[_FuncBinOp] = ...
|
||||
lagsub: Final[_FuncBinOp] = ...
|
||||
lagmulx: Final[_FuncUnOp] = ...
|
||||
lagmul: Final[_FuncBinOp] = ...
|
||||
lagdiv: Final[_FuncBinOp] = ...
|
||||
lagpow: Final[_FuncPow] = ...
|
||||
lagder: Final[_FuncDer] = ...
|
||||
lagint: Final[_FuncInteg] = ...
|
||||
lagval: Final[_FuncVal] = ...
|
||||
lagval2d: Final[_FuncVal2D] = ...
|
||||
lagval3d: Final[_FuncVal3D] = ...
|
||||
laggrid2d: Final[_FuncVal2D] = ...
|
||||
laggrid3d: Final[_FuncVal3D] = ...
|
||||
lagvander: Final[_FuncVander] = ...
|
||||
lagvander2d: Final[_FuncVander2D] = ...
|
||||
lagvander3d: Final[_FuncVander3D] = ...
|
||||
lagfit: Final[_FuncFit] = ...
|
||||
lagcompanion: Final[_FuncCompanion] = ...
|
||||
lagroots: Final[_FuncRoots] = ...
|
||||
laggauss: Final[_FuncGauss] = ...
|
||||
lagweight: Final[_FuncWeight] = ...
|
||||
|
||||
class Laguerre(ABCPolyBase[L["L"]]): ...
|
||||
class Laguerre(ABCPolyBase[L["L"]]):
|
||||
basis_name: ClassVar[L["L"]] = "L" # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
domain: _Array2[np.float64 | Any] = ... # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
window: _Array2[np.float64 | Any] = ... # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
|
||||
@@ -80,8 +80,6 @@ numpy.polynomial
|
||||
|
||||
"""
|
||||
import numpy as np
|
||||
import numpy.linalg as la
|
||||
from numpy.lib.array_utils import normalize_axis_index
|
||||
|
||||
from . import polyutils as pu
|
||||
from ._polybase import ABCPolyBase
|
||||
@@ -676,7 +674,7 @@ def legder(c, m=1, scl=1, axis=0):
|
||||
iaxis = pu._as_int(axis, "the axis")
|
||||
if cnt < 0:
|
||||
raise ValueError("The order of derivation must be non-negative")
|
||||
iaxis = normalize_axis_index(iaxis, c.ndim)
|
||||
iaxis = np.lib.array_utils.normalize_axis_index(iaxis, c.ndim)
|
||||
|
||||
if cnt == 0:
|
||||
return c
|
||||
@@ -799,7 +797,7 @@ def legint(c, m=1, k=[], lbnd=0, scl=1, axis=0):
|
||||
raise ValueError("lbnd must be a scalar.")
|
||||
if np.ndim(scl) != 0:
|
||||
raise ValueError("scl must be a scalar.")
|
||||
iaxis = normalize_axis_index(iaxis, c.ndim)
|
||||
iaxis = np.lib.array_utils.normalize_axis_index(iaxis, c.ndim)
|
||||
|
||||
if cnt == 0:
|
||||
return c
|
||||
@@ -1164,7 +1162,7 @@ def legvander2d(x, y, deg):
|
||||
correspond to the elements of a 2-D coefficient array `c` of shape
|
||||
(xdeg + 1, ydeg + 1) in the order
|
||||
|
||||
.. math:: c_{00}, c_{01}, c_{02} ... , c_{10}, c_{11}, c_{12} ...
|
||||
.. math:: c_{00}, c_{01}, c_{02}, ... , c_{10}, c_{11}, c_{12}, ...
|
||||
|
||||
and ``np.dot(V, c.flat)`` and ``legval2d(x, y, c)`` will be the same
|
||||
up to roundoff. This equivalence is useful both for least squares
|
||||
@@ -1464,7 +1462,7 @@ def legroots(c):
|
||||
|
||||
# rotated companion matrix reduces error
|
||||
m = legcompanion(c)[::-1, ::-1]
|
||||
r = la.eigvals(m)
|
||||
r = np.linalg.eigvals(m)
|
||||
r.sort()
|
||||
return r
|
||||
|
||||
@@ -1510,7 +1508,7 @@ def leggauss(deg):
|
||||
# matrix is symmetric in this case in order to obtain better zeros.
|
||||
c = np.array([0] * deg + [1])
|
||||
m = legcompanion(c)
|
||||
x = la.eigvalsh(m)
|
||||
x = np.linalg.eigvalsh(m)
|
||||
|
||||
# improve roots by one application of Newton
|
||||
dy = legval(x, c)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from typing import Final
|
||||
from typing import Literal as L
|
||||
from typing import Any, ClassVar, Final, Literal as L
|
||||
|
||||
import numpy as np
|
||||
|
||||
@@ -22,7 +21,6 @@ from ._polytypes import (
|
||||
_FuncVal,
|
||||
_FuncVal2D,
|
||||
_FuncVal3D,
|
||||
_FuncValFromRoots,
|
||||
_FuncVander,
|
||||
_FuncVander2D,
|
||||
_FuncVander3D,
|
||||
@@ -64,37 +62,39 @@ __all__ = [
|
||||
"legweight",
|
||||
]
|
||||
|
||||
poly2leg: _FuncPoly2Ortho[L["poly2leg"]]
|
||||
leg2poly: _FuncUnOp[L["leg2poly"]]
|
||||
poly2leg: Final[_FuncPoly2Ortho] = ...
|
||||
leg2poly: Final[_FuncUnOp] = ...
|
||||
|
||||
legdomain: Final[_Array2[np.float64]]
|
||||
legzero: Final[_Array1[np.int_]]
|
||||
legone: Final[_Array1[np.int_]]
|
||||
legx: Final[_Array2[np.int_]]
|
||||
legdomain: Final[_Array2[np.float64]] = ...
|
||||
legzero: Final[_Array1[np.int_]] = ...
|
||||
legone: Final[_Array1[np.int_]] = ...
|
||||
legx: Final[_Array2[np.int_]] = ...
|
||||
|
||||
legline: _FuncLine[L["legline"]]
|
||||
legfromroots: _FuncFromRoots[L["legfromroots"]]
|
||||
legadd: _FuncBinOp[L["legadd"]]
|
||||
legsub: _FuncBinOp[L["legsub"]]
|
||||
legmulx: _FuncUnOp[L["legmulx"]]
|
||||
legmul: _FuncBinOp[L["legmul"]]
|
||||
legdiv: _FuncBinOp[L["legdiv"]]
|
||||
legpow: _FuncPow[L["legpow"]]
|
||||
legder: _FuncDer[L["legder"]]
|
||||
legint: _FuncInteg[L["legint"]]
|
||||
legval: _FuncVal[L["legval"]]
|
||||
legval2d: _FuncVal2D[L["legval2d"]]
|
||||
legval3d: _FuncVal3D[L["legval3d"]]
|
||||
legvalfromroots: _FuncValFromRoots[L["legvalfromroots"]]
|
||||
leggrid2d: _FuncVal2D[L["leggrid2d"]]
|
||||
leggrid3d: _FuncVal3D[L["leggrid3d"]]
|
||||
legvander: _FuncVander[L["legvander"]]
|
||||
legvander2d: _FuncVander2D[L["legvander2d"]]
|
||||
legvander3d: _FuncVander3D[L["legvander3d"]]
|
||||
legfit: _FuncFit[L["legfit"]]
|
||||
legcompanion: _FuncCompanion[L["legcompanion"]]
|
||||
legroots: _FuncRoots[L["legroots"]]
|
||||
leggauss: _FuncGauss[L["leggauss"]]
|
||||
legweight: _FuncWeight[L["legweight"]]
|
||||
legline: Final[_FuncLine] = ...
|
||||
legfromroots: Final[_FuncFromRoots] = ...
|
||||
legadd: Final[_FuncBinOp] = ...
|
||||
legsub: Final[_FuncBinOp] = ...
|
||||
legmulx: Final[_FuncUnOp] = ...
|
||||
legmul: Final[_FuncBinOp] = ...
|
||||
legdiv: Final[_FuncBinOp] = ...
|
||||
legpow: Final[_FuncPow] = ...
|
||||
legder: Final[_FuncDer] = ...
|
||||
legint: Final[_FuncInteg] = ...
|
||||
legval: Final[_FuncVal] = ...
|
||||
legval2d: Final[_FuncVal2D] = ...
|
||||
legval3d: Final[_FuncVal3D] = ...
|
||||
leggrid2d: Final[_FuncVal2D] = ...
|
||||
leggrid3d: Final[_FuncVal3D] = ...
|
||||
legvander: Final[_FuncVander] = ...
|
||||
legvander2d: Final[_FuncVander2D] = ...
|
||||
legvander3d: Final[_FuncVander3D] = ...
|
||||
legfit: Final[_FuncFit] = ...
|
||||
legcompanion: Final[_FuncCompanion] = ...
|
||||
legroots: Final[_FuncRoots] = ...
|
||||
leggauss: Final[_FuncGauss] = ...
|
||||
legweight: Final[_FuncWeight] = ...
|
||||
|
||||
class Legendre(ABCPolyBase[L["P"]]): ...
|
||||
class Legendre(ABCPolyBase[L["P"]]):
|
||||
basis_name: ClassVar[L["P"]] = "P" # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
domain: _Array2[np.float64 | Any] = ... # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
window: _Array2[np.float64 | Any] = ... # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
|
||||
@@ -81,8 +81,7 @@ __all__ = [
|
||||
'polycompanion']
|
||||
|
||||
import numpy as np
|
||||
import numpy.linalg as la
|
||||
from numpy.lib.array_utils import normalize_axis_index
|
||||
from numpy._core.overrides import array_function_dispatch as _array_function_dispatch
|
||||
|
||||
from . import polyutils as pu
|
||||
from ._polybase import ABCPolyBase
|
||||
@@ -522,7 +521,7 @@ def polyder(c, m=1, scl=1, axis=0):
|
||||
iaxis = pu._as_int(axis, "the axis")
|
||||
if cnt < 0:
|
||||
raise ValueError("The order of derivation must be non-negative")
|
||||
iaxis = normalize_axis_index(iaxis, c.ndim)
|
||||
iaxis = np.lib.array_utils.normalize_axis_index(iaxis, c.ndim)
|
||||
|
||||
if cnt == 0:
|
||||
return c
|
||||
@@ -636,7 +635,7 @@ def polyint(c, m=1, k=[], lbnd=0, scl=1, axis=0):
|
||||
raise ValueError("lbnd must be a scalar.")
|
||||
if np.ndim(scl) != 0:
|
||||
raise ValueError("scl must be a scalar.")
|
||||
iaxis = normalize_axis_index(iaxis, c.ndim)
|
||||
iaxis = np.lib.array_utils.normalize_axis_index(iaxis, c.ndim)
|
||||
|
||||
if cnt == 0:
|
||||
return c
|
||||
@@ -716,6 +715,10 @@ def polyval(x, c, tensor=True):
|
||||
-----
|
||||
The evaluation uses Horner's method.
|
||||
|
||||
When using coefficients from polynomials created with ``Polynomial.fit()``,
|
||||
use ``p(x)`` or ``polyval(x, p.convert().coef)`` to handle domain/window
|
||||
scaling correctly, not ``polyval(x, p.coef)``.
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> import numpy as np
|
||||
@@ -841,7 +844,13 @@ def polyvalfromroots(x, r, tensor=True):
|
||||
raise ValueError("x.ndim must be < r.ndim when tensor == False")
|
||||
return np.prod(x - r, axis=0)
|
||||
|
||||
def _polyval2d_dispatcher(x, y, c):
|
||||
return (x, y, c)
|
||||
|
||||
def _polygrid2d_dispatcher(x, y, c):
|
||||
return (x, y, c)
|
||||
|
||||
@_array_function_dispatch(_polyval2d_dispatcher)
|
||||
def polyval2d(x, y, c):
|
||||
"""
|
||||
Evaluate a 2-D polynomial at points (x, y).
|
||||
@@ -893,7 +902,7 @@ def polyval2d(x, y, c):
|
||||
"""
|
||||
return pu._valnd(polyval, c, x, y)
|
||||
|
||||
|
||||
@_array_function_dispatch(_polygrid2d_dispatcher)
|
||||
def polygrid2d(x, y, c):
|
||||
"""
|
||||
Evaluate a 2-D polynomial on the Cartesian product of x and y.
|
||||
@@ -1536,7 +1545,7 @@ def polyroots(c):
|
||||
return np.array([-c[0] / c[1]])
|
||||
|
||||
m = polycompanion(c)
|
||||
r = la.eigvals(m)
|
||||
r = np.linalg.eigvals(m)
|
||||
r.sort()
|
||||
return r
|
||||
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
from typing import Final
|
||||
from typing import Literal as L
|
||||
from typing import Any, ClassVar, Final, overload
|
||||
|
||||
import numpy as np
|
||||
import numpy.typing as npt
|
||||
from numpy._typing import (
|
||||
_ArrayLikeFloat_co,
|
||||
_ArrayLikeNumber_co,
|
||||
_FloatLike_co,
|
||||
_NumberLike_co,
|
||||
)
|
||||
|
||||
from ._polybase import ABCPolyBase
|
||||
from ._polytypes import (
|
||||
_Array1,
|
||||
_Array2,
|
||||
_ArrayLikeCoef_co,
|
||||
_FuncBinOp,
|
||||
_FuncCompanion,
|
||||
_FuncDer,
|
||||
@@ -20,7 +27,6 @@ from ._polytypes import (
|
||||
_FuncVal,
|
||||
_FuncVal2D,
|
||||
_FuncVal3D,
|
||||
_FuncValFromRoots,
|
||||
_FuncVander,
|
||||
_FuncVander2D,
|
||||
_FuncVander3D,
|
||||
@@ -58,32 +64,46 @@ __all__ = [
|
||||
"polycompanion",
|
||||
]
|
||||
|
||||
polydomain: Final[_Array2[np.float64]]
|
||||
polyzero: Final[_Array1[np.int_]]
|
||||
polyone: Final[_Array1[np.int_]]
|
||||
polyx: Final[_Array2[np.int_]]
|
||||
polydomain: Final[_Array2[np.float64]] = ...
|
||||
polyzero: Final[_Array1[np.int_]] = ...
|
||||
polyone: Final[_Array1[np.int_]] = ...
|
||||
polyx: Final[_Array2[np.int_]] = ...
|
||||
|
||||
polyline: _FuncLine[L["Polyline"]]
|
||||
polyfromroots: _FuncFromRoots[L["polyfromroots"]]
|
||||
polyadd: _FuncBinOp[L["polyadd"]]
|
||||
polysub: _FuncBinOp[L["polysub"]]
|
||||
polymulx: _FuncUnOp[L["polymulx"]]
|
||||
polymul: _FuncBinOp[L["polymul"]]
|
||||
polydiv: _FuncBinOp[L["polydiv"]]
|
||||
polypow: _FuncPow[L["polypow"]]
|
||||
polyder: _FuncDer[L["polyder"]]
|
||||
polyint: _FuncInteg[L["polyint"]]
|
||||
polyval: _FuncVal[L["polyval"]]
|
||||
polyval2d: _FuncVal2D[L["polyval2d"]]
|
||||
polyval3d: _FuncVal3D[L["polyval3d"]]
|
||||
polyvalfromroots: _FuncValFromRoots[L["polyvalfromroots"]]
|
||||
polygrid2d: _FuncVal2D[L["polygrid2d"]]
|
||||
polygrid3d: _FuncVal3D[L["polygrid3d"]]
|
||||
polyvander: _FuncVander[L["polyvander"]]
|
||||
polyvander2d: _FuncVander2D[L["polyvander2d"]]
|
||||
polyvander3d: _FuncVander3D[L["polyvander3d"]]
|
||||
polyfit: _FuncFit[L["polyfit"]]
|
||||
polycompanion: _FuncCompanion[L["polycompanion"]]
|
||||
polyroots: _FuncRoots[L["polyroots"]]
|
||||
polyline: Final[_FuncLine] = ...
|
||||
polyfromroots: Final[_FuncFromRoots] = ...
|
||||
polyadd: Final[_FuncBinOp] = ...
|
||||
polysub: Final[_FuncBinOp] = ...
|
||||
polymulx: Final[_FuncUnOp] = ...
|
||||
polymul: Final[_FuncBinOp] = ...
|
||||
polydiv: Final[_FuncBinOp] = ...
|
||||
polypow: Final[_FuncPow] = ...
|
||||
polyder: Final[_FuncDer] = ...
|
||||
polyint: Final[_FuncInteg] = ...
|
||||
polyval: Final[_FuncVal] = ...
|
||||
polyval2d: Final[_FuncVal2D] = ...
|
||||
polyval3d: Final[_FuncVal3D] = ...
|
||||
|
||||
class Polynomial(ABCPolyBase[None]): ...
|
||||
@overload
|
||||
def polyvalfromroots(x: _FloatLike_co, r: _FloatLike_co, tensor: bool = True) -> np.float64 | Any: ...
|
||||
@overload
|
||||
def polyvalfromroots(x: _NumberLike_co, r: _NumberLike_co, tensor: bool = True) -> np.complex128 | Any: ...
|
||||
@overload
|
||||
def polyvalfromroots(x: _ArrayLikeFloat_co, r: _ArrayLikeFloat_co, tensor: bool = True) -> npt.NDArray[np.float64 | Any]: ...
|
||||
@overload
|
||||
def polyvalfromroots(x: _ArrayLikeNumber_co, r: _ArrayLikeNumber_co, tensor: bool = True) -> npt.NDArray[np.complex128 | Any]: ...
|
||||
@overload
|
||||
def polyvalfromroots(x: _ArrayLikeCoef_co, r: _ArrayLikeCoef_co, tensor: bool = True) -> npt.NDArray[np.object_ | Any]: ...
|
||||
|
||||
polygrid2d: Final[_FuncVal2D] = ...
|
||||
polygrid3d: Final[_FuncVal3D] = ...
|
||||
polyvander: Final[_FuncVander] = ...
|
||||
polyvander2d: Final[_FuncVander2D] = ...
|
||||
polyvander3d: Final[_FuncVander3D] = ...
|
||||
polyfit: Final[_FuncFit] = ...
|
||||
polycompanion: Final[_FuncCompanion] = ...
|
||||
polyroots: Final[_FuncRoots] = ...
|
||||
|
||||
class Polynomial(ABCPolyBase[None]):
|
||||
basis_name: ClassVar[None] = None # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
domain: _Array2[np.float64 | Any] = ... # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
window: _Array2[np.float64 | Any] = ... # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
|
||||
@@ -23,8 +23,6 @@ import operator
|
||||
import warnings
|
||||
|
||||
import numpy as np
|
||||
from numpy._core.multiarray import dragon4_positional, dragon4_scientific
|
||||
from numpy.exceptions import RankWarning
|
||||
|
||||
__all__ = [
|
||||
'as_series', 'trimseq', 'trimcoef', 'getdomain', 'mapdomain', 'mapparms',
|
||||
@@ -661,7 +659,7 @@ def _fit(vander_f, x, y, deg, rcond=None, full=False, w=None):
|
||||
# warn on rank reduction
|
||||
if rank != order and not full:
|
||||
msg = "The fit may be poorly conditioned"
|
||||
warnings.warn(msg, RankWarning, stacklevel=2)
|
||||
warnings.warn(msg, np.exceptions.RankWarning, stacklevel=2)
|
||||
|
||||
if full:
|
||||
return c, [resids, rank, s, rcond]
|
||||
@@ -725,6 +723,8 @@ def _as_int(x, desc):
|
||||
|
||||
|
||||
def format_float(x, parens=False):
|
||||
from numpy._core.multiarray import dragon4_positional, dragon4_scientific
|
||||
|
||||
if not np.issubdtype(type(x), np.floating):
|
||||
return str(x)
|
||||
|
||||
|
||||
@@ -2,10 +2,12 @@ from collections.abc import Callable, Iterable, Sequence
|
||||
from typing import (
|
||||
Final,
|
||||
Literal,
|
||||
Protocol,
|
||||
SupportsIndex,
|
||||
TypeAlias,
|
||||
TypeVar,
|
||||
overload,
|
||||
type_check_only,
|
||||
)
|
||||
|
||||
import numpy as np
|
||||
@@ -13,6 +15,7 @@ import numpy.typing as npt
|
||||
from numpy._typing import (
|
||||
_ArrayLikeComplex_co,
|
||||
_ArrayLikeFloat_co,
|
||||
_ArrayLikeObject_co,
|
||||
_FloatLike_co,
|
||||
_NumberLike_co,
|
||||
)
|
||||
@@ -29,210 +32,112 @@ from ._polytypes import (
|
||||
_FloatArray,
|
||||
_FloatSeries,
|
||||
_FuncBinOp,
|
||||
_FuncValND,
|
||||
_FuncVanderND,
|
||||
_ObjectArray,
|
||||
_ObjectSeries,
|
||||
_SeriesLikeCoef_co,
|
||||
_SeriesLikeComplex_co,
|
||||
_SeriesLikeFloat_co,
|
||||
_SeriesLikeInt_co,
|
||||
_SeriesLikeObject_co,
|
||||
_Tuple2,
|
||||
)
|
||||
|
||||
__all__: Final[Sequence[str]] = [
|
||||
"as_series",
|
||||
"format_float",
|
||||
"getdomain",
|
||||
"mapdomain",
|
||||
"mapparms",
|
||||
"trimcoef",
|
||||
"trimseq",
|
||||
]
|
||||
__all__ = ["as_series", "format_float", "getdomain", "mapdomain", "mapparms", "trimcoef", "trimseq"]
|
||||
|
||||
_AnyLineF: TypeAlias = Callable[
|
||||
[_CoefLike_co, _CoefLike_co],
|
||||
_CoefArray,
|
||||
]
|
||||
_AnyMulF: TypeAlias = Callable[
|
||||
[npt.ArrayLike, npt.ArrayLike],
|
||||
_CoefArray,
|
||||
]
|
||||
_AnyVanderF: TypeAlias = Callable[
|
||||
[npt.ArrayLike, SupportsIndex],
|
||||
_CoefArray,
|
||||
]
|
||||
_T = TypeVar("_T")
|
||||
_SeqT = TypeVar("_SeqT", bound=_CoefArray | Sequence[_CoefLike_co])
|
||||
|
||||
_AnyLineF: TypeAlias = Callable[[float, float], _CoefArray]
|
||||
_AnyMulF: TypeAlias = Callable[[np.ndarray | list[int], np.ndarray], _CoefArray]
|
||||
_AnyVanderF: TypeAlias = Callable[[np.ndarray, int], _CoefArray]
|
||||
|
||||
@type_check_only
|
||||
class _ValFunc(Protocol[_T]):
|
||||
def __call__(self, x: np.ndarray, c: _T, /, *, tensor: bool = True) -> _T: ...
|
||||
|
||||
###
|
||||
|
||||
@overload
|
||||
def as_series(
|
||||
alist: npt.NDArray[np.integer] | _FloatArray,
|
||||
trim: bool = ...,
|
||||
) -> list[_FloatSeries]: ...
|
||||
def as_series(alist: npt.NDArray[np.integer] | _FloatArray, trim: bool = True) -> list[_FloatSeries]: ...
|
||||
@overload
|
||||
def as_series(
|
||||
alist: _ComplexArray,
|
||||
trim: bool = ...,
|
||||
) -> list[_ComplexSeries]: ...
|
||||
def as_series(alist: _ComplexArray, trim: bool = True) -> list[_ComplexSeries]: ...
|
||||
@overload
|
||||
def as_series(
|
||||
alist: _ObjectArray,
|
||||
trim: bool = ...,
|
||||
) -> list[_ObjectSeries]: ...
|
||||
def as_series(alist: _ObjectArray, trim: bool = True) -> list[_ObjectSeries]: ...
|
||||
@overload
|
||||
def as_series( # type: ignore[overload-overlap]
|
||||
alist: Iterable[_FloatArray | npt.NDArray[np.integer]],
|
||||
trim: bool = ...,
|
||||
) -> list[_FloatSeries]: ...
|
||||
def as_series(alist: Iterable[_FloatArray | npt.NDArray[np.integer]], trim: bool = True) -> list[_FloatSeries]: ...
|
||||
@overload
|
||||
def as_series(
|
||||
alist: Iterable[_ComplexArray],
|
||||
trim: bool = ...,
|
||||
) -> list[_ComplexSeries]: ...
|
||||
def as_series(alist: Iterable[_ComplexArray], trim: bool = True) -> list[_ComplexSeries]: ...
|
||||
@overload
|
||||
def as_series(
|
||||
alist: Iterable[_ObjectArray],
|
||||
trim: bool = ...,
|
||||
) -> list[_ObjectSeries]: ...
|
||||
def as_series(alist: Iterable[_ObjectArray], trim: bool = True) -> list[_ObjectSeries]: ...
|
||||
@overload
|
||||
def as_series( # type: ignore[overload-overlap]
|
||||
alist: Iterable[_SeriesLikeFloat_co | float],
|
||||
trim: bool = ...,
|
||||
) -> list[_FloatSeries]: ...
|
||||
def as_series(alist: Iterable[_SeriesLikeFloat_co | float], trim: bool = True) -> list[_FloatSeries]: ...
|
||||
@overload
|
||||
def as_series(
|
||||
alist: Iterable[_SeriesLikeComplex_co | complex],
|
||||
trim: bool = ...,
|
||||
) -> list[_ComplexSeries]: ...
|
||||
def as_series(alist: Iterable[_SeriesLikeComplex_co | complex], trim: bool = True) -> list[_ComplexSeries]: ...
|
||||
@overload
|
||||
def as_series(
|
||||
alist: Iterable[_SeriesLikeCoef_co | object],
|
||||
trim: bool = ...,
|
||||
) -> list[_ObjectSeries]: ...
|
||||
def as_series(alist: Iterable[_SeriesLikeCoef_co | object], trim: bool = True) -> list[_ObjectSeries]: ...
|
||||
|
||||
_T_seq = TypeVar("_T_seq", bound=_CoefArray | Sequence[_CoefLike_co])
|
||||
def trimseq(seq: _T_seq) -> _T_seq: ...
|
||||
#
|
||||
def trimseq(seq: _SeqT) -> _SeqT: ...
|
||||
|
||||
#
|
||||
@overload
|
||||
def trimcoef( # type: ignore[overload-overlap]
|
||||
c: npt.NDArray[np.integer] | _FloatArray,
|
||||
tol: _FloatLike_co = ...,
|
||||
) -> _FloatSeries: ...
|
||||
def trimcoef(c: npt.NDArray[np.integer] | _FloatArray, tol: _FloatLike_co = 0) -> _FloatSeries: ...
|
||||
@overload
|
||||
def trimcoef(
|
||||
c: _ComplexArray,
|
||||
tol: _FloatLike_co = ...,
|
||||
) -> _ComplexSeries: ...
|
||||
def trimcoef(c: _ComplexArray, tol: _FloatLike_co = 0) -> _ComplexSeries: ...
|
||||
@overload
|
||||
def trimcoef(
|
||||
c: _ObjectArray,
|
||||
tol: _FloatLike_co = ...,
|
||||
) -> _ObjectSeries: ...
|
||||
def trimcoef(c: _ObjectArray, tol: _FloatLike_co = 0) -> _ObjectSeries: ...
|
||||
@overload
|
||||
def trimcoef( # type: ignore[overload-overlap]
|
||||
c: _SeriesLikeFloat_co | float,
|
||||
tol: _FloatLike_co = ...,
|
||||
) -> _FloatSeries: ...
|
||||
def trimcoef(c: _SeriesLikeFloat_co | float, tol: _FloatLike_co = 0) -> _FloatSeries: ...
|
||||
@overload
|
||||
def trimcoef(
|
||||
c: _SeriesLikeComplex_co | complex,
|
||||
tol: _FloatLike_co = ...,
|
||||
) -> _ComplexSeries: ...
|
||||
def trimcoef(c: _SeriesLikeComplex_co | complex, tol: _FloatLike_co = 0) -> _ComplexSeries: ...
|
||||
@overload
|
||||
def trimcoef(
|
||||
c: _SeriesLikeCoef_co | object,
|
||||
tol: _FloatLike_co = ...,
|
||||
) -> _ObjectSeries: ...
|
||||
def trimcoef(c: _SeriesLikeCoef_co | object, tol: _FloatLike_co = 0) -> _ObjectSeries: ...
|
||||
|
||||
#
|
||||
@overload
|
||||
def getdomain( # type: ignore[overload-overlap]
|
||||
x: _FloatArray | npt.NDArray[np.integer],
|
||||
) -> _Array2[np.float64]: ...
|
||||
def getdomain(x: _FloatArray | npt.NDArray[np.integer]) -> _Array2[np.float64]: ...
|
||||
@overload
|
||||
def getdomain(
|
||||
x: _ComplexArray,
|
||||
) -> _Array2[np.complex128]: ...
|
||||
def getdomain(x: _ComplexArray) -> _Array2[np.complex128]: ...
|
||||
@overload
|
||||
def getdomain(
|
||||
x: _ObjectArray,
|
||||
) -> _Array2[np.object_]: ...
|
||||
def getdomain(x: _ObjectArray) -> _Array2[np.object_]: ...
|
||||
@overload
|
||||
def getdomain( # type: ignore[overload-overlap]
|
||||
x: _SeriesLikeFloat_co | float,
|
||||
) -> _Array2[np.float64]: ...
|
||||
def getdomain(x: _SeriesLikeFloat_co | float) -> _Array2[np.float64]: ...
|
||||
@overload
|
||||
def getdomain(
|
||||
x: _SeriesLikeComplex_co | complex,
|
||||
) -> _Array2[np.complex128]: ...
|
||||
def getdomain(x: _SeriesLikeComplex_co | complex) -> _Array2[np.complex128]: ...
|
||||
@overload
|
||||
def getdomain(
|
||||
x: _SeriesLikeCoef_co | object,
|
||||
) -> _Array2[np.object_]: ...
|
||||
def getdomain(x: _SeriesLikeCoef_co | object) -> _Array2[np.object_]: ...
|
||||
|
||||
#
|
||||
@overload
|
||||
def mapparms( # type: ignore[overload-overlap]
|
||||
old: npt.NDArray[np.floating | np.integer],
|
||||
new: npt.NDArray[np.floating | np.integer],
|
||||
) -> _Tuple2[np.floating]: ...
|
||||
def mapparms(old: npt.NDArray[np.floating | np.integer], new: npt.NDArray[np.floating | np.integer]) -> _Tuple2[np.floating]: ...
|
||||
@overload
|
||||
def mapparms(
|
||||
old: npt.NDArray[np.number],
|
||||
new: npt.NDArray[np.number],
|
||||
) -> _Tuple2[np.complexfloating]: ...
|
||||
def mapparms(old: npt.NDArray[np.number], new: npt.NDArray[np.number]) -> _Tuple2[np.complexfloating]: ...
|
||||
@overload
|
||||
def mapparms(
|
||||
old: npt.NDArray[np.object_ | np.number],
|
||||
new: npt.NDArray[np.object_ | np.number],
|
||||
) -> _Tuple2[object]: ...
|
||||
def mapparms(old: npt.NDArray[np.object_ | np.number], new: npt.NDArray[np.object_ | np.number]) -> _Tuple2[object]: ...
|
||||
@overload
|
||||
def mapparms( # type: ignore[overload-overlap]
|
||||
old: Sequence[float],
|
||||
new: Sequence[float],
|
||||
) -> _Tuple2[float]: ...
|
||||
def mapparms(old: Sequence[float], new: Sequence[float]) -> _Tuple2[float]: ...
|
||||
@overload
|
||||
def mapparms(
|
||||
old: Sequence[complex],
|
||||
new: Sequence[complex],
|
||||
) -> _Tuple2[complex]: ...
|
||||
def mapparms(old: Sequence[complex], new: Sequence[complex]) -> _Tuple2[complex]: ...
|
||||
@overload
|
||||
def mapparms(
|
||||
old: _SeriesLikeFloat_co,
|
||||
new: _SeriesLikeFloat_co,
|
||||
) -> _Tuple2[np.floating]: ...
|
||||
def mapparms(old: _SeriesLikeFloat_co, new: _SeriesLikeFloat_co) -> _Tuple2[np.floating]: ...
|
||||
@overload
|
||||
def mapparms(
|
||||
old: _SeriesLikeComplex_co,
|
||||
new: _SeriesLikeComplex_co,
|
||||
) -> _Tuple2[np.complexfloating]: ...
|
||||
def mapparms(old: _SeriesLikeComplex_co, new: _SeriesLikeComplex_co) -> _Tuple2[np.complexfloating]: ...
|
||||
@overload
|
||||
def mapparms(
|
||||
old: _SeriesLikeCoef_co,
|
||||
new: _SeriesLikeCoef_co,
|
||||
) -> _Tuple2[object]: ...
|
||||
def mapparms(old: _SeriesLikeCoef_co, new: _SeriesLikeCoef_co) -> _Tuple2[object]: ...
|
||||
|
||||
#
|
||||
@overload
|
||||
def mapdomain( # type: ignore[overload-overlap]
|
||||
x: _FloatLike_co,
|
||||
old: _SeriesLikeFloat_co,
|
||||
new: _SeriesLikeFloat_co,
|
||||
) -> np.floating: ...
|
||||
def mapdomain(x: _FloatLike_co, old: _SeriesLikeFloat_co, new: _SeriesLikeFloat_co) -> np.floating: ...
|
||||
@overload
|
||||
def mapdomain(x: _NumberLike_co, old: _SeriesLikeComplex_co, new: _SeriesLikeComplex_co) -> np.complexfloating: ...
|
||||
@overload
|
||||
def mapdomain(
|
||||
x: _NumberLike_co,
|
||||
old: _SeriesLikeComplex_co,
|
||||
new: _SeriesLikeComplex_co,
|
||||
) -> np.complexfloating: ...
|
||||
@overload
|
||||
def mapdomain( # type: ignore[overload-overlap]
|
||||
x: npt.NDArray[np.floating | np.integer],
|
||||
old: npt.NDArray[np.floating | np.integer],
|
||||
new: npt.NDArray[np.floating | np.integer],
|
||||
) -> _FloatSeries: ...
|
||||
@overload
|
||||
def mapdomain(
|
||||
x: npt.NDArray[np.number],
|
||||
old: npt.NDArray[np.number],
|
||||
new: npt.NDArray[np.number],
|
||||
) -> _ComplexSeries: ...
|
||||
def mapdomain(x: npt.NDArray[np.number], old: npt.NDArray[np.number], new: npt.NDArray[np.number]) -> _ComplexSeries: ...
|
||||
@overload
|
||||
def mapdomain(
|
||||
x: npt.NDArray[np.object_ | np.number],
|
||||
@@ -240,137 +145,118 @@ def mapdomain(
|
||||
new: npt.NDArray[np.object_ | np.number],
|
||||
) -> _ObjectSeries: ...
|
||||
@overload
|
||||
def mapdomain( # type: ignore[overload-overlap]
|
||||
x: _SeriesLikeFloat_co,
|
||||
old: _SeriesLikeFloat_co,
|
||||
new: _SeriesLikeFloat_co,
|
||||
) -> _FloatSeries: ...
|
||||
def mapdomain(x: _SeriesLikeFloat_co, old: _SeriesLikeFloat_co, new: _SeriesLikeFloat_co) -> _FloatSeries: ...
|
||||
@overload
|
||||
def mapdomain(
|
||||
x: _SeriesLikeComplex_co,
|
||||
old: _SeriesLikeComplex_co,
|
||||
new: _SeriesLikeComplex_co,
|
||||
) -> _ComplexSeries: ...
|
||||
def mapdomain(x: _SeriesLikeComplex_co, old: _SeriesLikeComplex_co, new: _SeriesLikeComplex_co) -> _ComplexSeries: ...
|
||||
@overload
|
||||
def mapdomain(
|
||||
x: _SeriesLikeCoef_co,
|
||||
old: _SeriesLikeCoef_co,
|
||||
new: _SeriesLikeCoef_co,
|
||||
) -> _ObjectSeries: ...
|
||||
def mapdomain(x: _SeriesLikeCoef_co, old: _SeriesLikeCoef_co, new: _SeriesLikeCoef_co) -> _ObjectSeries: ...
|
||||
@overload
|
||||
def mapdomain(
|
||||
x: _CoefLike_co,
|
||||
old: _SeriesLikeCoef_co,
|
||||
new: _SeriesLikeCoef_co,
|
||||
) -> object: ...
|
||||
def mapdomain(x: _CoefLike_co, old: _SeriesLikeCoef_co, new: _SeriesLikeCoef_co) -> object: ...
|
||||
|
||||
def _nth_slice(
|
||||
i: SupportsIndex,
|
||||
ndim: SupportsIndex,
|
||||
) -> tuple[slice | None, ...]: ...
|
||||
#
|
||||
def _nth_slice(i: SupportsIndex, ndim: SupportsIndex) -> tuple[slice | None, ...]: ...
|
||||
|
||||
_vander_nd: _FuncVanderND[Literal["_vander_nd"]]
|
||||
_vander_nd_flat: _FuncVanderND[Literal["_vander_nd_flat"]]
|
||||
# keep in sync with `vander_nd_flat`
|
||||
@overload
|
||||
def _vander_nd(
|
||||
vander_fs: Sequence[_AnyVanderF],
|
||||
points: Sequence[_ArrayLikeFloat_co],
|
||||
degrees: Sequence[SupportsIndex],
|
||||
) -> _FloatArray: ...
|
||||
@overload
|
||||
def _vander_nd(
|
||||
vander_fs: Sequence[_AnyVanderF],
|
||||
points: Sequence[_ArrayLikeComplex_co],
|
||||
degrees: Sequence[SupportsIndex],
|
||||
) -> _ComplexArray: ...
|
||||
@overload
|
||||
def _vander_nd(
|
||||
vander_fs: Sequence[_AnyVanderF],
|
||||
points: Sequence[_ArrayLikeObject_co | _ArrayLikeComplex_co],
|
||||
degrees: Sequence[SupportsIndex],
|
||||
) -> _ObjectArray: ...
|
||||
@overload
|
||||
def _vander_nd(
|
||||
vander_fs: Sequence[_AnyVanderF],
|
||||
points: Sequence[npt.ArrayLike],
|
||||
degrees: Sequence[SupportsIndex],
|
||||
) -> _CoefArray: ...
|
||||
|
||||
# keep in sync with `vander_nd`
|
||||
@overload
|
||||
def _vander_nd_flat(
|
||||
vander_fs: Sequence[_AnyVanderF],
|
||||
points: Sequence[_ArrayLikeFloat_co],
|
||||
degrees: Sequence[SupportsIndex],
|
||||
) -> _FloatArray: ...
|
||||
@overload
|
||||
def _vander_nd_flat(
|
||||
vander_fs: Sequence[_AnyVanderF],
|
||||
points: Sequence[_ArrayLikeComplex_co],
|
||||
degrees: Sequence[SupportsIndex],
|
||||
) -> _ComplexArray: ...
|
||||
@overload
|
||||
def _vander_nd_flat(
|
||||
vander_fs: Sequence[_AnyVanderF],
|
||||
points: Sequence[_ArrayLikeObject_co | _ArrayLikeComplex_co],
|
||||
degrees: Sequence[SupportsIndex],
|
||||
) -> _ObjectArray: ...
|
||||
@overload
|
||||
def _vander_nd_flat(
|
||||
vander_fs: Sequence[_AnyVanderF],
|
||||
points: Sequence[npt.ArrayLike],
|
||||
degrees: Sequence[SupportsIndex],
|
||||
) -> _CoefArray: ...
|
||||
|
||||
# keep in sync with `._polytypes._FuncFromRoots`
|
||||
@overload
|
||||
def _fromroots( # type: ignore[overload-overlap]
|
||||
line_f: _AnyLineF,
|
||||
mul_f: _AnyMulF,
|
||||
roots: _SeriesLikeFloat_co,
|
||||
) -> _FloatSeries: ...
|
||||
def _fromroots(line_f: _AnyLineF, mul_f: _AnyMulF, roots: _SeriesLikeFloat_co) -> _FloatSeries: ...
|
||||
@overload
|
||||
def _fromroots(
|
||||
line_f: _AnyLineF,
|
||||
mul_f: _AnyMulF,
|
||||
roots: _SeriesLikeComplex_co,
|
||||
) -> _ComplexSeries: ...
|
||||
def _fromroots(line_f: _AnyLineF, mul_f: _AnyMulF, roots: _SeriesLikeComplex_co) -> _ComplexSeries: ...
|
||||
@overload
|
||||
def _fromroots(
|
||||
line_f: _AnyLineF,
|
||||
mul_f: _AnyMulF,
|
||||
roots: _SeriesLikeCoef_co,
|
||||
) -> _ObjectSeries: ...
|
||||
def _fromroots(line_f: _AnyLineF, mul_f: _AnyMulF, roots: _SeriesLikeObject_co) -> _ObjectSeries: ...
|
||||
@overload
|
||||
def _fromroots(
|
||||
line_f: _AnyLineF,
|
||||
mul_f: _AnyMulF,
|
||||
roots: _SeriesLikeCoef_co,
|
||||
) -> _CoefSeries: ...
|
||||
def _fromroots(line_f: _AnyLineF, mul_f: _AnyMulF, roots: _SeriesLikeCoef_co) -> _CoefSeries: ...
|
||||
|
||||
_valnd: _FuncValND[Literal["_valnd"]]
|
||||
_gridnd: _FuncValND[Literal["_gridnd"]]
|
||||
# keep in sync with `_gridnd`
|
||||
def _valnd(val_f: _ValFunc[_T], c: _T, *args: npt.ArrayLike) -> _T: ...
|
||||
|
||||
# keep in sync with `_valnd`
|
||||
def _gridnd(val_f: _ValFunc[_T], c: _T, *args: npt.ArrayLike) -> _T: ...
|
||||
|
||||
# keep in sync with `_polytypes._FuncBinOp`
|
||||
@overload
|
||||
def _div( # type: ignore[overload-overlap]
|
||||
mul_f: _AnyMulF,
|
||||
c1: _SeriesLikeFloat_co,
|
||||
c2: _SeriesLikeFloat_co,
|
||||
) -> _Tuple2[_FloatSeries]: ...
|
||||
def _div(mul_f: _AnyMulF, c1: _SeriesLikeFloat_co, c2: _SeriesLikeFloat_co) -> _Tuple2[_FloatSeries]: ...
|
||||
@overload
|
||||
def _div(
|
||||
mul_f: _AnyMulF,
|
||||
c1: _SeriesLikeComplex_co,
|
||||
c2: _SeriesLikeComplex_co,
|
||||
) -> _Tuple2[_ComplexSeries]: ...
|
||||
def _div(mul_f: _AnyMulF, c1: _SeriesLikeComplex_co, c2: _SeriesLikeComplex_co) -> _Tuple2[_ComplexSeries]: ...
|
||||
@overload
|
||||
def _div(
|
||||
mul_f: _AnyMulF,
|
||||
c1: _SeriesLikeCoef_co,
|
||||
c2: _SeriesLikeCoef_co,
|
||||
) -> _Tuple2[_ObjectSeries]: ...
|
||||
def _div(mul_f: _AnyMulF, c1: _SeriesLikeObject_co, c2: _SeriesLikeObject_co) -> _Tuple2[_ObjectSeries]: ...
|
||||
@overload
|
||||
def _div(
|
||||
mul_f: _AnyMulF,
|
||||
c1: _SeriesLikeCoef_co,
|
||||
c2: _SeriesLikeCoef_co,
|
||||
) -> _Tuple2[_CoefSeries]: ...
|
||||
def _div(mul_f: _AnyMulF, c1: _SeriesLikeCoef_co, c2: _SeriesLikeCoef_co) -> _Tuple2[_CoefSeries]: ...
|
||||
|
||||
_add: Final[_FuncBinOp]
|
||||
_sub: Final[_FuncBinOp]
|
||||
_add: Final[_FuncBinOp] = ...
|
||||
_sub: Final[_FuncBinOp] = ...
|
||||
|
||||
# keep in sync with `_polytypes._FuncPow`
|
||||
@overload
|
||||
def _pow( # type: ignore[overload-overlap]
|
||||
mul_f: _AnyMulF,
|
||||
c: _SeriesLikeFloat_co,
|
||||
pow: _AnyInt,
|
||||
maxpower: _AnyInt | None = ...,
|
||||
) -> _FloatSeries: ...
|
||||
def _pow(mul_f: _AnyMulF, c: _SeriesLikeFloat_co, pow: _AnyInt, maxpower: _AnyInt | None) -> _FloatSeries: ...
|
||||
@overload
|
||||
def _pow(
|
||||
mul_f: _AnyMulF,
|
||||
c: _SeriesLikeComplex_co,
|
||||
pow: _AnyInt,
|
||||
maxpower: _AnyInt | None = ...,
|
||||
) -> _ComplexSeries: ...
|
||||
def _pow(mul_f: _AnyMulF, c: _SeriesLikeComplex_co, pow: _AnyInt, maxpower: _AnyInt | None) -> _ComplexSeries: ...
|
||||
@overload
|
||||
def _pow(
|
||||
mul_f: _AnyMulF,
|
||||
c: _SeriesLikeCoef_co,
|
||||
pow: _AnyInt,
|
||||
maxpower: _AnyInt | None = ...,
|
||||
) -> _ObjectSeries: ...
|
||||
def _pow(mul_f: _AnyMulF, c: _SeriesLikeObject_co, pow: _AnyInt, maxpower: _AnyInt | None) -> _ObjectSeries: ...
|
||||
@overload
|
||||
def _pow(
|
||||
mul_f: _AnyMulF,
|
||||
c: _SeriesLikeCoef_co,
|
||||
pow: _AnyInt,
|
||||
maxpower: _AnyInt | None = ...,
|
||||
) -> _CoefSeries: ...
|
||||
def _pow(mul_f: _AnyMulF, c: _SeriesLikeCoef_co, pow: _AnyInt, maxpower: _AnyInt | None) -> _CoefSeries: ...
|
||||
|
||||
# keep in sync with `_polytypes._FuncFit`
|
||||
@overload
|
||||
def _fit( # type: ignore[overload-overlap]
|
||||
def _fit(
|
||||
vander_f: _AnyVanderF,
|
||||
x: _SeriesLikeFloat_co,
|
||||
y: _ArrayLikeFloat_co,
|
||||
deg: _SeriesLikeInt_co,
|
||||
domain: _SeriesLikeFloat_co | None = ...,
|
||||
rcond: _FloatLike_co | None = ...,
|
||||
full: Literal[False] = ...,
|
||||
w: _SeriesLikeFloat_co | None = ...,
|
||||
rcond: _FloatLike_co | None = None,
|
||||
full: Literal[False] = False,
|
||||
w: _SeriesLikeFloat_co | None = None,
|
||||
) -> _FloatArray: ...
|
||||
@overload
|
||||
def _fit(
|
||||
@@ -378,10 +264,9 @@ def _fit(
|
||||
x: _SeriesLikeComplex_co,
|
||||
y: _ArrayLikeComplex_co,
|
||||
deg: _SeriesLikeInt_co,
|
||||
domain: _SeriesLikeComplex_co | None = ...,
|
||||
rcond: _FloatLike_co | None = ...,
|
||||
full: Literal[False] = ...,
|
||||
w: _SeriesLikeComplex_co | None = ...,
|
||||
rcond: _FloatLike_co | None = None,
|
||||
full: Literal[False] = False,
|
||||
w: _SeriesLikeComplex_co | None = None,
|
||||
) -> _ComplexArray: ...
|
||||
@overload
|
||||
def _fit(
|
||||
@@ -389,10 +274,9 @@ def _fit(
|
||||
x: _SeriesLikeCoef_co,
|
||||
y: _ArrayLikeCoef_co,
|
||||
deg: _SeriesLikeInt_co,
|
||||
domain: _SeriesLikeCoef_co | None = ...,
|
||||
rcond: _FloatLike_co | None = ...,
|
||||
full: Literal[False] = ...,
|
||||
w: _SeriesLikeCoef_co | None = ...,
|
||||
rcond: _FloatLike_co | None = None,
|
||||
full: Literal[False] = False,
|
||||
w: _SeriesLikeCoef_co | None = None,
|
||||
) -> _CoefArray: ...
|
||||
@overload
|
||||
def _fit(
|
||||
@@ -400,11 +284,9 @@ def _fit(
|
||||
x: _SeriesLikeCoef_co,
|
||||
y: _SeriesLikeCoef_co,
|
||||
deg: _SeriesLikeInt_co,
|
||||
domain: _SeriesLikeCoef_co | None,
|
||||
rcond: _FloatLike_co | None,
|
||||
full: Literal[True],
|
||||
/,
|
||||
w: _SeriesLikeCoef_co | None = ...,
|
||||
w: _SeriesLikeCoef_co | None = None,
|
||||
) -> tuple[_CoefSeries, Sequence[np.inexact | np.int32]]: ...
|
||||
@overload
|
||||
def _fit(
|
||||
@@ -412,12 +294,14 @@ def _fit(
|
||||
x: _SeriesLikeCoef_co,
|
||||
y: _SeriesLikeCoef_co,
|
||||
deg: _SeriesLikeInt_co,
|
||||
domain: _SeriesLikeCoef_co | None = ...,
|
||||
rcond: _FloatLike_co | None = ...,
|
||||
rcond: _FloatLike_co | None = None,
|
||||
*,
|
||||
full: Literal[True],
|
||||
w: _SeriesLikeCoef_co | None = ...,
|
||||
w: _SeriesLikeCoef_co | None = None,
|
||||
) -> tuple[_CoefSeries, Sequence[np.inexact | np.int32]]: ...
|
||||
|
||||
#
|
||||
def _as_int(x: SupportsIndex, desc: str) -> int: ...
|
||||
def format_float(x: _FloatLike_co, parens: bool = ...) -> str: ...
|
||||
|
||||
#
|
||||
def format_float(x: _FloatLike_co, parens: bool = False) -> str: ...
|
||||
|
||||
@@ -6,12 +6,7 @@ from functools import reduce
|
||||
import numpy as np
|
||||
import numpy.polynomial.chebyshev as cheb
|
||||
from numpy.polynomial.polynomial import polyval
|
||||
from numpy.testing import (
|
||||
assert_,
|
||||
assert_almost_equal,
|
||||
assert_equal,
|
||||
assert_raises,
|
||||
)
|
||||
from numpy.testing import assert_, assert_almost_equal, assert_equal, assert_raises
|
||||
|
||||
|
||||
def trim(x):
|
||||
|
||||
@@ -18,12 +18,7 @@ from numpy.polynomial import (
|
||||
Legendre,
|
||||
Polynomial,
|
||||
)
|
||||
from numpy.testing import (
|
||||
assert_,
|
||||
assert_almost_equal,
|
||||
assert_equal,
|
||||
assert_raises,
|
||||
)
|
||||
from numpy.testing import assert_, assert_almost_equal, assert_equal, assert_raises
|
||||
|
||||
#
|
||||
# fixtures
|
||||
|
||||
@@ -6,12 +6,7 @@ from functools import reduce
|
||||
import numpy as np
|
||||
import numpy.polynomial.hermite as herm
|
||||
from numpy.polynomial.polynomial import polyval
|
||||
from numpy.testing import (
|
||||
assert_,
|
||||
assert_almost_equal,
|
||||
assert_equal,
|
||||
assert_raises,
|
||||
)
|
||||
from numpy.testing import assert_, assert_almost_equal, assert_equal, assert_raises
|
||||
|
||||
H0 = np.array([1])
|
||||
H1 = np.array([0, 2])
|
||||
|
||||
@@ -6,12 +6,7 @@ from functools import reduce
|
||||
import numpy as np
|
||||
import numpy.polynomial.hermite_e as herme
|
||||
from numpy.polynomial.polynomial import polyval
|
||||
from numpy.testing import (
|
||||
assert_,
|
||||
assert_almost_equal,
|
||||
assert_equal,
|
||||
assert_raises,
|
||||
)
|
||||
from numpy.testing import assert_, assert_almost_equal, assert_equal, assert_raises
|
||||
|
||||
He0 = np.array([1])
|
||||
He1 = np.array([0, 1])
|
||||
|
||||
@@ -6,12 +6,7 @@ from functools import reduce
|
||||
import numpy as np
|
||||
import numpy.polynomial.laguerre as lag
|
||||
from numpy.polynomial.polynomial import polyval
|
||||
from numpy.testing import (
|
||||
assert_,
|
||||
assert_almost_equal,
|
||||
assert_equal,
|
||||
assert_raises,
|
||||
)
|
||||
from numpy.testing import assert_, assert_almost_equal, assert_equal, assert_raises
|
||||
|
||||
L0 = np.array([1]) / 1
|
||||
L1 = np.array([1, -1]) / 1
|
||||
|
||||
@@ -6,12 +6,7 @@ from functools import reduce
|
||||
import numpy as np
|
||||
import numpy.polynomial.legendre as leg
|
||||
from numpy.polynomial.polynomial import polyval
|
||||
from numpy.testing import (
|
||||
assert_,
|
||||
assert_almost_equal,
|
||||
assert_equal,
|
||||
assert_raises,
|
||||
)
|
||||
from numpy.testing import assert_, assert_almost_equal, assert_equal, assert_raises
|
||||
|
||||
L0 = np.array([1])
|
||||
L1 = np.array([0, 1])
|
||||
|
||||
@@ -6,9 +6,10 @@ from copy import deepcopy
|
||||
from fractions import Fraction
|
||||
from functools import reduce
|
||||
|
||||
import pytest
|
||||
|
||||
import numpy as np
|
||||
import numpy.polynomial.polynomial as poly
|
||||
import numpy.polynomial.polyutils as pu
|
||||
from numpy.testing import (
|
||||
assert_,
|
||||
assert_almost_equal,
|
||||
@@ -16,7 +17,6 @@ from numpy.testing import (
|
||||
assert_equal,
|
||||
assert_raises,
|
||||
assert_raises_regex,
|
||||
assert_warns,
|
||||
)
|
||||
|
||||
|
||||
@@ -656,7 +656,7 @@ class TestMisc:
|
||||
assert_equal(p.coef, [2.])
|
||||
p = poly.Polynomial.fit([1, 1], [2, 2.1], deg=0)
|
||||
assert_almost_equal(p.coef, [2.05])
|
||||
with assert_warns(pu.RankWarning):
|
||||
with pytest.warns(np.exceptions.RankWarning):
|
||||
p = poly.Polynomial.fit([1, 1], [2, 2.1], deg=1)
|
||||
|
||||
def test_result_type(self):
|
||||
@@ -667,3 +667,25 @@ class TestMisc:
|
||||
|
||||
arr = np.polydiv(1, np.float32(1))
|
||||
assert_equal(arr[0].dtype, np.float64)
|
||||
|
||||
class ArrayFunctionInterceptor:
|
||||
def __init__(self):
|
||||
self.called = False
|
||||
|
||||
def __array_function__(self, func, types, args, kwargs):
|
||||
self.called = True
|
||||
return "intercepted"
|
||||
|
||||
def test_polyval2d_array_function_hook():
|
||||
x = ArrayFunctionInterceptor()
|
||||
y = ArrayFunctionInterceptor()
|
||||
c = ArrayFunctionInterceptor()
|
||||
result = np.polynomial.polynomial.polyval2d(x, y, c)
|
||||
assert result == "intercepted"
|
||||
|
||||
def test_polygrid2d_array_function_hook():
|
||||
x = ArrayFunctionInterceptor()
|
||||
y = ArrayFunctionInterceptor()
|
||||
c = ArrayFunctionInterceptor()
|
||||
result = np.polynomial.polynomial.polygrid2d(x, y, c)
|
||||
assert result == "intercepted"
|
||||
|
||||
@@ -3,12 +3,7 @@
|
||||
"""
|
||||
import numpy as np
|
||||
import numpy.polynomial.polyutils as pu
|
||||
from numpy.testing import (
|
||||
assert_,
|
||||
assert_almost_equal,
|
||||
assert_equal,
|
||||
assert_raises,
|
||||
)
|
||||
from numpy.testing import assert_, assert_almost_equal, assert_equal, assert_raises
|
||||
|
||||
|
||||
class TestMisc:
|
||||
|
||||
@@ -246,6 +246,7 @@ class TestLinebreaking:
|
||||
assert_(len(line) < lw)
|
||||
|
||||
|
||||
@pytest.mark.thread_unsafe(reason="set_default_printstyle() is global state")
|
||||
def test_set_default_printoptions():
|
||||
p = poly.Polynomial([1, 2, 3])
|
||||
c = poly.Chebyshev([1, 2, 3])
|
||||
@@ -259,6 +260,7 @@ def test_set_default_printoptions():
|
||||
poly.set_default_printstyle('invalid_input')
|
||||
|
||||
|
||||
@pytest.mark.thread_unsafe(reason="set_default_printstyle() is global state")
|
||||
def test_complex_coefficients():
|
||||
"""Test both numpy and built-in complex."""
|
||||
coefs = [0 + 1j, 1 + 1j, -2 + 2j, 3 + 0j]
|
||||
|
||||
Reference in New Issue
Block a user