chebyshev.pyi 4.6 KB

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