Skip to content

Commit

Permalink
replace numpy.product by numpy.prod
Browse files Browse the repository at this point in the history
Numpy.product is deprecated and will be replaced by numpy.prod as of Numpy 2.0.
  • Loading branch information
gertjanvanzwieten committed Feb 9, 2024
1 parent dc1c829 commit 4855ec7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nutils/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def prod(self, __axis: int) -> 'Array':
:class:`Array`
'''

return numpy.product(self, __axis)
return numpy.prod(self, __axis)

def dot(self, __other: IntoArray, axes: Optional[Union[int, Sequence[int]]] = None) -> 'Array':
'''Return the inner product of the arguments over the given axes, elementwise over the remanining axes.
Expand Down Expand Up @@ -2103,7 +2103,7 @@ def sum(__arg: IntoArray, axis: Optional[Union[int, Sequence[int]]] = None) -> A
return summed


@_use_instead('numpy.product')
@_use_instead('numpy.prod')
def product(__arg: IntoArray, axis: int) -> Array:
'''Return the product of array elements over the given axes.
Expand Down Expand Up @@ -4256,6 +4256,7 @@ def sum(arg: IntoArray, axis: Optional[Union[int, Sequence[int]]] = None) -> Arr
summed = _Wrapper(evaluable.Sum, summed, shape=summed.shape[:-1], dtype=summed.dtype)
return summed

@implements(numpy.prod)
@implements(numpy.product)
def product(arg: IntoArray, axis: int) -> Array:
arg = Array.cast(arg)
Expand Down

0 comments on commit 4855ec7

Please sign in to comment.