Parameters in MultiControlledX
See original GitHub issueAs I was inspecting the MultiControlledX
gate, I noticed how it printed out:
MultiControlledX(array([[0, 1],
[1, 0]]), wires=[0, 1, 2, 3])
And was quite confused as to where the array came from. It turns out MultiControlledX
inherits from ControlledQubitUnitary
with the Unitary matrix as an X gate. This makes MultiControlledX
a parametrized gate.
Worse yet, that gate is trainable:
>>> with qml.tape.JacobianTape() as tape:
... qml.MultiControlledX(control_wires=(0,1,2), wires=(3))
>>> tape.trainable_params
{0}
This further indicates to me that how we treat never trainable parameters needs fixing in the long run.
In the short term, we should just remove the inheritance on ControlledQubitUnitary
.
This would involve duplicating only relevant code in ControlledQubitUnitary
and changing the inheritance to Operation
.
List of tasks for completion:
- Change the
MultiControlledX
operation such that it doesn’t inherit fromControlledQubitUnitary
anymore; - Include logic in
MultiControlledX
that is required for its full functionality; - Adjust any tests as required.
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (10 by maintainers)
Top Results From Across the Web
qml.MultiControlledX — PennyLane 0.27.0 documentation
Parameters. control_wires (Union[Wires, Sequence[int], or int]) – Deprecated way to indicate the control wires. Now users should use “wires” to indicate ...
Read more >Use a single wires keyword in MultiControlledX #1679 - GitHub
Currently, the operation MultiControlledX accepts an arbitrary length of wires for control_wires keyword and a single wire for the wires ...
Read more >qiskit.circuit.library.MCXRecursive
Using a single ancilla qubit, the multi-controlled X gate is recursively ... Gate parameters should be int, float, or ParameterExpression ...
Read more >Toffoli simulator - Azure Quantum | Microsoft Learn
... CNOT , and multi-controlled X quantum operations. ... (or -s shortcut) parameter to specify the Toffoli simulator target machine.
Read more >The Uniform Rotation — Data Cybernetics qiskit-algorithms 0.0.13 ...
Apply the dagger (inverse) a multi-controlled X gate depending on conditional binary representation. Parameters. self ( QuantumCircuit ) – either a ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you @antalszava! I will try to tackle the issue and get back if I face any issue.
Thanks @tgag17 ! 👍
I assigned you the issue. Feel free to ask any additional questions here or when you open a PR.