Implement multiply-controlled gates
ControlledGate class allows creation of a controlled gate from any arbitrary gate. However it currently only supports one control bit. This obviously needs to be generalized to support multiple control bits. This will also require an easy to use interface specifying which bits are the control bits.
I think by default when creating a
ControlledGate the first
n qubits should automatically be the control qubits, where
n is the number of control qubits. But there needs to be an easy to use mechanism that returns copies of the controlled gate with the order of the control bits modified. For the current single-controlled
ControlledGate there is a
swap=True argument that swaps the order of the control bit and the gate being controlled. But I think
swap needs to be removed in favor of a more general implementation.
I recommend keyword arguments with the same names as the 'labels' used to identify the control bits in a circuit. The values of those arguments would simply refer to which qubit (starting from 0 up to
n_qubits - 1) that control bit is on.