NVIDIA/cuda-quantum

clarifying scope of ctrl and adj operations

mmvandieren opened this issue · 1 comments

Required prerequisites

  • Consult the security policy. If reporting a security vulnerability, do not report the bug using this form. Use the process described in the policy to report the issue.
  • Make sure you've read the documentation. Your issue may be addressed there.
  • Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
  • If possible, make a PR with a failing test to give us a starting point to work on!

Describe the bug

The text and example code for the section titled "Adjoint and Controlled Operations" of the documentation on the page https://nvidia.github.io/cuda-quantum/latest/api/default_ops.html doesn't fully clarify the scope of these operations. In particular, both can be applied to kernels in addition to the built in gates.

Steps to reproduce the bug

N/A

Expected behavior

N/A

Is this a regression? If it is, put the last known working version (or commit) here.

Not a regression

Environment

  • CUDA Quantum version: N/A
  • Python version: N/A
  • C++ compiler: N/A
  • Operating system: N/A

Suggestions

Suggested edits to the text:

  • The adj method of any gate or unitary quantum kernel can be used to invoke the adjoint transformation:"
  • The ctrl method of any gate can or quantum kernel be used to apply the transformation conditional on the state of one or more control qubits, see also this Wikipedia entry.

Suggested edits to the code:
Demonstrate the operations applied to both a built-in gate (as is currently demonstrated) and a user-defined kernel

Adding to this issue, there is a lack of clarity (or potential source of confusion) in the documentation that the adj and ctrl only work for the kernel-builder construction of kernels and not with the decorator function kernels. That said, there is no documentation (or it's difficult to locate) where to find the control and adjoint syntax for kernels built as decorated functions in Python.