Feature request: Add out-of-place (i.e. pure) versions of all existing in-place operations
Feature request: Add out-of-place (i.e. pure) versions of all existing in-place operations, such as the following: - https://numpy.org/doc/stable/reference/generated/numpy.fill_diagonal.html - https://numpy.org/doc/stable/reference/generated/numpy.put.html - https://numpy.org/doc/stable/reference/generated/numpy.place.html - https://numpy.org/doc/stable/reference/generated/numpy.put_along_axis.html - https://numpy.org/doc/stable/reference/generated/numpy.putmask.html This can be done by adding a boolean argument to each function called "inplace", which is True by default, but when set to False, makes the function return a modified copy of the array. This is the approach taken by JAX for its counterparts of these functions: - https://jax.readthedocs.io/en/latest/_autosummary/jax.numpy.fill_diagonal.ht... - https://jax.readthedocs.io/en/latest/_autosummary/jax.numpy.put.html - https://jax.readthedocs.io/en/latest/_autosummary/jax.numpy.place.html This would have the following advantages: - Making it easier to perform these operations in a functional way (potentially less error-prone). - Harmonizing the interfaces of NumPy and JAX.
participants (1)
-
Carlos Martin