cunumpy 0.7.0__tar.gz → 0.7.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. {cunumpy-0.7.0/src/cunumpy.egg-info → cunumpy-0.7.1}/PKG-INFO +1 -1
  2. {cunumpy-0.7.0 → cunumpy-0.7.1}/pyproject.toml +1 -1
  3. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_algorithms.py +18 -1
  4. {cunumpy-0.7.0 → cunumpy-0.7.1/src/cunumpy.egg-info}/PKG-INFO +1 -1
  5. {cunumpy-0.7.0 → cunumpy-0.7.1}/LICENSE.txt +0 -0
  6. {cunumpy-0.7.0 → cunumpy-0.7.1}/README.md +0 -0
  7. {cunumpy-0.7.0 → cunumpy-0.7.1}/setup.cfg +0 -0
  8. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/LLM_GUIDE.md +0 -0
  9. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/__init__.py +0 -0
  10. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/__init__.pyi +0 -0
  11. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_cuda_kernel.py +0 -0
  12. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_device.py +0 -0
  13. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_dispatch.py +0 -0
  14. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_emulation.py +0 -0
  15. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_fake_cupy.py +0 -0
  16. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_fake_cupy_impl.py +0 -0
  17. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_fake_cupyx.py +0 -0
  18. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_fusion.py +0 -0
  19. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_host.py +0 -0
  20. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_kernel.py +0 -0
  21. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_linalg.py +0 -0
  22. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_metal_kernel.py +0 -0
  23. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_mirror.py +0 -0
  24. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_morton.py +0 -0
  25. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_mpi.py +0 -0
  26. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_optimize.py +0 -0
  27. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_philox.py +0 -0
  28. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_profiling.py +0 -0
  29. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_pyccel_cache.py +0 -0
  30. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_random_streams.py +0 -0
  31. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_scipy_backend.py +0 -0
  32. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_scipy_host.py +0 -0
  33. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_staging.py +0 -0
  34. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_streams.py +0 -0
  35. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/_transfers.py +0 -0
  36. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/algorithms.py +0 -0
  37. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/arguments.py +0 -0
  38. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/cuda/__init__.py +0 -0
  39. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/cuda/include/cunumpy/array_view.cuh +0 -0
  40. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/cuda/include/cunumpy/atomic.cuh +0 -0
  41. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/cuda/include/cunumpy/index.cuh +0 -0
  42. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/cuda/include/cunumpy/morton.cuh +0 -0
  43. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/cuda/include/cunumpy/random.cuh +0 -0
  44. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/cuda/include/cunumpy/reduce.cuh +0 -0
  45. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/cuda/include/cunumpy/scan.cuh +0 -0
  46. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/integrate.py +0 -0
  47. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/kernel_testing.py +0 -0
  48. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/kernels.py +0 -0
  49. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/memory.py +0 -0
  50. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/mpi.py +0 -0
  51. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/optimize.py +0 -0
  52. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/petsc.py +0 -0
  53. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/profiling.py +0 -0
  54. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/py.typed +0 -0
  55. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/rng.py +0 -0
  56. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy/xp.py +0 -0
  57. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy.egg-info/SOURCES.txt +0 -0
  58. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy.egg-info/dependency_links.txt +0 -0
  59. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy.egg-info/requires.txt +0 -0
  60. {cunumpy-0.7.0 → cunumpy-0.7.1}/src/cunumpy.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cunumpy
3
- Version: 0.7.0
3
+ Version: 0.7.1
4
4
  Summary: Simple wrapper for numpy and cupy. Replace `import numpy as np` with `import cunumpy as xp`.
5
5
  Author: Max
6
6
  License: MIT License
@@ -5,7 +5,7 @@ requires = [ "setuptools", "wheel" ]
5
5
 
6
6
  [project]
7
7
  name = "cunumpy"
8
- version = "0.7.0"
8
+ version = "0.7.1"
9
9
  description = "Simple wrapper for numpy and cupy. Replace `import numpy as np` with `import cunumpy as xp`."
10
10
  readme = "README.md"
11
11
  keywords = [ "python" ]
@@ -380,6 +380,8 @@ def sort_by_key(keys: Any, *arrays: Any, axis: int = 0) -> tuple[Any, ...]:
380
380
  radix sort; on NumPy, integer keys of more than 4096 entries get an LSD
381
381
  radix sort too (one stable ``uint16`` argsort per 16-bit digit the key range
382
382
  needs), about ten times faster than NumPy's stable sort of 64-bit integers.
383
+ On NumPy, a 2-D array sorted along its last axis (component-major markers) is
384
+ gathered row by row, about twice as fast as ``take`` along that axis.
383
385
 
384
386
  Parameters
385
387
  ----------
@@ -437,12 +439,27 @@ def sort_by_key(keys: Any, *arrays: Any, axis: int = 0) -> tuple[Any, ...]:
437
439
  keys[order],
438
440
  order,
439
441
  *(
440
- xpm.take(array, order, axis=array_axis)
442
+ _take_along_axis(xpm, array, order, array_axis)
441
443
  for array, array_axis in zip(arrays, axes, strict=True)
442
444
  ),
443
445
  )
444
446
 
445
447
 
448
+ def _take_along_axis(xpm: Any, array: Any, order: Any, axis: int) -> Any:
449
+ """Return `array` taken at `order` along `axis`, as a new C-contiguous array.
450
+
451
+ A component-major ``(ncomp, n)`` NumPy array is gathered one contiguous row at a
452
+ time, which is about twice as fast as ``take`` along its last axis; everything
453
+ else, and CuPy, goes through ``take``.
454
+ """
455
+ if xpm is np and array.ndim == 2 and axis == 1:
456
+ gathered = np.empty((array.shape[0], order.shape[0]), dtype=array.dtype)
457
+ for row in range(array.shape[0]):
458
+ gathered[row] = array[row][order]
459
+ return gathered
460
+ return xpm.take(array, order, axis=axis)
461
+
462
+
446
463
  def compact_by_mask(mask: Any, *arrays: Any, axis: int = 0) -> int:
447
464
  """Move the entries where `mask` is True to the front of every array, in place.
448
465
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cunumpy
3
- Version: 0.7.0
3
+ Version: 0.7.1
4
4
  Summary: Simple wrapper for numpy and cupy. Replace `import numpy as np` with `import cunumpy as xp`.
5
5
  Author: Max
6
6
  License: MIT License
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes