Separate simplification of operators from SummedOp.add and fix bugs of add#1000
Conversation
|
I also fixed some comments of AbelianGrouper. |
Cryoris
left a comment
There was a problem hiding this comment.
LGTM, thanks for restructuring the tests.
|
Thank you for your feedback! |
|
The spellchecker is complaining about the word |
|
I changed the comment to be clear. |
|
If you looked in the build output then the spell checker did provide alternatives like |
|
Travis failed on Test Aqua 1 Python 3.8 due to the following error. |
|
I'm wondering why results varied even if the seed of simulator is fixed. |
|
This is a great addition, but I think it would probably be more natural to put the new |
…f add (qiskit-community/qiskit-aqua#1000) * removed unnecessary "[]" * separate SummedOp.simplify out from SummedOp.add * simplify * revise comments * add a unit test * revise comments * revise test_op_construction and test_abelian_grouper * revise comments of abelian_grouper * revise a comment * use ddt for test of abelian grouper * revise a comment
…f add (qiskit-community/qiskit-aqua#1000) * removed unnecessary "[]" * separate SummedOp.simplify out from SummedOp.add * simplify * revise comments * add a unit test * revise comments * revise test_op_construction and test_abelian_grouper * revise comments of abelian_grouper * revise a comment * use ddt for test of abelian grouper * revise a comment
…f add (qiskit-community/qiskit-aqua#1000) * removed unnecessary "[]" * separate SummedOp.simplify out from SummedOp.add * simplify * revise comments * add a unit test * revise comments * revise test_op_construction and test_abelian_grouper * revise comments of abelian_grouper * revise a comment * use ddt for test of abelian grouper * revise a comment
…f add (qiskit-community/qiskit-aqua#1000) * removed unnecessary "[]" * separate SummedOp.simplify out from SummedOp.add * simplify * revise comments * add a unit test * revise comments * revise test_op_construction and test_abelian_grouper * revise comments of abelian_grouper * revise a comment * use ddt for test of abelian grouper * revise a comment
Summary
This PR separates same operator check in
SummedOp.addand makes another methodSummedOp.simplifyto summing up same operators.It also fixes all bugs found in #979 and add unit tests.
Fixes #979
minor change: remove unnecessary
[]inallandany.Details and comments
It fixes following bugs.
ListOp.equalsdid not compareListOp.coeff-> FixedSummedOp.addis slow due to linear search and some bugs related to coefficients #979 (comment)SummedOp.adddid not handleSummedOp.coeffcorrectly, especially whencoeff != 1-> FixedSummedOp.addis slow due to linear search and some bugs related to coefficients #979 (comment)SummedOp.adddid not apply simplification in a particular case -> Separate out the simplification as another method and the simplification won't be applied automatically. Note that simplification should not be often invoked because it takes O(n^2) time where n is the number of operators.SummedOp.addis slow due to linear search and some bugs related to coefficients #979 (comment)