Defined in File gate.hpp
Flgas for gate property: gate is Pauli.
Regulation for argument/qubit/index ordering Read this before treating kronecker product
— arguments — Arguments of create_gate_*** function must be ordered as [control qubit (list), target qubit (list), rotation angle, state, dimension]
E.g. arguments of controlled gate must be ordered as [control qubit, target qubit]. CNOT_gate(0,1) = gate_from_string(“CNOT 0 1”) = control-0 X-1 gate
When we perform gate->add_control(i, value), the operation is performed on the index where its i-th bit is value, i.e. if (index&(1ULL<<i) != 0)
— state — In C/C++, it is useful to order the computational basis so that the RIGHTmost bit is the lowest bit. e.g. state = [ state[0b00], state[0b01], state[0b10], state[0b11] ]
In quantum circuit, we call the TOP-line qubit as the FIRST qubit.
In the braket representation, we consider the RIGHTmost bit in ket represents the FIRST (or TOP-line) qubit in the quantum circuit. state[0b01] = <01|state|01> = the probability with which the TOP-qubit is one, and the second-top qubit is zero.
— gate — To be consistent with the above index ordering, the order of tensor product is *** REVERSED ***.
X_0 has matrix representation : X_0 = I \otimes X = np.kron(I,X) = [0,1,0,0] |00> state [1,0,0,0] |01> state [0,0,0,1] |10> state [0,0,1,0] |11> state
CNOT(0,1) = control-0 target-NOT-1 has matrix representation [1,0,0,0] |00> [0,0,0,1] |01> [0,0,1,0] |10> [0,1,0,0] |11>
X_0 Y_1 Z_2 = np.kron(Z_2, np.kron(Y1, X0))