65 CNOT::CNOT(
int qbit_num_in,
int target_qbit_in,
int control_qbit_in) {
84 std::stringstream sstream;
85 sstream <<
"The index of the target qubit is larger than the number of qubits" << std::endl;
95 std::stringstream sstream;
96 sstream <<
"The index of the control qubit is larger than the number of qubits" << std::endl;
120 return get_matrix(
false );
152 std::string err(
"CNOT::apply_to: Wrong input size in CNOT gate apply.");
157 Matrix u3_1qbit = calc_one_qubit_u3();
158 apply_kernel_to(u3_1qbit, input,
false, parallel);
174 Matrix u3_1qbit = calc_one_qubit_u3();
175 apply_kernel_from_right(u3_1qbit, input);
214 u3_1qbit[0].real = 0.0; u3_1qbit[0].imag = 0.0;
215 u3_1qbit[1].real = 1.0; u3_1qbit[1].imag = 0.0;
216 u3_1qbit[2].real = 1.0; u3_1qbit[2].imag = 0.0;
217 u3_1qbit[3].real = 0.0; u3_1qbit[3].imag = 0.0;
229 ret->set_parameter_start_idx( get_parameter_start_idx() );
230 ret->set_parents( parents );
231 ret->set_children( children );
Matrix calc_one_qubit_u3()
Set static values for matrix of the gates.
parameter_num
[set adaptive gate structure]
virtual void set_qbit_num(int qbit_num_in)
Set the number of qubits spanning the matrix of the operation.
virtual void apply_to(Matrix &input, int parallel)
Call to apply the gate on the input array/matrix by CNOT*input.
Header file for a class representing a CNOT operation.
int rows
The number of rows.
virtual void reorder_qubits(std::vector< int > qbit_list)
Call to reorder the qubits in the matrix of the operation.
virtual void apply_from_right(Matrix &input)
Call to apply the gate on the input array/matrix by input*CNOT.
virtual CNOT * clone()
Call to create a clone of the present class.
def apply_to(self, parameters_mtx, unitary_mtx, parallel=1)
virtual void set_qbit_num(int qbit_num)
Call to set the number of qubits spanning the matrix of the operation.
int Power_of_2(int n)
Calculates the n-th power of 2.
CNOT()
Nullary constructor of the class.
Class to store data of complex arrays and its properties.
Matrix create_identity(int matrix_size)
Call to create an identity matrix.
virtual ~CNOT()
Destructor of the class.
Matrix get_matrix()
Call to retrieve the operation matrix.
virtual void reorder_qubits(std::vector< int > qbit_list)
Call to reorder the qubits in the matrix of the operation.