Skip to content

Commit bd9ae0b

Browse files
committed
🏷️ stats: stub the remaining private modules
1 parent c6acb2f commit bd9ae0b

File tree

5 files changed

+231
-0
lines changed

5 files changed

+231
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# defined in scipy/stats/_ansari_swilk_statistics.pyx
2+
3+
import numpy as np
4+
import optype.numpy as onp
5+
6+
def gscale(test: int, other: int) -> tuple[int, onp.Array1D[np.float32], int]: ... # undocumented
7+
def swilk(
8+
x: onp.Array1D[np.float64], a: onp.Array1D[np.float64], init: bool = False, n1: int = -1
9+
) -> tuple[float, float, int]: ... # undocumented

scipy-stubs/stats/_constants.pyi

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from typing import Final
2+
3+
import numpy as np
4+
5+
_EPS: Final[np.float64] = ... # undocumented
6+
_XMAX: Final[np.float64] = ... # undocumented
7+
_LOGXMAX: Final[np.float64] = ... # undocumented
8+
_XMIN: Final[np.float64] = ... # undocumented
9+
_LOGXMIN: Final[np.float64] = ... # undocumented
10+
11+
_EULER: Final[float] = 0.577215664901532860606512090082402431042 # undocumented
12+
_ZETA3: Final[float] = 1.202056903159594285399738161511449990765 # undocumented
13+
_SQRT_PI: Final[float] = 1.772453850905516027298167483341145182798 # undocumented
14+
_SQRT_2_OVER_PI: Final[float] = 0.7978845608028654 # undocumented
15+
_LOG_PI: Final[float] = 1.1447298858494002 # undocumented
16+
_LOG_SQRT_2_OVER_PI: Final[float] = -0.22579135264472744 # undocumented
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from collections.abc import Callable
2+
from typing import overload
3+
from typing_extensions import TypeVarTuple
4+
5+
import numpy as np
6+
import optype.numpy as onp
7+
8+
_Ts = TypeVarTuple("_Ts")
9+
10+
###
11+
12+
def _central_diff_weights(Np: int, ndiv: int = 1) -> onp.Array1D[np.float64]: ... # undocumented
13+
14+
#
15+
@overload
16+
def _derivative(
17+
func: Callable[[float], onp.ToFloat], x0: float, dx: float = 1.0, n: int = 1, args: tuple[()] = ..., order: int = 3
18+
) -> np.float64: ...
19+
@overload
20+
def _derivative(
21+
func: Callable[[float, *_Ts], onp.ToFloat], x0: float, dx: float = 1.0, n: int = 1, *, args: tuple[*_Ts], order: int = 3
22+
) -> np.float64: ... # undocumented

scipy-stubs/stats/_qmvnt_cy.pyi

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# defined in scipy/stats/_qmvnt_cy.pyx
2+
3+
from typing import Final
4+
5+
import numpy as np
6+
import optype.numpy as onp
7+
8+
###
9+
10+
gammaincinv: Final[np.ufunc] = ... # implicit re-export from `scipy.special`, required by stubtest
11+
12+
def _qmvn_inner(
13+
q: onp.Array1D[np.float64],
14+
rndm: onp.Array2D[np.float64],
15+
n_qmc_samples: int,
16+
n_batches: int,
17+
cho: onp.Array2D[np.float64],
18+
lo: onp.Array1D[np.float64],
19+
hi: onp.Array1D[np.float64],
20+
) -> tuple[float, np.float64, int]: ... # undocumented
21+
def _qmvt_inner(
22+
q: onp.Array1D[np.float64],
23+
rndm: onp.Array2D[np.float64],
24+
n_qmc_samples: int,
25+
n_batches: int,
26+
cho: onp.Array2D[np.float64],
27+
lo: onp.Array1D[np.float64],
28+
hi: onp.Array1D[np.float64],
29+
nu: float,
30+
) -> tuple[float, np.float64, int]: ... # undocumented

scipy-stubs/stats/_stats.pyi

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# defined in scipy/stats/_stats.pyx
2+
3+
from collections.abc import Callable
4+
from typing import Final, Literal, TypeAlias, TypedDict, overload, type_check_only
5+
from typing_extensions import CapsuleType, ReadOnly
6+
7+
import numpy as np
8+
import optype.numpy as onp
9+
import optype.numpy.compat as npc
10+
11+
###
12+
13+
# matches the `ctypedef fused ordered`
14+
_Ordered: TypeAlias = np.int32 | np.int64 | np.float32 | np.float64
15+
16+
# matches the `ctypedef fused real`
17+
_Real: TypeAlias = np.float32 | np.float64 | np.longdouble
18+
19+
# castable to `_Real`
20+
_AsReal: TypeAlias = npc.floating | npc.integer | np.bool_
21+
22+
# castable to a real distance matrix
23+
_Dist2D: TypeAlias = onp.Array2D[_AsReal]
24+
25+
# the (presumed) type of the `global_corr` parameters
26+
_GlobalCorr: TypeAlias = Literal["mgc", "mantel", "biased", "rank"]
27+
28+
###
29+
30+
@type_check_only
31+
class _CApiDict(TypedDict):
32+
_geninvgauss_pdf: ReadOnly[CapsuleType]
33+
_studentized_range_cdf: ReadOnly[CapsuleType]
34+
_studentized_range_cdf_asymptotic: ReadOnly[CapsuleType]
35+
_studentized_range_pdf: ReadOnly[CapsuleType]
36+
_studentized_range_pdf_asymptotic: ReadOnly[CapsuleType]
37+
_studentized_range_moment: ReadOnly[CapsuleType]
38+
_genhyperbolic_pdf: ReadOnly[CapsuleType]
39+
_genhyperbolic_logpdf: ReadOnly[CapsuleType]
40+
41+
###
42+
43+
__pyx_capi__: Final[_CApiDict] = ... # undocumented
44+
45+
def von_mises_cdf(k_obj: onp.ToFloatND, x_obj: onp.ToFloatND) -> onp.ArrayND[np.float64]: ... # undocumented
46+
def _kendall_dis(x: onp.Array1D[np.intp], y: onp.Array1D[np.intp]) -> int: ... # undocumented
47+
def _toint64(x: onp.ToIntND) -> onp.Array1D[np.int64]: ... # undocumented
48+
def _weightedrankedtau(
49+
x: onp.Array1D[_Ordered],
50+
y: onp.Array1D[_Ordered],
51+
rank: onp.Array1D[np.intp],
52+
weigher: Callable[[float], onp.ToFloat],
53+
additive: bool,
54+
) -> np.float64: ... # undocumented
55+
def _rank_distance_matrix(distx: onp.Array2D[npc.floating | npc.integer]) -> onp.Array2D[np.intp]: ... # undocumented
56+
57+
#
58+
@overload
59+
def _center_distance_matrix(
60+
distx: _Dist2D, global_corr: _GlobalCorr = "mgc", is_ranked: onp.ToTrue = True
61+
) -> tuple[onp.Array2D[np.float64], onp.Array2D[np.intp]]: ...
62+
@overload
63+
def _center_distance_matrix(
64+
distx: _Dist2D, global_corr: _GlobalCorr, is_ranked: onp.ToFalse
65+
) -> tuple[onp.Array2D[np.float64], onp.Array1D[np.float64]]: ...
66+
@overload
67+
def _center_distance_matrix(
68+
distx: _Dist2D, global_corr: _GlobalCorr = "mgc", *, is_ranked: onp.ToFalse
69+
) -> tuple[onp.Array2D[np.float64], onp.Array1D[np.float64]]: ... # undocumented
70+
71+
#
72+
@overload
73+
def _transform_distance_matrix(
74+
distx: _Dist2D, disty: _Dist2D, global_corr: _GlobalCorr = "mgc", is_ranked: onp.ToTrue = True
75+
) -> dict[str, onp.Array2D[np.float64] | onp.Array2D[np.intp]]: ...
76+
@overload
77+
def _transform_distance_matrix(
78+
distx: _Dist2D, disty: _Dist2D, global_corr: _GlobalCorr, is_ranked: onp.ToFalse
79+
) -> dict[str, onp.Array2D[np.float64] | onp.Array1D[np.float64]]: ...
80+
@overload
81+
def _transform_distance_matrix(
82+
distx: _Dist2D, disty: _Dist2D, global_corr: _GlobalCorr = "mgc", *, is_ranked: onp.ToFalse
83+
) -> dict[str, onp.Array2D[np.float64] | onp.Array1D[np.float64]]: ... # undocumented
84+
85+
#
86+
def _local_covariance(
87+
distx: _Dist2D, disty: _Dist2D, rank_distx: onp.ArrayND[_AsReal], rank_disty: onp.ArrayND[_AsReal]
88+
) -> onp.Array2D[np.float64]: ... # undocumented
89+
def _local_correlations(
90+
distx: _Dist2D, disty: _Dist2D, global_corr: _GlobalCorr = "mgc"
91+
) -> onp.Array2D[np.float64]: ... # undocumented
92+
def geninvgauss_logpdf(x: float, p: float, b: float) -> float: ... # undocumented
93+
def _studentized_range_cdf_logconst(k: float, df: float) -> float: ... # undocumented
94+
def _studentized_range_pdf_logconst(k: float, df: float) -> float: ... # undocumented
95+
def genhyperbolic_pdf(x: float, p: float, a: float, b: float) -> float: ... # undocumented
96+
def genhyperbolic_logpdf(x: float, p: float, a: float, b: float) -> float: ... # undocumented
97+
98+
# keep in sync with `gaussian_kernel_estimate_log`
99+
@overload
100+
def gaussian_kernel_estimate( # type: ignore[overload-overlap]
101+
points: onp.Array2D[_AsReal],
102+
values: onp.Array2D[_Real],
103+
xi: onp.Array2D[_AsReal],
104+
cho_cov: onp.Array2D[_AsReal],
105+
dtype: onp.AnyFloat32DType,
106+
_: _Real | float = 0.0,
107+
) -> onp.Array2D[np.float32]: ...
108+
@overload
109+
def gaussian_kernel_estimate(
110+
points: onp.Array2D[_AsReal],
111+
values: onp.Array2D[_Real],
112+
xi: onp.Array2D[_AsReal],
113+
cho_cov: onp.Array2D[_AsReal],
114+
dtype: onp.AnyFloat64DType,
115+
_: _Real | float = 0.0,
116+
) -> onp.Array2D[np.float64]: ...
117+
@overload
118+
def gaussian_kernel_estimate(
119+
points: onp.Array2D[_AsReal],
120+
values: onp.Array2D[_Real],
121+
xi: onp.Array2D[_AsReal],
122+
cho_cov: onp.Array2D[_AsReal],
123+
dtype: onp.AnyLongDoubleDType,
124+
_: _Real | float = 0.0,
125+
) -> onp.Array2D[np.longdouble]: ... # undocumented
126+
127+
# keep in sync with `gaussian_kernel_estimate`
128+
@overload
129+
def gaussian_kernel_estimate_log( # type: ignore[overload-overlap]
130+
points: onp.Array2D[_AsReal],
131+
values: onp.Array2D[_Real],
132+
xi: onp.Array2D[_AsReal],
133+
cho_cov: onp.Array2D[_AsReal],
134+
dtype: onp.AnyFloat32DType,
135+
_: _Real | float = 0.0,
136+
) -> onp.Array2D[np.float32]: ...
137+
@overload
138+
def gaussian_kernel_estimate_log(
139+
points: onp.Array2D[_AsReal],
140+
values: onp.Array2D[_Real],
141+
xi: onp.Array2D[_AsReal],
142+
cho_cov: onp.Array2D[_AsReal],
143+
dtype: onp.AnyFloat64DType,
144+
_: _Real | float = 0.0,
145+
) -> onp.Array2D[np.float64]: ...
146+
@overload
147+
def gaussian_kernel_estimate_log(
148+
points: onp.Array2D[_AsReal],
149+
values: onp.Array2D[_Real],
150+
xi: onp.Array2D[_AsReal],
151+
cho_cov: onp.Array2D[_AsReal],
152+
dtype: onp.AnyLongDoubleDType,
153+
_: _Real | float = 0.0,
154+
) -> onp.Array2D[np.longdouble]: ... # undocumented

0 commit comments

Comments
 (0)