[docs] Document argument ordering for controlled rotation gates#4560
Open
qubeena07 wants to merge 1 commit into
Open
[docs] Document argument ordering for controlled rotation gates#4560qubeena07 wants to merge 1 commit into
qubeena07 wants to merge 1 commit into
Conversation
Fixes NVIDIA#2285. The angle parameter for parametric controlled gates (rx, ry, rz, r1) was undocumented. Added code examples in both Python and C++ tabs of the Adjoint and Controlled Operations section showing that the rotation angle must be passed as the first argument, before control and target qubits. Signed-off-by: Dipika Ranabhat <qubeena7@gmail.com>
a84535f to
51afff5
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2285.
Summary
The
Adjoint and Controlled Operationssection indefault_ops.rstdid not show how to use parametric controlled gates (rx,ry,rz,r1). The argument ordering was unclear because there was no example with an angle parameter.Added code examples in both the Python and C++ tabs showing that the rotation angle must be passed as the first argument, before control qubit(s) and the target qubit.
Python:
C++:
rx<cudaq::ctrl>(M_PI_2, ctrl_1, target); ry<cudaq::ctrl>(M_PI_4, ctrl_1, target); rz<cudaq::ctrl>(M_PI / 8, ctrl_1, target);The argument ordering was verified against the existing test in
python/tests/mlir/ctrl_gates.py.