-
Notifications
You must be signed in to change notification settings - Fork 615
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Legacy operator arithmetic deprecation (#6287)
**Context:** Legacy op math is being deprecated. **Description of the Change:** * `qml.ops.Hamiltonian` is deprecated. * `qml.operation.Tensor` is deprecated. * `qml.operation.disable_new_opmath` and `qml.operation.enable_new_opmath` (as well as the context managers) are deprecated. * `qml.operation.convert_to_legacy_H` is deprecated. * `PauliWord.hamiltonian` and `PauliSentence.hamiltonian` is deprecated. * `qml.pauli.simplify` is deprecated. * Removed `use_legacy_opmath` and `use_new_opmath` fixtures. Instead, we use either `legacy_opmath_only`, `new_opmath_only`, or no fixture, as appropriate for the tests. * Added warning suppression for all the above deprecation warnings to `pytest.ini`. Additionally, I also added the same warning suppressions to `conftest.py` for the case when `--disable-opmath=True`, since the warning filters in `pytest.ini` only suppress warnings that come from inside tests, not ones that come from outside the tests, such as when deprecated code is used for creating parameters for a test. **Benefits:** **Possible Drawbacks:** In some instances, there will be a LOT of deprecation warnings at the same time. The most impactful example of this if if using `qml.qchem.molecular_hamiltonian`, `qml.qchem.qubit_observable`. These using `simplify` and `PauliSentence.hamiltonian` with legacy op math, so there will be up to 4 warnings at once when using these. Additionally, `qml.qchem.tapering.symmetry_generators` and `qml.qchem.tapering.clifford` use `PauliSentence.hamiltonian` when legacy op math is enabled, so there will be up to 3 warnings at once when using these. **Related GitHub Issues:** I will run the test suite with `disable_new_opmath` set to `True` once before merging to confirm that legacy op math tests do not fail. [sc-71940] [sc-66727] [sc-66724] --------- Co-authored-by: Pietropaolo Frisoni <[email protected]>
- Loading branch information
1 parent
a8ada6b
commit 9f4e67e
Showing
54 changed files
with
1,283 additions
and
1,686 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.