Skip to content

Commit

Permalink
Use np.prod instead of np.product
Browse files Browse the repository at this point in the history
  • Loading branch information
timmens committed Mar 4, 2024
1 parent de9a346 commit 5fc72cb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/estimagic/parameters/block_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def matrix_to_block_tree(matrix, outer_tree, inner_tree):
shapes_outer = [np.shape(a) for a in flat_outer_np]
shapes_inner = [np.shape(a) for a in flat_inner_np]

block_bounds_outer = np.cumsum([int(np.product(s)) for s in shapes_outer[:-1]])
block_bounds_inner = np.cumsum([int(np.product(s)) for s in shapes_inner[:-1]])
block_bounds_outer = np.cumsum([int(np.prod(s)) for s in shapes_outer[:-1]])
block_bounds_inner = np.cumsum([int(np.prod(s)) for s in shapes_inner[:-1]])

blocks = []
for leaf_outer, s1, submat in zip(
Expand Down Expand Up @@ -94,8 +94,8 @@ def hessian_to_block_tree(hessian, f_tree, params_tree):
shapes_f = [np.shape(a) for a in flat_f_np]
shapes_p = [np.shape(a) for a in flat_p_np]

block_bounds_f = np.cumsum([int(np.product(s)) for s in shapes_f[:-1]])
block_bounds_p = np.cumsum([int(np.product(s)) for s in shapes_p[:-1]])
block_bounds_f = np.cumsum([int(np.prod(s)) for s in shapes_f[:-1]])
block_bounds_p = np.cumsum([int(np.prod(s)) for s in shapes_p[:-1]])

sub_block_trees = []
for s0, subarr in zip(shapes_f, np.split(hessian, block_bounds_f, axis=0)):
Expand Down

0 comments on commit 5fc72cb

Please sign in to comment.