multiarray.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import numpy as np
  2. import numpy.typing as npt
  3. AR_f8: npt.NDArray[np.float64] = np.array([1.0])
  4. AR_i4 = np.array([1], dtype=np.int32)
  5. AR_u1 = np.array([1], dtype=np.uint8)
  6. AR_LIKE_f = [1.5]
  7. AR_LIKE_i = [1]
  8. b_f8 = np.broadcast(AR_f8)
  9. b_i4_f8_f8 = np.broadcast(AR_i4, AR_f8, AR_f8)
  10. next(b_f8)
  11. b_f8.reset()
  12. b_f8.index
  13. b_f8.iters
  14. b_f8.nd
  15. b_f8.ndim
  16. b_f8.numiter
  17. b_f8.shape
  18. b_f8.size
  19. next(b_i4_f8_f8)
  20. b_i4_f8_f8.reset()
  21. b_i4_f8_f8.ndim
  22. b_i4_f8_f8.index
  23. b_i4_f8_f8.iters
  24. b_i4_f8_f8.nd
  25. b_i4_f8_f8.numiter
  26. b_i4_f8_f8.shape
  27. b_i4_f8_f8.size
  28. np.inner(AR_f8, AR_i4)
  29. np.where([True, True, False])
  30. np.where([True, True, False], 1, 0)
  31. np.lexsort([0, 1, 2])
  32. np.can_cast(np.dtype("i8"), int)
  33. np.can_cast(AR_f8, "f8")
  34. np.can_cast(AR_f8, np.complex128, casting="unsafe")
  35. np.min_scalar_type([1])
  36. np.min_scalar_type(AR_f8)
  37. np.result_type(int, AR_i4)
  38. np.result_type(AR_f8, AR_u1)
  39. np.result_type(AR_f8, np.complex128)
  40. np.dot(AR_LIKE_f, AR_i4)
  41. np.dot(AR_u1, 1)
  42. np.dot(1.5j, 1)
  43. np.dot(AR_u1, 1, out=AR_f8)
  44. np.vdot(AR_LIKE_f, AR_i4)
  45. np.vdot(AR_u1, 1)
  46. np.vdot(1.5j, 1)
  47. np.bincount(AR_i4)
  48. np.copyto(AR_f8, [1.6])
  49. np.putmask(AR_f8, [True], 1.5)
  50. np.packbits(AR_i4)
  51. np.packbits(AR_u1)
  52. np.unpackbits(AR_u1)
  53. np.shares_memory(1, 2)
  54. np.shares_memory(AR_f8, AR_f8, max_work=1)
  55. np.may_share_memory(1, 2)
  56. np.may_share_memory(AR_f8, AR_f8, max_work=1)