This version has the following changes:
-
Bug fix in the controlled rotation gates where if the target index was smaller than the control index, it would throw an error.
-
Now you do not need to specify anymore the number of wires of the custom gate using the circuit class:
Before:
circuit = qf.Circuit(dim=qudit_dimension, wires=your_number_of_qudits)
circuit.Custom(matrix, wires=your_number_of_qudits)
After
circuit = qf.Circuit(dim=qudit_dimension, wires=your_number_of_qudits)
circuit.Custom(matrix)
- Added the controlled universal gate. This gate is the controlled version of the universal gate, you need to specify which control states will be used in order to apply the universal gate on the target qudit. For instance:
dim = 3
wires = 2
CU = qf.CU(dim=dim, index=[0,1], control_state=[1])
initial_state = qf.State('1-0', dim=dim)
output_state = CU(initial_state)
print(output_state)
In the code above, only when the control qudit has state |1> then the universal gate will be applied on the targert qudit.
or
dim = 3
wires = 2
CU = qf.CU(dim=dim, index=[0,1], control_state=[1,2])
initial_state = qf.State('1-0', dim=dim)
output_state = CU(initial_state)
print(output_state)
Now, the universal gate will be applied on the target qudit if control qudit has either the states |1> or |2>.