|
1 |
| -from typing import Final, Literal as L |
| 1 | +from typing import Final, Literal as L, SupportsIndex as CanIndex, overload |
2 | 2 |
|
3 | 3 | import numpy as np
|
4 |
| -from _numtype import Array_1d |
| 4 | +from _numtype import ( |
| 5 | + Array, |
| 6 | + Array_1d, |
| 7 | + CoComplex_1d, |
| 8 | + CoFloating_1d, |
| 9 | + CoFloating_nd, |
| 10 | + CoInteger_1d, |
| 11 | + ToComplex128_1d, |
| 12 | + ToComplex_1d, |
| 13 | + ToComplex_nd, |
| 14 | + ToFloat64_1d, |
| 15 | + ToObject_1d, |
| 16 | + ToObject_nd, |
| 17 | +) |
5 | 18 |
|
6 | 19 | from ._polybase import ABCPolyBase
|
7 |
| -from ._polytypes import ( |
8 |
| - _FuncBinOp, |
9 |
| - _FuncCompanion, |
10 |
| - _FuncDer, |
11 |
| - _FuncFit, |
12 |
| - _FuncFromRoots, |
13 |
| - _FuncGauss, |
14 |
| - _FuncInteg, |
15 |
| - _FuncLine, |
16 |
| - _FuncPoly2Ortho, |
17 |
| - _FuncPow, |
18 |
| - _FuncRoots, |
19 |
| - _FuncUnOp, |
20 |
| - _FuncVal, |
21 |
| - _FuncVal2D, |
22 |
| - _FuncVal3D, |
23 |
| - _FuncValFromRoots, |
24 |
| - _FuncVander, |
25 |
| - _FuncVander2D, |
26 |
| - _FuncVander3D, |
27 |
| - _FuncWeight, |
| 20 | +from .polynomial import ( |
| 21 | + polyadd as legadd, |
| 22 | + polycompanion as legcompanion, |
| 23 | + polyder as legder, |
| 24 | + polydiv as legdiv, |
| 25 | + polyfit as legfit, |
| 26 | + polyfromroots as legfromroots, |
| 27 | + polygrid2d as leggrid2d, |
| 28 | + polygrid3d as leggrid3d, |
| 29 | + polyint as legint, |
| 30 | + polyline as legline, |
| 31 | + polymul as legmul, |
| 32 | + polymulx as legmulx, |
| 33 | + polypow as legpow, |
| 34 | + polyroots as legroots, |
| 35 | + polysub as legsub, |
| 36 | + polytrim as legtrim, |
| 37 | + polyval as legval, |
| 38 | + polyval2d as legval2d, |
| 39 | + polyval3d as legval3d, |
| 40 | + polyvander as legvander, |
| 41 | + polyvander2d as legvander2d, |
| 42 | + polyvander3d as legvander3d, |
28 | 43 | )
|
29 |
| -from .polyutils import trimcoef as legtrim |
30 | 44 |
|
31 | 45 | __all__ = [
|
32 | 46 | "Legendre",
|
@@ -62,39 +76,55 @@ __all__ = [
|
62 | 76 | "poly2leg",
|
63 | 77 | ]
|
64 | 78 |
|
| 79 | +### |
| 80 | + |
65 | 81 | legdomain: Final[Array_1d[np.float64]] = ...
|
66 | 82 | legzero: Final[Array_1d[np.int_]] = ...
|
67 | 83 | legone: Final[Array_1d[np.int_]] = ...
|
68 | 84 | legx: Final[Array_1d[np.int_]] = ...
|
69 | 85 |
|
70 |
| -poly2leg: Final[_FuncPoly2Ortho[L["poly2leg"]]] = ... |
71 |
| -leg2poly: Final[_FuncUnOp[L["leg2poly"]]] = ... |
72 |
| -legline: Final[_FuncLine[L["legline"]]] = ... |
73 |
| -legfromroots: Final[_FuncFromRoots[L["legfromroots"]]] = ... |
74 |
| -legadd: Final[_FuncBinOp[L["legadd"]]] = ... |
75 |
| -legsub: Final[_FuncBinOp[L["legsub"]]] = ... |
76 |
| -legmulx: Final[_FuncUnOp[L["legmulx"]]] = ... |
77 |
| -legmul: Final[_FuncBinOp[L["legmul"]]] = ... |
78 |
| -legdiv: Final[_FuncBinOp[L["legdiv"]]] = ... |
79 |
| -legpow: Final[_FuncPow[L["legpow"]]] = ... |
80 |
| -legder: Final[_FuncDer[L["legder"]]] = ... |
81 |
| -legint: Final[_FuncInteg[L["legint"]]] = ... |
82 |
| -legval: Final[_FuncVal[L["legval"]]] = ... |
83 |
| -legval2d: Final[_FuncVal2D[L["legval2d"]]] = ... |
84 |
| -legval3d: Final[_FuncVal3D[L["legval3d"]]] = ... |
85 |
| -legvalfromroots: Final[_FuncValFromRoots[L["legvalfromroots"]]] = ... |
86 |
| -leggrid2d: Final[_FuncVal2D[L["leggrid2d"]]] = ... |
87 |
| -leggrid3d: Final[_FuncVal3D[L["leggrid3d"]]] = ... |
88 |
| -legvander: Final[_FuncVander[L["legvander"]]] = ... |
89 |
| -legvander2d: Final[_FuncVander2D[L["legvander2d"]]] = ... |
90 |
| -legvander3d: Final[_FuncVander3D[L["legvander3d"]]] = ... |
91 |
| -legfit: Final[_FuncFit[L["legfit"]]] = ... |
92 |
| -legcompanion: Final[_FuncCompanion[L["legcompanion"]]] = ... |
93 |
| -legroots: Final[_FuncRoots[L["legroots"]]] = ... |
94 |
| -leggauss: Final[_FuncGauss[L["leggauss"]]] = ... |
95 |
| -legweight: Final[_FuncWeight[L["legweight"]]] = ... |
| 86 | +### |
96 | 87 |
|
97 | 88 | class Legendre(ABCPolyBase):
|
98 | 89 | domain: Array_1d[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride]
|
99 | 90 | window: Array_1d[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride]
|
100 | 91 | basis_name: L["P"] = "P" # pyright: ignore[reportIncompatibleMethodOverride]
|
| 92 | + |
| 93 | +### |
| 94 | +@overload |
| 95 | +def poly2leg(pol: ToFloat64_1d | CoInteger_1d) -> Array_1d[np.float64]: ... |
| 96 | +@overload |
| 97 | +def poly2leg(pol: CoFloating_1d) -> Array_1d[np.floating]: ... |
| 98 | +@overload |
| 99 | +def poly2leg(pol: ToComplex128_1d) -> Array_1d[np.complex128]: ... |
| 100 | +@overload |
| 101 | +def poly2leg(pol: ToComplex_1d) -> Array_1d[np.complexfloating]: ... |
| 102 | +@overload |
| 103 | +def poly2leg(pol: CoComplex_1d) -> Array_1d[np.inexact]: ... |
| 104 | +@overload |
| 105 | +def poly2leg(pol: ToObject_1d) -> Array_1d[np.object_]: ... |
| 106 | + |
| 107 | +# |
| 108 | +@overload |
| 109 | +def leg2poly(c: ToFloat64_1d | CoInteger_1d) -> Array_1d[np.float64]: ... |
| 110 | +@overload |
| 111 | +def leg2poly(c: CoFloating_1d) -> Array_1d[np.floating]: ... |
| 112 | +@overload |
| 113 | +def leg2poly(c: ToComplex128_1d) -> Array_1d[np.complex128]: ... |
| 114 | +@overload |
| 115 | +def leg2poly(c: ToComplex_1d) -> Array_1d[np.complexfloating]: ... |
| 116 | +@overload |
| 117 | +def leg2poly(c: CoComplex_1d) -> Array_1d[np.inexact]: ... |
| 118 | +@overload |
| 119 | +def leg2poly(c: ToObject_1d) -> Array_1d[np.object_]: ... |
| 120 | + |
| 121 | +# |
| 122 | +@overload |
| 123 | +def legweight(x: CoFloating_nd) -> Array[np.float64]: ... |
| 124 | +@overload |
| 125 | +def legweight(x: ToComplex_nd) -> Array[np.complex128]: ... |
| 126 | +@overload |
| 127 | +def legweight(x: ToObject_nd) -> Array[np.object_]: ... |
| 128 | + |
| 129 | +# |
| 130 | +def leggauss(deg: CanIndex) -> tuple[Array_1d[np.float64], Array_1d[np.float64]]: ... |
0 commit comments