Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- `Expr` and `GenExpr` support `__pos__` magic method like `+Expr` or `+GenExpr`
- Added type annotations to most methods on the `Model` class
### Fixed
- Fixed Cython 3.3 compatibility (#1248)
- Made `test_markDoNotAggrVar_and_getStatus` robust to SCIP presolve changes by discovering the aggregated/multi-aggregated variables instead of hardcoding them
### Changed
- Move magic methods (`__radd__`, `__sub__`, `__rsub__`, `__rmul__`, `__richcmp__`, `__neg__`, and `__rtruediv__`) to `ExprLike` base class (#1204)
Expand Down
10 changes: 5 additions & 5 deletions src/pyscipopt/matrix.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -233,23 +233,23 @@ def _core_sum(
a np.ndarray.

"""
axis: Tuple[int, ...] = normalize_axis_tuple(
axis_tuple: Tuple[int, ...] = normalize_axis_tuple(
range(a.ndim) if axis is None else axis, a.ndim
)
if len(axis) == a.ndim:
if len(axis_tuple) == a.ndim:
res = quicksum(a.flat)
return (
np.array([res], dtype=object).reshape([1] * a.ndim)
if keepdims
else res
)

keep_axes = tuple(i for i in range(a.ndim) if i not in axis)
keep_axes = tuple(i for i in range(a.ndim) if i not in axis_tuple)
shape = (
tuple(1 if i in axis else a.shape[i] for i in range(a.ndim))
tuple(1 if i in axis_tuple else a.shape[i] for i in range(a.ndim))
if keepdims
else tuple(a.shape[i] for i in keep_axes)
)
return np.apply_along_axis(
quicksum, -1, a.transpose(keep_axes + axis).reshape(shape + (-1,))
quicksum, -1, a.transpose(keep_axes + axis_tuple).reshape(shape + (-1,))
)
Loading