-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(LK-C-4) Add controlled QubitUnitary support to Lightning Kokkos #955
base: lk-control-gate-NQ-multiRZ
Are you sure you want to change the base?
Conversation
Hello. You may have forgotten to update the changelog!
|
42f9cd3
to
23f398c
Compare
8807e39
to
07c38a1
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## lk-control-gate-NQ-multiRZ #955 +/- ##
==============================================================
+ Coverage 97.01% 97.04% +0.02%
==============================================================
Files 221 221
Lines 34438 34787 +349
==============================================================
+ Hits 33410 33758 +348
- Misses 1028 1029 +1 ☔ View full report in Codecov by Sentry. |
23f398c
to
bc9d408
Compare
07c38a1
to
ce9250e
Compare
@@ -104,6 +111,71 @@ template <class Precision> struct multiQubitOpFunctor { | |||
} | |||
}; | |||
|
|||
template <class Precision> struct NCMultiQubitOpFunctor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This construction is similar to multiQubitOpFunctor
@@ -142,6 +214,51 @@ template <class PrecisionT> struct apply1QubitOpFunctor { | |||
arr(i1) = matrix(0B10) * v0 + matrix(0B11) * v1; | |||
} | |||
}; | |||
|
|||
template <class PrecisionT> struct applyNC1QubitOpFunctor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this with apply1QubitOpFunctor
etc.
Before submitting
Please complete the following checklist when submitting a PR:
All new features must include a unit test.
If you've fixed a bug or added code that should be tested, add a test to the
tests
directory!All new functions and code must be clearly commented and documented.
If you do make documentation changes, make sure that the docs build and
render correctly by running
make docs
.Ensure that the test suite passes, by running
make test
.Add a new entry to the
.github/CHANGELOG.md
file, summarizing thechange, and including a link back to the PR.
Ensure that code is properly formatted by running
make format
.When all the above are checked, delete everything above the dashed
line and fill in the pull request template.
Context:
Description of the Change:
This PR adds support for controlled QubitUnitary for Lightning Kokkos. There are specialized implementations for 1/2/3-qubits (
applyNC1/2/3QubitOpFunctor
) and a general case implementation (NCMultiQubitOpFunctor
). These functors are defined inMatrixGateFunctors.hpp
. These are called byapplyControlledMatrix
orapplyOperation
/applyNCMultiQubitOp
inStateVectorKokkos.hpp
Benefits:
Performance benchmarks for gates are shown here: https://www.notion.so/xanaduai/Lightning-Kokkos-Native-Controlled-Operation-Gate-Benchmarks-12ebc6bd17648017a2dcd237748b24fe
Possible Drawbacks:
Related GitHub Issues:
[sc-76776]