_orthogonal.pyi 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. from typing import (
  2. Any,
  3. Callable,
  4. List,
  5. Literal,
  6. Optional,
  7. overload,
  8. Tuple,
  9. Union,
  10. )
  11. import numpy
  12. _IntegerType = Union[int, numpy.integer]
  13. _FloatingType = Union[float, numpy.floating]
  14. _PointsAndWeights = Tuple[numpy.ndarray, numpy.ndarray]
  15. _PointsAndWeightsAndMu = Tuple[numpy.ndarray, numpy.ndarray, float]
  16. _ArrayLike0D = Union[
  17. bool,
  18. int,
  19. float,
  20. complex,
  21. str,
  22. bytes,
  23. numpy.generic,
  24. ]
  25. __all__ = [
  26. 'legendre',
  27. 'chebyt',
  28. 'chebyu',
  29. 'chebyc',
  30. 'chebys',
  31. 'jacobi',
  32. 'laguerre',
  33. 'genlaguerre',
  34. 'hermite',
  35. 'hermitenorm',
  36. 'gegenbauer',
  37. 'sh_legendre',
  38. 'sh_chebyt',
  39. 'sh_chebyu',
  40. 'sh_jacobi',
  41. 'roots_legendre',
  42. 'roots_chebyt',
  43. 'roots_chebyu',
  44. 'roots_chebyc',
  45. 'roots_chebys',
  46. 'roots_jacobi',
  47. 'roots_laguerre',
  48. 'roots_genlaguerre',
  49. 'roots_hermite',
  50. 'roots_hermitenorm',
  51. 'roots_gegenbauer',
  52. 'roots_sh_legendre',
  53. 'roots_sh_chebyt',
  54. 'roots_sh_chebyu',
  55. 'roots_sh_jacobi',
  56. ]
  57. @overload
  58. def roots_jacobi(
  59. n: _IntegerType,
  60. alpha: _FloatingType,
  61. beta: _FloatingType,
  62. ) -> _PointsAndWeights: ...
  63. @overload
  64. def roots_jacobi(
  65. n: _IntegerType,
  66. alpha: _FloatingType,
  67. beta: _FloatingType,
  68. mu: Literal[False],
  69. ) -> _PointsAndWeights: ...
  70. @overload
  71. def roots_jacobi(
  72. n: _IntegerType,
  73. alpha: _FloatingType,
  74. beta: _FloatingType,
  75. mu: Literal[True],
  76. ) -> _PointsAndWeightsAndMu: ...
  77. @overload
  78. def roots_sh_jacobi(
  79. n: _IntegerType,
  80. p1: _FloatingType,
  81. q1: _FloatingType,
  82. ) -> _PointsAndWeights: ...
  83. @overload
  84. def roots_sh_jacobi(
  85. n: _IntegerType,
  86. p1: _FloatingType,
  87. q1: _FloatingType,
  88. mu: Literal[False],
  89. ) -> _PointsAndWeights: ...
  90. @overload
  91. def roots_sh_jacobi(
  92. n: _IntegerType,
  93. p1: _FloatingType,
  94. q1: _FloatingType,
  95. mu: Literal[True],
  96. ) -> _PointsAndWeightsAndMu: ...
  97. @overload
  98. def roots_genlaguerre(
  99. n: _IntegerType,
  100. alpha: _FloatingType,
  101. ) -> _PointsAndWeights: ...
  102. @overload
  103. def roots_genlaguerre(
  104. n: _IntegerType,
  105. alpha: _FloatingType,
  106. mu: Literal[False],
  107. ) -> _PointsAndWeights: ...
  108. @overload
  109. def roots_genlaguerre(
  110. n: _IntegerType,
  111. alpha: _FloatingType,
  112. mu: Literal[True],
  113. ) -> _PointsAndWeightsAndMu: ...
  114. @overload
  115. def roots_laguerre(n: _IntegerType) -> _PointsAndWeights: ...
  116. @overload
  117. def roots_laguerre(
  118. n: _IntegerType,
  119. mu: Literal[False],
  120. ) -> _PointsAndWeights: ...
  121. @overload
  122. def roots_laguerre(
  123. n: _IntegerType,
  124. mu: Literal[True],
  125. ) -> _PointsAndWeightsAndMu: ...
  126. @overload
  127. def roots_hermite(n: _IntegerType) -> _PointsAndWeights: ...
  128. @overload
  129. def roots_hermite(
  130. n: _IntegerType,
  131. mu: Literal[False],
  132. ) -> _PointsAndWeights: ...
  133. @overload
  134. def roots_hermite(
  135. n: _IntegerType,
  136. mu: Literal[True],
  137. ) -> _PointsAndWeightsAndMu: ...
  138. @overload
  139. def roots_hermitenorm(n: _IntegerType) -> _PointsAndWeights: ...
  140. @overload
  141. def roots_hermitenorm(
  142. n: _IntegerType,
  143. mu: Literal[False],
  144. ) -> _PointsAndWeights: ...
  145. @overload
  146. def roots_hermitenorm(
  147. n: _IntegerType,
  148. mu: Literal[True],
  149. ) -> _PointsAndWeightsAndMu: ...
  150. @overload
  151. def roots_gegenbauer(
  152. n: _IntegerType,
  153. alpha: _FloatingType,
  154. ) -> _PointsAndWeights: ...
  155. @overload
  156. def roots_gegenbauer(
  157. n: _IntegerType,
  158. alpha: _FloatingType,
  159. mu: Literal[False],
  160. ) -> _PointsAndWeights: ...
  161. @overload
  162. def roots_gegenbauer(
  163. n: _IntegerType,
  164. alpha: _FloatingType,
  165. mu: Literal[True],
  166. ) -> _PointsAndWeightsAndMu: ...
  167. @overload
  168. def roots_chebyt(n: _IntegerType) -> _PointsAndWeights: ...
  169. @overload
  170. def roots_chebyt(
  171. n: _IntegerType,
  172. mu: Literal[False],
  173. ) -> _PointsAndWeights: ...
  174. @overload
  175. def roots_chebyt(
  176. n: _IntegerType,
  177. mu: Literal[True],
  178. ) -> _PointsAndWeightsAndMu: ...
  179. @overload
  180. def roots_chebyu(n: _IntegerType) -> _PointsAndWeights: ...
  181. @overload
  182. def roots_chebyu(
  183. n: _IntegerType,
  184. mu: Literal[False],
  185. ) -> _PointsAndWeights: ...
  186. @overload
  187. def roots_chebyu(
  188. n: _IntegerType,
  189. mu: Literal[True],
  190. ) -> _PointsAndWeightsAndMu: ...
  191. @overload
  192. def roots_chebyc(n: _IntegerType) -> _PointsAndWeights: ...
  193. @overload
  194. def roots_chebyc(
  195. n: _IntegerType,
  196. mu: Literal[False],
  197. ) -> _PointsAndWeights: ...
  198. @overload
  199. def roots_chebyc(
  200. n: _IntegerType,
  201. mu: Literal[True],
  202. ) -> _PointsAndWeightsAndMu: ...
  203. @overload
  204. def roots_chebys(n: _IntegerType) -> _PointsAndWeights: ...
  205. @overload
  206. def roots_chebys(
  207. n: _IntegerType,
  208. mu: Literal[False],
  209. ) -> _PointsAndWeights: ...
  210. @overload
  211. def roots_chebys(
  212. n: _IntegerType,
  213. mu: Literal[True],
  214. ) -> _PointsAndWeightsAndMu: ...
  215. @overload
  216. def roots_sh_chebyt(n: _IntegerType) -> _PointsAndWeights: ...
  217. @overload
  218. def roots_sh_chebyt(
  219. n: _IntegerType,
  220. mu: Literal[False],
  221. ) -> _PointsAndWeights: ...
  222. @overload
  223. def roots_sh_chebyt(
  224. n: _IntegerType,
  225. mu: Literal[True],
  226. ) -> _PointsAndWeightsAndMu: ...
  227. @overload
  228. def roots_sh_chebyu(n: _IntegerType) -> _PointsAndWeights: ...
  229. @overload
  230. def roots_sh_chebyu(
  231. n: _IntegerType,
  232. mu: Literal[False],
  233. ) -> _PointsAndWeights: ...
  234. @overload
  235. def roots_sh_chebyu(
  236. n: _IntegerType,
  237. mu: Literal[True],
  238. ) -> _PointsAndWeightsAndMu: ...
  239. @overload
  240. def roots_legendre(n: _IntegerType) -> _PointsAndWeights: ...
  241. @overload
  242. def roots_legendre(
  243. n: _IntegerType,
  244. mu: Literal[False],
  245. ) -> _PointsAndWeights: ...
  246. @overload
  247. def roots_legendre(
  248. n: _IntegerType,
  249. mu: Literal[True],
  250. ) -> _PointsAndWeightsAndMu: ...
  251. @overload
  252. def roots_sh_legendre(n: _IntegerType) -> _PointsAndWeights: ...
  253. @overload
  254. def roots_sh_legendre(
  255. n: _IntegerType,
  256. mu: Literal[False],
  257. ) -> _PointsAndWeights: ...
  258. @overload
  259. def roots_sh_legendre(
  260. n: _IntegerType,
  261. mu: Literal[True],
  262. ) -> _PointsAndWeightsAndMu: ...
  263. class orthopoly1d(numpy.poly1d):
  264. def __init__(
  265. self,
  266. roots: numpy.typing.ArrayLike,
  267. weights: Optional[numpy.typing.ArrayLike],
  268. hn: float = ...,
  269. kn: float = ...,
  270. wfunc = Optional[Callable[[float], float]],
  271. limits = Optional[Tuple[float, float]],
  272. monic: bool = ...,
  273. eval_func: numpy.ufunc = ...,
  274. ) -> None: ...
  275. @property
  276. def limits(self) -> Tuple[float, float]: ...
  277. def weight_func(self, x: float) -> float: ...
  278. @overload
  279. def __call__(self, x: _ArrayLike0D) -> Any: ...
  280. @overload
  281. def __call__(self, x: numpy.poly1d) -> numpy.poly1d: ... # type: ignore[misc]
  282. @overload
  283. def __call__(self, x: numpy.typing.ArrayLike) -> numpy.ndarray: ...
  284. def legendre(n: _IntegerType, monic: bool = ...) -> orthopoly1d: ...
  285. def chebyt(n: _IntegerType, monic: bool = ...) -> orthopoly1d: ...
  286. def chebyu(n: _IntegerType, monic: bool = ...) -> orthopoly1d: ...
  287. def chebyc(n: _IntegerType, monic: bool = ...) -> orthopoly1d: ...
  288. def chebys(n: _IntegerType, monic: bool = ...) -> orthopoly1d: ...
  289. def jacobi(
  290. n: _IntegerType,
  291. alpha: _FloatingType,
  292. beta: _FloatingType,
  293. monic: bool = ...,
  294. ) -> orthopoly1d: ...
  295. def laguerre(n: _IntegerType, monic: bool = ...) -> orthopoly1d: ...
  296. def genlaguerre(
  297. n: _IntegerType,
  298. alpha: _FloatingType,
  299. monic: bool = ...,
  300. ) -> orthopoly1d: ...
  301. def hermite(n: _IntegerType, monic: bool = ...) -> orthopoly1d: ...
  302. def hermitenorm(n: _IntegerType, monic: bool = ...) -> orthopoly1d: ...
  303. def gegenbauer(
  304. n: _IntegerType,
  305. alpha: _FloatingType,
  306. monic: bool = ...,
  307. ) -> orthopoly1d: ...
  308. def sh_legendre(n: _IntegerType, monic: bool = ...) -> orthopoly1d: ...
  309. def sh_chebyt(n: _IntegerType, monic: bool = ...) -> orthopoly1d: ...
  310. def sh_chebyu(n: _IntegerType, monic: bool = ...) -> orthopoly1d: ...
  311. def sh_jacobi(
  312. n: _IntegerType,
  313. p: _FloatingType,
  314. q: _FloatingType,
  315. monic: bool = ...,
  316. ) -> orthopoly1d: ...
  317. # These functions are not public, but still need stubs because they
  318. # get checked in the tests.
  319. def _roots_hermite_asy(n: _IntegerType) -> _PointsAndWeights: ...