forked from NVIDIA/cuda-quantum
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Tensornet backends] Implement contraction path reuse for expectation…
… value calculation (NVIDIA#2397) * Implement the contraction path reuse for tensornet expectation calculation For a multi-term spin_op, we set up a placeholder for the operator to be used for expectation contraction <psi|op|psi>. A single prepare (path finding) is needed. Then, we just replace the placeholder op with the actual Pauli term to compute the expectation value. Bonus: as we do term-per-term contraction, the per-term expectation value is now available for tensornet backends. Thus, populate per-term data in the resulting observe_result. This makes tensornet backends fully-equivalent to others in terms of observe handling. Re-enable a ObserveResult test, which check for fine-grained result access, for tensornet backends. This wasskipped previously as we only have the final expectation value. Signed-off-by: Thien Nguyen <[email protected]> * Code tidy up: remove temporary variable use Signed-off-by: Thien Nguyen <[email protected]> * Remove unnecessary casts Signed-off-by: Thien Nguyen <[email protected]> * Update runtime/nvqir/cutensornet/simulator_cutensornet.cpp Co-authored-by: Eric Schweitz <[email protected]> Signed-off-by: Thien Nguyen <[email protected]> * Code review: simplify the code to load pauli matrix to the placeholder array Signed-off-by: Thien Nguyen <[email protected]> --------- Signed-off-by: Thien Nguyen <[email protected]> Signed-off-by: Thien Nguyen <[email protected]> Co-authored-by: Eric Schweitz <[email protected]>
- Loading branch information
1 parent
4f2104b
commit 79e6999
Showing
6 changed files
with
175 additions
and
134 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 was deleted.
Oops, something went wrong.
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