Skip to content

Conversation

Zeroto521
Copy link
Contributor

fix #1058

Implements the __matmul__ method for MatrixExpr, enabling matrix multiplication using the @ operator and ensuring the result is returned as a MatrixExpr instance.
Adds tests to verify that matrix multiplication returns MatrixExpr instead of MatrixVariable for various input shapes.
Replaces isinstance checks with type() comparisons for MatrixExpr in matrix matmul return type tests to ensure exact type matching.
Corrects the shapes of matrix variables in test_matrix_matmul_return_type to ensure proper 2D matrix multiplication and type assertion.
Copy link
Collaborator

@Opt-Mucca Opt-Mucca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy with this change! (Would like an answer to type vs isinstance first though)

Thanks for the contribution!

@Joao-Dionisio Joao-Dionisio enabled auto-merge (squash) October 9, 2025 13:08
@Joao-Dionisio Joao-Dionisio merged commit 73356c6 into scipopt:master Oct 9, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: the result of @ can't access .vtype method
3 participants