Using from qiskit.circuit.library I can import MCMT to create short-hand multi controlled gates, e.g.
from qiskit.circuit.library import MCMT c3z = MCMT('z', num_ctrl_qubits=3, num_target_qubits=1) #define the 3-controlled z gate a.k.a. cccz gate c3z.decompose().draw(output='mpl')
if you append this gate to a quantum circuit,
from qiskit import QuantumCircuit circ.clear() circ = QuantumCircuit(4) circ.append(c3z,[0,1,2,3]) circ.draw('mpl')
you see the following:
1.) If I add the line
(see https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.decompose.html) to the above then the code becomes
from qiskit import QuantumCircuit circ.clear() circ = QuantumCircuit(4) circ.append(c3z,[0,1,2,3]) circ.decompose(c3z) circ.draw('mpl')
And I'd expect the output to resemble the first image, not the second. However the circuit is not decomposed by adding this line and I just see the purple rectangle instead.
2.) The cz/ccz gates in Qiskit have a nice appearance:
circ.clear() circ = QuantumCircuit(4) circ.cz(0,1) circ.ccz(0,1,2) circ.draw('mpl')
is there any way to get my c3z gate to follow this trend and look neat and tidy? Many thanks.