Skip to content

[docs] Document argument ordering for controlled rotation gates#4560

Open
qubeena07 wants to merge 1 commit into
NVIDIA:mainfrom
qubeena07:fix/controlled-rotation-gate-docs
Open

[docs] Document argument ordering for controlled rotation gates#4560
qubeena07 wants to merge 1 commit into
NVIDIA:mainfrom
qubeena07:fix/controlled-rotation-gate-docs

Conversation

@qubeena07
Copy link
Copy Markdown

Fixes #2285.

Summary

The Adjoint and Controlled Operations section in default_ops.rst did 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:

rx.ctrl(math.pi / 2, ctrl_1, target)
ry.ctrl(math.pi / 4, ctrl_1, target)
rz.ctrl(math.pi / 8, ctrl_1, target)

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.

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented May 20, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

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>
@qubeena07 qubeena07 force-pushed the fix/controlled-rotation-gate-docs branch from a84535f to 51afff5 Compare May 20, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Controlled rotation gate documentation

1 participant