matlib.pyi 9.4 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. complex256,
  102. complexfloating,
  103. compress,
  104. concat,
  105. concatenate,
  106. conj,
  107. conjugate,
  108. convolve,
  109. copy,
  110. copysign,
  111. copyto,
  112. core,
  113. corrcoef,
  114. correlate,
  115. cos,
  116. cosh,
  117. count_nonzero,
  118. cov,
  119. cross,
  120. csingle,
  121. ctypeslib,
  122. cumprod,
  123. cumsum,
  124. cumulative_prod,
  125. cumulative_sum,
  126. datetime64,
  127. datetime_as_string,
  128. datetime_data,
  129. deg2rad,
  130. degrees,
  131. delete,
  132. diag,
  133. diag_indices,
  134. diag_indices_from,
  135. diagflat,
  136. diagonal,
  137. diff,
  138. digitize,
  139. divide,
  140. divmod,
  141. dot,
  142. double,
  143. dsplit,
  144. dstack,
  145. dtype,
  146. dtypes,
  147. e,
  148. ediff1d,
  149. einsum,
  150. einsum_path,
  151. emath,
  152. empty_like,
  153. equal,
  154. errstate,
  155. euler_gamma,
  156. exceptions,
  157. exp,
  158. exp2,
  159. expand_dims,
  160. expm1,
  161. extract,
  162. f2py,
  163. fabs,
  164. fft,
  165. fill_diagonal,
  166. finfo,
  167. fix,
  168. flatiter,
  169. flatnonzero,
  170. flexible,
  171. flip,
  172. fliplr,
  173. flipud,
  174. float16,
  175. float32,
  176. float64,
  177. float128,
  178. float_power,
  179. floating,
  180. floor,
  181. floor_divide,
  182. fmax,
  183. fmin,
  184. fmod,
  185. format_float_positional,
  186. format_float_scientific,
  187. frexp,
  188. from_dlpack,
  189. frombuffer,
  190. fromfile,
  191. fromfunction,
  192. fromiter,
  193. frompyfunc,
  194. fromregex,
  195. fromstring,
  196. full,
  197. full_like,
  198. gcd,
  199. generic,
  200. genfromtxt,
  201. geomspace,
  202. get_include,
  203. get_printoptions,
  204. getbufsize,
  205. geterr,
  206. geterrcall,
  207. gradient,
  208. greater,
  209. greater_equal,
  210. half,
  211. hamming,
  212. hanning,
  213. heaviside,
  214. histogram,
  215. histogram2d,
  216. histogram_bin_edges,
  217. histogramdd,
  218. hsplit,
  219. hstack,
  220. hypot,
  221. i0,
  222. iinfo,
  223. imag,
  224. in1d,
  225. index_exp,
  226. indices,
  227. inexact,
  228. inf,
  229. info,
  230. inner,
  231. insert,
  232. int8,
  233. int16,
  234. int32,
  235. int64,
  236. int_,
  237. intc,
  238. integer,
  239. interp,
  240. intersect1d,
  241. intp,
  242. invert,
  243. is_busday,
  244. isclose,
  245. iscomplex,
  246. iscomplexobj,
  247. isdtype,
  248. isfinite,
  249. isfortran,
  250. isin,
  251. isinf,
  252. isnan,
  253. isnat,
  254. isneginf,
  255. isposinf,
  256. isreal,
  257. isrealobj,
  258. isscalar,
  259. issubdtype,
  260. iterable,
  261. ix_,
  262. kaiser,
  263. kron,
  264. lcm,
  265. ldexp,
  266. left_shift,
  267. less,
  268. less_equal,
  269. lexsort,
  270. lib,
  271. linalg,
  272. linspace,
  273. little_endian,
  274. load,
  275. loadtxt,
  276. log,
  277. log1p,
  278. log2,
  279. log10,
  280. logaddexp,
  281. logaddexp2,
  282. logical_and,
  283. logical_not,
  284. logical_or,
  285. logical_xor,
  286. logspace,
  287. long,
  288. longdouble,
  289. longlong,
  290. ma,
  291. mask_indices,
  292. matmul,
  293. matrix,
  294. matrix_transpose,
  295. matvec,
  296. max,
  297. maximum,
  298. may_share_memory,
  299. mean,
  300. median,
  301. memmap,
  302. meshgrid,
  303. mgrid,
  304. min,
  305. min_scalar_type,
  306. minimum,
  307. mintypecode,
  308. mod,
  309. modf,
  310. moveaxis,
  311. multiply,
  312. nan,
  313. nan_to_num,
  314. nanargmax,
  315. nanargmin,
  316. nancumprod,
  317. nancumsum,
  318. nanmax,
  319. nanmean,
  320. nanmedian,
  321. nanmin,
  322. nanpercentile,
  323. nanprod,
  324. nanquantile,
  325. nanstd,
  326. nansum,
  327. nanvar,
  328. ndarray,
  329. ndenumerate,
  330. ndim,
  331. ndindex,
  332. nditer,
  333. negative,
  334. nested_iters,
  335. newaxis,
  336. nextafter,
  337. nonzero,
  338. not_equal,
  339. number,
  340. object_,
  341. ogrid,
  342. ones_like,
  343. outer,
  344. packbits,
  345. pad,
  346. partition,
  347. percentile,
  348. permute_dims,
  349. pi,
  350. piecewise,
  351. place,
  352. poly,
  353. poly1d,
  354. polyadd,
  355. polyder,
  356. polydiv,
  357. polyfit,
  358. polyint,
  359. polymul,
  360. polynomial,
  361. polysub,
  362. polyval,
  363. positive,
  364. pow,
  365. power,
  366. printoptions,
  367. prod,
  368. promote_types,
  369. ptp,
  370. put,
  371. put_along_axis,
  372. putmask,
  373. quantile,
  374. r_,
  375. rad2deg,
  376. radians,
  377. random,
  378. ravel,
  379. ravel_multi_index,
  380. real,
  381. real_if_close,
  382. rec,
  383. recarray,
  384. reciprocal,
  385. record,
  386. remainder,
  387. repeat,
  388. require,
  389. reshape,
  390. resize,
  391. result_type,
  392. right_shift,
  393. rint,
  394. roll,
  395. rollaxis,
  396. roots,
  397. rot90,
  398. round,
  399. row_stack,
  400. s_,
  401. save,
  402. savetxt,
  403. savez,
  404. savez_compressed,
  405. sctypeDict,
  406. searchsorted,
  407. select,
  408. set_printoptions,
  409. setbufsize,
  410. setdiff1d,
  411. seterr,
  412. seterrcall,
  413. setxor1d,
  414. shape,
  415. shares_memory,
  416. short,
  417. show_config,
  418. show_runtime,
  419. sign,
  420. signbit,
  421. signedinteger,
  422. sin,
  423. sinc,
  424. single,
  425. sinh,
  426. size,
  427. sort,
  428. sort_complex,
  429. spacing,
  430. split,
  431. sqrt,
  432. square,
  433. squeeze,
  434. stack,
  435. std,
  436. str_,
  437. strings,
  438. subtract,
  439. sum,
  440. swapaxes,
  441. take,
  442. take_along_axis,
  443. tan,
  444. tanh,
  445. tensordot,
  446. test,
  447. testing,
  448. tile,
  449. timedelta64,
  450. trace,
  451. transpose,
  452. trapezoid,
  453. trapz,
  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. _T = TypeVar("_T", bound=np.generic)
  507. _Matrix: TypeAlias = np.matrix[tuple[int, int], np.dtype[_T]]
  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[_T], order: _Order = "C") -> _Matrix[_T]: ...
  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[_T], order: _Order = "C") -> _Matrix[_T]: ...
  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[_T], order: _Order = "C") -> _Matrix[_T]: ...
  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[_T]) -> _Matrix[_T]: ...
  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[_T], order: _Order = "C") -> _Matrix[_T]: ...
  549. @overload
  550. def eye(n: int, M: int | None = None, k: int = 0, *, dtype: _DTypeLike[_T], order: _Order = "C") -> _Matrix[_T]: ...
  551. @overload
  552. def eye(n: int, M: int | None = None, k: int = 0, dtype: npt.DTypeLike = ..., 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[_T], m: int, n: int) -> _Matrix[_T]: ...
  566. @overload
  567. def repmat(a: _ArrayLike[_T], m: int, n: int) -> npt.NDArray[_T]: ...
  568. @overload
  569. def repmat(a: npt.ArrayLike, m: int, n: int) -> npt.NDArray[Any]: ...