-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade and generalise basis state preparation (#6021)
This PR complete part of this story: [[sc-68521](https://app.shortcut.com/xanaduai/story/68521)] Goal: `BasisEmbedding` is an alias of `BasisState`. This way, we don't have duplicate code that does the same thing. In unifying this, I have had to modify some tests due to: - `BasisEmbedding` and `BasisState` throw errors such as "incorrect length" with different messages. Now it will always be the same. (test modified for this reason: `test_default_qubit_legacy.py`, `test_default_qubit_tf.py` `test_default_qubit_torch.py`, `test_state_prep.py`, `test_all_singles_doubles.py` and test_uccsd`) - In `BasisEmbedding`, errors were thrown in `__init__` while in BasisState in `state_vector`. Now they are unified in `__init__`. For this reason, there were tests where the operator was not initialized correctly but no error was thrown since `state_vector` was not being called but now they are detected. To correct this, I have modified the tests: `test_qscript.py`, `test_state_prep.py`, - Now `BasisState` does not decompose `BasisStatePreparation` since we are going to deprecate it. This causes the number of gates after expanding to be affected. In this case I had to modify some test in `test_tape.py`. This PR also solves: - [issue 6008](#6008) - [issue 6007](#6007) - [issue 6006](#6006) --------- Co-authored-by: Isaac De Vlugt <[email protected]> Co-authored-by: soranjh <[email protected]> Co-authored-by: Utkarsh <[email protected]>
- Loading branch information
1 parent
8bd226c
commit f00c924
Showing
12 changed files
with
127 additions
and
168 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
Oops, something went wrong.