matlib.pyi 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. from typing import Any, Literal, TypeAlias, TypeVar, overload
  2. import numpy as np
  3. import numpy.typing as npt
  4. # ruff: noqa: F401
  5. from numpy import (
  6. False_,
  7. ScalarType,
  8. True_,
  9. __array_namespace_info__,
  10. __version__,
  11. abs,
  12. absolute,
  13. acos,
  14. acosh,
  15. add,
  16. all,
  17. allclose,
  18. amax,
  19. amin,
  20. angle,
  21. any,
  22. append,
  23. apply_along_axis,
  24. apply_over_axes,
  25. arange,
  26. arccos,
  27. arccosh,
  28. arcsin,
  29. arcsinh,
  30. arctan,
  31. arctan2,
  32. arctanh,
  33. argmax,
  34. argmin,
  35. argpartition,
  36. argsort,
  37. argwhere,
  38. around,
  39. array,
  40. array2string,
  41. array_equal,
  42. array_equiv,
  43. array_repr,
  44. array_split,
  45. array_str,
  46. asanyarray,
  47. asarray,
  48. asarray_chkfinite,
  49. ascontiguousarray,
  50. asfortranarray,
  51. asin,
  52. asinh,
  53. asmatrix,
  54. astype,
  55. atan,
  56. atan2,
  57. atanh,
  58. atleast_1d,
  59. atleast_2d,
  60. atleast_3d,
  61. average,
  62. bartlett,
  63. base_repr,
  64. binary_repr,
  65. bincount,
  66. bitwise_and,
  67. bitwise_count,
  68. bitwise_invert,
  69. bitwise_left_shift,
  70. bitwise_not,
  71. bitwise_or,
  72. bitwise_right_shift,
  73. bitwise_xor,
  74. blackman,
  75. block,
  76. bmat,
  77. bool,
  78. bool_,
  79. broadcast,
  80. broadcast_arrays,
  81. broadcast_shapes,
  82. broadcast_to,
  83. busday_count,
  84. busday_offset,
  85. busdaycalendar,
  86. byte,
  87. bytes_,
  88. c_,
  89. can_cast,
  90. cbrt,
  91. cdouble,
  92. ceil,
  93. char,
  94. character,
  95. choose,
  96. clip,
  97. clongdouble,
  98. column_stack,
  99. common_type,
  100. complex64,
  101. complex128,
  102. complex256,
  103. complexfloating,
  104. compress,
  105. concat,
  106. concatenate,
  107. conj,
  108. conjugate,
  109. convolve,
  110. copy,
  111. copysign,
  112. copyto,
  113. core,
  114. corrcoef,
  115. correlate,
  116. cos,
  117. cosh,
  118. count_nonzero,
  119. cov,
  120. cross,
  121. csingle,
  122. ctypeslib,
  123. cumprod,
  124. cumsum,
  125. cumulative_prod,
  126. cumulative_sum,
  127. datetime64,
  128. datetime_as_string,
  129. datetime_data,
  130. deg2rad,
  131. degrees,
  132. delete,
  133. diag,
  134. diag_indices,
  135. diag_indices_from,
  136. diagflat,
  137. diagonal,
  138. diff,
  139. digitize,
  140. divide,
  141. divmod,
  142. dot,
  143. double,
  144. dsplit,
  145. dstack,
  146. dtype,
  147. dtypes,
  148. e,
  149. ediff1d,
  150. einsum,
  151. einsum_path,
  152. emath,
  153. empty_like,
  154. equal,
  155. errstate,
  156. euler_gamma,
  157. exceptions,
  158. exp,
  159. exp2,
  160. expand_dims,
  161. expm1,
  162. extract,
  163. f2py,
  164. fabs,
  165. fft,
  166. fill_diagonal,
  167. finfo,
  168. fix,
  169. flatiter,
  170. flatnonzero,
  171. flexible,
  172. flip,
  173. fliplr,
  174. flipud,
  175. float16,
  176. float32,
  177. float64,
  178. float128,
  179. float_power,
  180. floating,
  181. floor,
  182. floor_divide,
  183. fmax,
  184. fmin,
  185. fmod,
  186. format_float_positional,
  187. format_float_scientific,
  188. frexp,
  189. from_dlpack,
  190. frombuffer,
  191. fromfile,
  192. fromfunction,
  193. fromiter,
  194. frompyfunc,
  195. fromregex,
  196. fromstring,
  197. full,
  198. full_like,
  199. gcd,
  200. generic,
  201. genfromtxt,
  202. geomspace,
  203. get_include,
  204. get_printoptions,
  205. getbufsize,
  206. geterr,
  207. geterrcall,
  208. gradient,
  209. greater,
  210. greater_equal,
  211. half,
  212. hamming,
  213. hanning,
  214. heaviside,
  215. histogram,
  216. histogram2d,
  217. histogram_bin_edges,
  218. histogramdd,
  219. hsplit,
  220. hstack,
  221. hypot,
  222. i0,
  223. iinfo,
  224. imag,
  225. in1d,
  226. index_exp,
  227. indices,
  228. inexact,
  229. inf,
  230. info,
  231. inner,
  232. insert,
  233. int8,
  234. int16,
  235. int32,
  236. int64,
  237. int_,
  238. intc,
  239. integer,
  240. interp,
  241. intersect1d,
  242. intp,
  243. invert,
  244. is_busday,
  245. isclose,
  246. iscomplex,
  247. iscomplexobj,
  248. isdtype,
  249. isfinite,
  250. isfortran,
  251. isin,
  252. isinf,
  253. isnan,
  254. isnat,
  255. isneginf,
  256. isposinf,
  257. isreal,
  258. isrealobj,
  259. isscalar,
  260. issubdtype,
  261. iterable,
  262. ix_,
  263. kaiser,
  264. kron,
  265. lcm,
  266. ldexp,
  267. left_shift,
  268. less,
  269. less_equal,
  270. lexsort,
  271. lib,
  272. linalg,
  273. linspace,
  274. little_endian,
  275. load,
  276. loadtxt,
  277. log,
  278. log1p,
  279. log2,
  280. log10,
  281. logaddexp,
  282. logaddexp2,
  283. logical_and,
  284. logical_not,
  285. logical_or,
  286. logical_xor,
  287. logspace,
  288. long,
  289. longdouble,
  290. longlong,
  291. ma,
  292. mask_indices,
  293. matmul,
  294. matrix,
  295. matrix_transpose,
  296. matvec,
  297. max,
  298. maximum,
  299. may_share_memory,
  300. mean,
  301. median,
  302. memmap,
  303. meshgrid,
  304. mgrid,
  305. min,
  306. min_scalar_type,
  307. minimum,
  308. mintypecode,
  309. mod,
  310. modf,
  311. moveaxis,
  312. multiply,
  313. nan,
  314. nan_to_num,
  315. nanargmax,
  316. nanargmin,
  317. nancumprod,
  318. nancumsum,
  319. nanmax,
  320. nanmean,
  321. nanmedian,
  322. nanmin,
  323. nanpercentile,
  324. nanprod,
  325. nanquantile,
  326. nanstd,
  327. nansum,
  328. nanvar,
  329. ndarray,
  330. ndenumerate,
  331. ndim,
  332. ndindex,
  333. nditer,
  334. negative,
  335. nested_iters,
  336. newaxis,
  337. nextafter,
  338. nonzero,
  339. not_equal,
  340. number,
  341. object_,
  342. ogrid,
  343. ones_like,
  344. outer,
  345. packbits,
  346. pad,
  347. partition,
  348. percentile,
  349. permute_dims,
  350. pi,
  351. piecewise,
  352. place,
  353. poly,
  354. poly1d,
  355. polyadd,
  356. polyder,
  357. polydiv,
  358. polyfit,
  359. polyint,
  360. polymul,
  361. polynomial,
  362. polysub,
  363. polyval,
  364. positive,
  365. pow,
  366. power,
  367. printoptions,
  368. prod,
  369. promote_types,
  370. ptp,
  371. put,
  372. put_along_axis,
  373. putmask,
  374. quantile,
  375. r_,
  376. rad2deg,
  377. radians,
  378. random,
  379. ravel,
  380. ravel_multi_index,
  381. real,
  382. real_if_close,
  383. rec,
  384. recarray,
  385. reciprocal,
  386. record,
  387. remainder,
  388. repeat,
  389. require,
  390. reshape,
  391. resize,
  392. result_type,
  393. right_shift,
  394. rint,
  395. roll,
  396. rollaxis,
  397. roots,
  398. rot90,
  399. round,
  400. row_stack,
  401. s_,
  402. save,
  403. savetxt,
  404. savez,
  405. savez_compressed,
  406. sctypeDict,
  407. searchsorted,
  408. select,
  409. set_printoptions,
  410. setbufsize,
  411. setdiff1d,
  412. seterr,
  413. seterrcall,
  414. setxor1d,
  415. shape,
  416. shares_memory,
  417. short,
  418. show_config,
  419. show_runtime,
  420. sign,
  421. signbit,
  422. signedinteger,
  423. sin,
  424. sinc,
  425. single,
  426. sinh,
  427. size,
  428. sort,
  429. sort_complex,
  430. spacing,
  431. split,
  432. sqrt,
  433. square,
  434. squeeze,
  435. stack,
  436. std,
  437. str_,
  438. strings,
  439. subtract,
  440. sum,
  441. swapaxes,
  442. take,
  443. take_along_axis,
  444. tan,
  445. tanh,
  446. tensordot,
  447. test,
  448. testing,
  449. tile,
  450. timedelta64,
  451. trace,
  452. transpose,
  453. trapezoid,
  454. trapz,
  455. tri,
  456. tril,
  457. tril_indices,
  458. tril_indices_from,
  459. trim_zeros,
  460. triu,
  461. triu_indices,
  462. triu_indices_from,
  463. true_divide,
  464. trunc,
  465. typecodes,
  466. typename,
  467. typing,
  468. ubyte,
  469. ufunc,
  470. uint,
  471. uint8,
  472. uint16,
  473. uint32,
  474. uint64,
  475. uintc,
  476. uintp,
  477. ulong,
  478. ulonglong,
  479. union1d,
  480. unique,
  481. unique_all,
  482. unique_counts,
  483. unique_inverse,
  484. unique_values,
  485. unpackbits,
  486. unravel_index,
  487. unsignedinteger,
  488. unstack,
  489. unwrap,
  490. ushort,
  491. vander,
  492. var,
  493. vdot,
  494. vecdot,
  495. vecmat,
  496. vectorize,
  497. void,
  498. vsplit,
  499. vstack,
  500. where,
  501. zeros_like,
  502. )
  503. from numpy._typing import _ArrayLike, _DTypeLike
  504. __all__ = ["rand", "randn", "repmat"]
  505. __all__ += np.__all__
  506. ###
  507. _T = TypeVar("_T", bound=np.generic)
  508. _Matrix: TypeAlias = np.matrix[tuple[int, int], np.dtype[_T]]
  509. _Order: TypeAlias = Literal["C", "F"]
  510. ###
  511. # ruff: noqa: F811
  512. #
  513. @overload
  514. def empty(shape: int | tuple[int, int], dtype: None = None, order: _Order = "C") -> _Matrix[np.float64]: ...
  515. @overload
  516. def empty(shape: int | tuple[int, int], dtype: _DTypeLike[_T], order: _Order = "C") -> _Matrix[_T]: ...
  517. @overload
  518. def empty(shape: int | tuple[int, int], dtype: npt.DTypeLike, order: _Order = "C") -> _Matrix[Any]: ...
  519. #
  520. @overload
  521. def ones(shape: int | tuple[int, int], dtype: None = None, order: _Order = "C") -> _Matrix[np.float64]: ...
  522. @overload
  523. def ones(shape: int | tuple[int, int], dtype: _DTypeLike[_T], order: _Order = "C") -> _Matrix[_T]: ...
  524. @overload
  525. def ones(shape: int | tuple[int, int], dtype: npt.DTypeLike, order: _Order = "C") -> _Matrix[Any]: ...
  526. #
  527. @overload
  528. def zeros(shape: int | tuple[int, int], dtype: None = None, order: _Order = "C") -> _Matrix[np.float64]: ...
  529. @overload
  530. def zeros(shape: int | tuple[int, int], dtype: _DTypeLike[_T], order: _Order = "C") -> _Matrix[_T]: ...
  531. @overload
  532. def zeros(shape: int | tuple[int, int], dtype: npt.DTypeLike, order: _Order = "C") -> _Matrix[Any]: ...
  533. #
  534. @overload
  535. def identity(n: int, dtype: None = None) -> _Matrix[np.float64]: ...
  536. @overload
  537. def identity(n: int, dtype: _DTypeLike[_T]) -> _Matrix[_T]: ...
  538. @overload
  539. def identity(n: int, dtype: npt.DTypeLike | None = None) -> _Matrix[Any]: ...
  540. #
  541. @overload
  542. def eye(
  543. n: int,
  544. M: int | None = None,
  545. k: int = 0,
  546. dtype: type[np.float64] | None = ...,
  547. order: _Order = "C",
  548. ) -> _Matrix[np.float64]: ...
  549. @overload
  550. def eye(n: int, M: int | None, k: int, dtype: _DTypeLike[_T], order: _Order = "C") -> _Matrix[_T]: ...
  551. @overload
  552. def eye(n: int, M: int | None = None, k: int = 0, *, dtype: _DTypeLike[_T], order: _Order = "C") -> _Matrix[_T]: ...
  553. @overload
  554. def eye(n: int, M: int | None = None, k: int = 0, dtype: npt.DTypeLike = ..., order: _Order = "C") -> _Matrix[Any]: ...
  555. #
  556. @overload
  557. def rand(arg: int | tuple[()] | tuple[int] | tuple[int, int], /) -> _Matrix[np.float64]: ...
  558. @overload
  559. def rand(arg: int, /, *args: int) -> _Matrix[np.float64]: ...
  560. #
  561. @overload
  562. def randn(arg: int | tuple[()] | tuple[int] | tuple[int, int], /) -> _Matrix[np.float64]: ...
  563. @overload
  564. def randn(arg: int, /, *args: int) -> _Matrix[np.float64]: ...
  565. #
  566. @overload
  567. def repmat(a: _Matrix[_T], m: int, n: int) -> _Matrix[_T]: ...
  568. @overload
  569. def repmat(a: _ArrayLike[_T], m: int, n: int) -> npt.NDArray[_T]: ...
  570. @overload
  571. def repmat(a: npt.ArrayLike, m: int, n: int) -> npt.NDArray[Any]: ...