matlib.pyi 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. from typing import Any, Literal, TypeAlias, TypeVar, overload
  2. import numpy as np
  3. import numpy.typing as npt
  4. from numpy import ( # noqa: F401
  5. False_,
  6. ScalarType,
  7. True_,
  8. __array_namespace_info__,
  9. __version__,
  10. abs,
  11. absolute,
  12. acos,
  13. acosh,
  14. add,
  15. all,
  16. allclose,
  17. amax,
  18. amin,
  19. angle,
  20. any,
  21. append,
  22. apply_along_axis,
  23. apply_over_axes,
  24. arange,
  25. arccos,
  26. arccosh,
  27. arcsin,
  28. arcsinh,
  29. arctan,
  30. arctan2,
  31. arctanh,
  32. argmax,
  33. argmin,
  34. argpartition,
  35. argsort,
  36. argwhere,
  37. around,
  38. array,
  39. array2string,
  40. array_equal,
  41. array_equiv,
  42. array_repr,
  43. array_split,
  44. array_str,
  45. asanyarray,
  46. asarray,
  47. asarray_chkfinite,
  48. ascontiguousarray,
  49. asfortranarray,
  50. asin,
  51. asinh,
  52. asmatrix,
  53. astype,
  54. atan,
  55. atan2,
  56. atanh,
  57. atleast_1d,
  58. atleast_2d,
  59. atleast_3d,
  60. average,
  61. bartlett,
  62. base_repr,
  63. binary_repr,
  64. bincount,
  65. bitwise_and,
  66. bitwise_count,
  67. bitwise_invert,
  68. bitwise_left_shift,
  69. bitwise_not,
  70. bitwise_or,
  71. bitwise_right_shift,
  72. bitwise_xor,
  73. blackman,
  74. block,
  75. bmat,
  76. bool,
  77. bool_,
  78. broadcast,
  79. broadcast_arrays,
  80. broadcast_shapes,
  81. broadcast_to,
  82. busday_count,
  83. busday_offset,
  84. busdaycalendar,
  85. byte,
  86. bytes_,
  87. c_,
  88. can_cast,
  89. cbrt,
  90. cdouble,
  91. ceil,
  92. char,
  93. character,
  94. choose,
  95. clip,
  96. clongdouble,
  97. column_stack,
  98. common_type,
  99. complex64,
  100. complex128,
  101. complex192,
  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. float96,
  179. float128,
  180. float_power,
  181. floating,
  182. floor,
  183. floor_divide,
  184. fmax,
  185. fmin,
  186. fmod,
  187. format_float_positional,
  188. format_float_scientific,
  189. frexp,
  190. from_dlpack,
  191. frombuffer,
  192. fromfile,
  193. fromfunction,
  194. fromiter,
  195. frompyfunc,
  196. fromregex,
  197. fromstring,
  198. full,
  199. full_like,
  200. gcd,
  201. generic,
  202. genfromtxt,
  203. geomspace,
  204. get_include,
  205. get_printoptions,
  206. getbufsize,
  207. geterr,
  208. geterrcall,
  209. gradient,
  210. greater,
  211. greater_equal,
  212. half,
  213. hamming,
  214. hanning,
  215. heaviside,
  216. histogram,
  217. histogram2d,
  218. histogram_bin_edges,
  219. histogramdd,
  220. hsplit,
  221. hstack,
  222. hypot,
  223. i0,
  224. iinfo,
  225. imag,
  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. tri,
  455. tril,
  456. tril_indices,
  457. tril_indices_from,
  458. trim_zeros,
  459. triu,
  460. triu_indices,
  461. triu_indices_from,
  462. true_divide,
  463. trunc,
  464. typecodes,
  465. typename,
  466. typing,
  467. ubyte,
  468. ufunc,
  469. uint,
  470. uint8,
  471. uint16,
  472. uint32,
  473. uint64,
  474. uintc,
  475. uintp,
  476. ulong,
  477. ulonglong,
  478. union1d,
  479. unique,
  480. unique_all,
  481. unique_counts,
  482. unique_inverse,
  483. unique_values,
  484. unpackbits,
  485. unravel_index,
  486. unsignedinteger,
  487. unstack,
  488. unwrap,
  489. ushort,
  490. vander,
  491. var,
  492. vdot,
  493. vecdot,
  494. vecmat,
  495. vectorize,
  496. void,
  497. vsplit,
  498. vstack,
  499. where,
  500. zeros_like,
  501. )
  502. from numpy._typing import _ArrayLike, _DTypeLike
  503. __all__ = ["rand", "randn", "repmat"]
  504. __all__ += np.__all__
  505. ###
  506. _ScalarT = TypeVar("_ScalarT", bound=np.generic)
  507. _Matrix: TypeAlias = np.matrix[tuple[int, int], np.dtype[_ScalarT]]
  508. _Order: TypeAlias = Literal["C", "F"]
  509. ###
  510. #
  511. @overload
  512. def empty(shape: int | tuple[int, int], dtype: None = None, order: _Order = "C") -> _Matrix[np.float64]: ...
  513. @overload
  514. def empty(shape: int | tuple[int, int], dtype: _DTypeLike[_ScalarT], order: _Order = "C") -> _Matrix[_ScalarT]: ...
  515. @overload
  516. def empty(shape: int | tuple[int, int], dtype: npt.DTypeLike, order: _Order = "C") -> _Matrix[Any]: ...
  517. #
  518. @overload
  519. def ones(shape: int | tuple[int, int], dtype: None = None, order: _Order = "C") -> _Matrix[np.float64]: ...
  520. @overload
  521. def ones(shape: int | tuple[int, int], dtype: _DTypeLike[_ScalarT], order: _Order = "C") -> _Matrix[_ScalarT]: ...
  522. @overload
  523. def ones(shape: int | tuple[int, int], dtype: npt.DTypeLike, order: _Order = "C") -> _Matrix[Any]: ...
  524. #
  525. @overload
  526. def zeros(shape: int | tuple[int, int], dtype: None = None, order: _Order = "C") -> _Matrix[np.float64]: ...
  527. @overload
  528. def zeros(shape: int | tuple[int, int], dtype: _DTypeLike[_ScalarT], order: _Order = "C") -> _Matrix[_ScalarT]: ...
  529. @overload
  530. def zeros(shape: int | tuple[int, int], dtype: npt.DTypeLike, order: _Order = "C") -> _Matrix[Any]: ...
  531. #
  532. @overload
  533. def identity(n: int, dtype: None = None) -> _Matrix[np.float64]: ...
  534. @overload
  535. def identity(n: int, dtype: _DTypeLike[_ScalarT]) -> _Matrix[_ScalarT]: ...
  536. @overload
  537. def identity(n: int, dtype: npt.DTypeLike | None = None) -> _Matrix[Any]: ...
  538. #
  539. @overload
  540. def eye(
  541. n: int,
  542. M: int | None = None,
  543. k: int = 0,
  544. dtype: type[np.float64] | None = ...,
  545. order: _Order = "C",
  546. ) -> _Matrix[np.float64]: ...
  547. @overload
  548. def eye(n: int, M: int | None, k: int, dtype: _DTypeLike[_ScalarT], order: _Order = "C") -> _Matrix[_ScalarT]: ...
  549. @overload
  550. def eye(n: int, M: int | None = None, k: int = 0, *, dtype: _DTypeLike[_ScalarT], order: _Order = "C") -> _Matrix[_ScalarT]: ...
  551. @overload
  552. def eye(n: int, M: int | None = None, k: int = 0, dtype: npt.DTypeLike | None = ..., order: _Order = "C") -> _Matrix[Any]: ...
  553. #
  554. @overload
  555. def rand(arg: int | tuple[()] | tuple[int] | tuple[int, int], /) -> _Matrix[np.float64]: ...
  556. @overload
  557. def rand(arg: int, /, *args: int) -> _Matrix[np.float64]: ...
  558. #
  559. @overload
  560. def randn(arg: int | tuple[()] | tuple[int] | tuple[int, int], /) -> _Matrix[np.float64]: ...
  561. @overload
  562. def randn(arg: int, /, *args: int) -> _Matrix[np.float64]: ...
  563. #
  564. @overload
  565. def repmat(a: _Matrix[_ScalarT], m: int, n: int) -> _Matrix[_ScalarT]: ...
  566. @overload
  567. def repmat(a: _ArrayLike[_ScalarT], m: int, n: int) -> npt.NDArray[_ScalarT]: ...
  568. @overload
  569. def repmat(a: npt.ArrayLike, m: int, n: int) -> npt.NDArray[Any]: ...