Skip to content
Open
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 @@ -22,6 +22,7 @@
- Speed up MatrixExpr.add.reduce via quicksum
- Speed up np.ndarray(..., dtype=np.float64) @ MatrixExpr
- MatrixExpr and MatrixExprCons use `__array_ufunc__` protocol to control all numpy.ufunc inputs and outputs
- Set `__array_priority__` for MatrixExpr and MatrixExprCons
### Removed

## 6.0.0 - 2025.xx.yy
Expand Down
4 changes: 4 additions & 0 deletions src/pyscipopt/matrix.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ cnp.import_array()

class MatrixExpr(np.ndarray):

__array_priority__ = 100

def __array_ufunc__(
self,
ufunc: np.ufunc,
Expand Down Expand Up @@ -82,6 +84,8 @@ class MatrixGenExpr(MatrixExpr):

class MatrixExprCons(np.ndarray):

__array_priority__ = 101

def __array_ufunc__(self, ufunc, method, *args, **kwargs):
if method == "__call__":
args = tuple(_ensure_array(arg) for arg in args)
Expand Down
Loading