Skip to content

Commit

Permalink
change all (deprecated) np.product occurrences to np.prod
Browse files Browse the repository at this point in the history
  • Loading branch information
Mansour Benbakoura committed Oct 15, 2024
1 parent 5a64fbe commit 6a62c31
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions benchmarks/other/sporco/admm/admm.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def __init__(self, Nx, yshape, ushape, dtype, opt=None):
self.Nx = Nx
# Working variable U has the same dimensionality as constant c
# in the constraint Ax + By = c
self.Nc = np.product(np.array(ushape))
self.Nc = np.prod(np.array(ushape))

# DataType option overrides data type inferred from __init__
# parameters of derived class
Expand Down Expand Up @@ -861,7 +861,7 @@ def __init__(self, xshape, dtype, opt=None):

if opt is None:
opt = ADMMEqual.Options()
Nx = np.product(np.array(xshape))
Nx = np.prod(np.array(xshape))
super(ADMMEqual, self).__init__(Nx, xshape, xshape, dtype, opt)


Expand Down
2 changes: 1 addition & 1 deletion benchmarks/other/sporco/admm/parcbpdn.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def mpraw_as_np(shape, dtype):
Numpy array
"""

sz = int(np.product(shape))
sz = int(np.prod(shape))
csz = sz * np.dtype(dtype).itemsize
raw = mp.RawArray('c', csz)
return np.frombuffer(raw, dtype=dtype, count=sz).reshape(shape)
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/other/sporco/dictlrn/prlcnscdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def mpraw_as_np(shape, dtype):
Numpy array
"""

sz = int(np.product(shape))
sz = int(np.prod(shape))
csz = sz * np.dtype(dtype).itemsize
raw = mp.RawArray('c', csz)
return np.frombuffer(raw, dtype=dtype, count=sz).reshape(shape)
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/other/sporco/prox.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def ndto2d(x, axis=-1):
# Reshape into a 2D array with the axes specified by the axis
# parameter flattened into an index along rows, and the remaining
# axes flattened into an index aalong the columns
xtr = xt.reshape((np.product(xts[0:len(caxis)]), -1))
xtr = xt.reshape((np.prod(xts[0:len(caxis)]), -1))
# Return reshaped array and a tuple containing the information
# necessary to undo the entire operation
return xtr, (xts, prm)
Expand Down
2 changes: 1 addition & 1 deletion dicodile/utils/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def init_dictionary(X, n_atoms, atom_support, random_state=None):
X_std = X.std()
n_channels, *sig_support = X.shape
valid_support = get_valid_support(sig_support, atom_support)
n_patches = np.product(valid_support)
n_patches = np.prod(valid_support)

indices = iter(rng.choice(n_patches, size=10 * n_atoms, replace=False))
D = np.empty(shape=(n_atoms, n_channels, *atom_support))
Expand Down

0 comments on commit 6a62c31

Please sign in to comment.