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