Skip to content

Commit 6139a43

Browse files
committed
Add __matmul__ support to MatrixExpr
Implements the __matmul__ method for MatrixExpr, enabling matrix multiplication using the @ operator and ensuring the result is returned as a MatrixExpr instance.
1 parent a3c2a48 commit 6139a43

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/pyscipopt/matrix.pxi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ class MatrixExpr(np.ndarray):
9898

9999
def __rsub__(self, other):
100100
return super().__rsub__(other).view(MatrixExpr)
101-
101+
102+
def __matmul__(self, other):
103+
return super().__matmul__(other).view(MatrixExpr)
104+
102105
class MatrixGenExpr(MatrixExpr):
103106
pass
104107

0 commit comments

Comments
 (0)