cuda-quantum
cuda-quantum copied to clipboard
[custom op] Support unitary synthesis for 3+ qubit operations
Required prerequisites
- [x] Search the issue tracker to check if your feature has already been mentioned or rejected in other issues.
Describe the feature
Relates to issue #1475
Description
CUDA-Q implements a unitary-synthesis
pass defined here.
As of October 1, 2024, this pass supports decomposition of 1-qubit and 2-qubit custom operations.
Extend this pass by implementing 3-qubit operation synthesis.
Steps:
- Choose an appropriate algorithm. Following references can be considered:
- Cosine-sine decomposition: https://arxiv.org/pdf/quant-ph/0404089
- Quantum Shannon decomposition: https://arxiv.org/pdf/quant-ph/0406176
- Extend the
Decomposer
class with new class which implements the 3-qubit decomposition. - Override
decompose
method which encapsulates the logic for decomposition, and - Override
emitDecomposedFuncOp
method which translates the result into native gate set. - Update caller switch case here. For example,
case 8: {
auto csd = ThreeQubitOpCSD(unitary); // rename according to the chosen algorithm
csd.emitDecomposedFuncOp(customOp, rewriter, funcName);
} break;
- Can reuse the
OneQubitOpZYZ
defined here for any 1-q decomposition. - Following tests should now pass:
- Python: here
- Remove
with pytest.raises(RuntimeError):
and directly invokesample
on line#306. - To run,
python3 -m pytest -rP ../python/tests/backends/test_Quantinuum_LocalEmulation_kernel.py::test_3q_unitary_synthesis
- Remove
- C++: here
- To run,
nvq++ --target quantinuum --emulate targettests/execution/custom_operation_toffoli.cpp && ./a.out
- To run,
- Python: here
- Additional test(s) with random 8x8 unitary matrices should be added.