Skip to content
This repository was archived by the owner on Dec 7, 2021. It is now read-only.

SummedOp: equals should capture sums of matrices #1095

Closed
Cryoris opened this issue Jul 3, 2020 · 1 comment · Fixed by #1111
Closed

SummedOp: equals should capture sums of matrices #1095

Cryoris opened this issue Jul 3, 2020 · 1 comment · Fixed by #1111
Labels

Comments

@Cryoris
Copy link
Contributor

Cryoris commented Jul 3, 2020

What is the expected enhancement?

>>> from qiskit.aqua.operators import MatrixOp
>>> op = MatrixOp([[1, 0], [0, 0]])
>>> (2 * op) == (op + op)
False  # should be True

This is done for PauliOps as part of #1059 but should be extended to MatrixOps.
One possible implementation is to adapt SummedOp.collapse_summands to sum up all MatrixOps to one.

@romainfd
Copy link
Contributor

romainfd commented Jul 9, 2020

Hey @Cryoris, could I give this a try?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants