chebyshev.pyi 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. from collections.abc import Callable, Iterable
  2. from typing import Any, Concatenate, Final, Self, TypeVar, overload
  3. from typing import Literal as L
  4. import numpy as np
  5. import numpy.typing as npt
  6. from numpy._typing import _IntLike_co
  7. from ._polybase import ABCPolyBase
  8. from ._polytypes import (
  9. _Array1,
  10. _Array2,
  11. _CoefSeries,
  12. _FuncBinOp,
  13. _FuncCompanion,
  14. _FuncDer,
  15. _FuncFit,
  16. _FuncFromRoots,
  17. _FuncGauss,
  18. _FuncInteg,
  19. _FuncLine,
  20. _FuncPoly2Ortho,
  21. _FuncPow,
  22. _FuncPts,
  23. _FuncRoots,
  24. _FuncUnOp,
  25. _FuncVal,
  26. _FuncVal2D,
  27. _FuncVal3D,
  28. _FuncValFromRoots,
  29. _FuncVander,
  30. _FuncVander2D,
  31. _FuncVander3D,
  32. _FuncWeight,
  33. _Series,
  34. _SeriesLikeCoef_co,
  35. )
  36. from .polyutils import trimcoef as chebtrim
  37. __all__ = [
  38. "chebzero",
  39. "chebone",
  40. "chebx",
  41. "chebdomain",
  42. "chebline",
  43. "chebadd",
  44. "chebsub",
  45. "chebmulx",
  46. "chebmul",
  47. "chebdiv",
  48. "chebpow",
  49. "chebval",
  50. "chebder",
  51. "chebint",
  52. "cheb2poly",
  53. "poly2cheb",
  54. "chebfromroots",
  55. "chebvander",
  56. "chebfit",
  57. "chebtrim",
  58. "chebroots",
  59. "chebpts1",
  60. "chebpts2",
  61. "Chebyshev",
  62. "chebval2d",
  63. "chebval3d",
  64. "chebgrid2d",
  65. "chebgrid3d",
  66. "chebvander2d",
  67. "chebvander3d",
  68. "chebcompanion",
  69. "chebgauss",
  70. "chebweight",
  71. "chebinterpolate",
  72. ]
  73. _NumberOrObjectT = TypeVar("_NumberOrObjectT", bound=np.number | np.object_)
  74. def _cseries_to_zseries(c: npt.NDArray[_NumberOrObjectT]) -> _Series[_NumberOrObjectT]: ...
  75. def _zseries_to_cseries(zs: npt.NDArray[_NumberOrObjectT]) -> _Series[_NumberOrObjectT]: ...
  76. def _zseries_mul(
  77. z1: npt.NDArray[_NumberOrObjectT],
  78. z2: npt.NDArray[_NumberOrObjectT],
  79. ) -> _Series[_NumberOrObjectT]: ...
  80. def _zseries_div(
  81. z1: npt.NDArray[_NumberOrObjectT],
  82. z2: npt.NDArray[_NumberOrObjectT],
  83. ) -> _Series[_NumberOrObjectT]: ...
  84. def _zseries_der(zs: npt.NDArray[_NumberOrObjectT]) -> _Series[_NumberOrObjectT]: ...
  85. def _zseries_int(zs: npt.NDArray[_NumberOrObjectT]) -> _Series[_NumberOrObjectT]: ...
  86. poly2cheb: _FuncPoly2Ortho[L["poly2cheb"]]
  87. cheb2poly: _FuncUnOp[L["cheb2poly"]]
  88. chebdomain: Final[_Array2[np.float64]]
  89. chebzero: Final[_Array1[np.int_]]
  90. chebone: Final[_Array1[np.int_]]
  91. chebx: Final[_Array2[np.int_]]
  92. chebline: _FuncLine[L["chebline"]]
  93. chebfromroots: _FuncFromRoots[L["chebfromroots"]]
  94. chebadd: _FuncBinOp[L["chebadd"]]
  95. chebsub: _FuncBinOp[L["chebsub"]]
  96. chebmulx: _FuncUnOp[L["chebmulx"]]
  97. chebmul: _FuncBinOp[L["chebmul"]]
  98. chebdiv: _FuncBinOp[L["chebdiv"]]
  99. chebpow: _FuncPow[L["chebpow"]]
  100. chebder: _FuncDer[L["chebder"]]
  101. chebint: _FuncInteg[L["chebint"]]
  102. chebval: _FuncVal[L["chebval"]]
  103. chebval2d: _FuncVal2D[L["chebval2d"]]
  104. chebval3d: _FuncVal3D[L["chebval3d"]]
  105. chebvalfromroots: _FuncValFromRoots[L["chebvalfromroots"]]
  106. chebgrid2d: _FuncVal2D[L["chebgrid2d"]]
  107. chebgrid3d: _FuncVal3D[L["chebgrid3d"]]
  108. chebvander: _FuncVander[L["chebvander"]]
  109. chebvander2d: _FuncVander2D[L["chebvander2d"]]
  110. chebvander3d: _FuncVander3D[L["chebvander3d"]]
  111. chebfit: _FuncFit[L["chebfit"]]
  112. chebcompanion: _FuncCompanion[L["chebcompanion"]]
  113. chebroots: _FuncRoots[L["chebroots"]]
  114. chebgauss: _FuncGauss[L["chebgauss"]]
  115. chebweight: _FuncWeight[L["chebweight"]]
  116. chebpts1: _FuncPts[L["chebpts1"]]
  117. chebpts2: _FuncPts[L["chebpts2"]]
  118. # keep in sync with `Chebyshev.interpolate`
  119. _RT = TypeVar("_RT", bound=np.number | np.bool | np.object_)
  120. @overload
  121. def chebinterpolate(
  122. func: np.ufunc,
  123. deg: _IntLike_co,
  124. args: tuple[()] = ...,
  125. ) -> npt.NDArray[np.float64 | np.complex128 | np.object_]: ...
  126. @overload
  127. def chebinterpolate(
  128. func: Callable[[npt.NDArray[np.float64]], _RT],
  129. deg: _IntLike_co,
  130. args: tuple[()] = ...,
  131. ) -> npt.NDArray[_RT]: ...
  132. @overload
  133. def chebinterpolate(
  134. func: Callable[Concatenate[npt.NDArray[np.float64], ...], _RT],
  135. deg: _IntLike_co,
  136. args: Iterable[Any],
  137. ) -> npt.NDArray[_RT]: ...
  138. class Chebyshev(ABCPolyBase[L["T"]]):
  139. @overload
  140. @classmethod
  141. def interpolate(
  142. cls,
  143. func: Callable[[npt.NDArray[np.float64]], _CoefSeries],
  144. deg: _IntLike_co,
  145. domain: _SeriesLikeCoef_co | None = ...,
  146. args: tuple[()] = ...,
  147. ) -> Self: ...
  148. @overload
  149. @classmethod
  150. def interpolate(
  151. cls,
  152. func: Callable[
  153. Concatenate[npt.NDArray[np.float64], ...],
  154. _CoefSeries,
  155. ],
  156. deg: _IntLike_co,
  157. domain: _SeriesLikeCoef_co | None = ...,
  158. *,
  159. args: Iterable[Any],
  160. ) -> Self: ...
  161. @overload
  162. @classmethod
  163. def interpolate(
  164. cls,
  165. func: Callable[
  166. Concatenate[npt.NDArray[np.float64], ...],
  167. _CoefSeries,
  168. ],
  169. deg: _IntLike_co,
  170. domain: _SeriesLikeCoef_co | None,
  171. args: Iterable[Any],
  172. ) -> Self: ...