51 CP::CP(
int qbit_num_in,
int target_qbit_in,
int control_qbit_in) :
U1(qbit_num_in, target_qbit_in) {
62 std::stringstream sstream;
63 sstream <<
"The index of the control qubit is larger than the number of qubits" << std::endl;
std::vector< Gate * > parents
list of parent gates to be applied in the circuit prior to this current gate
CP()
Nullary constructor of the class.
Header file for a class representing a CP gate.
void print(const std::stringstream &sstream, int verbose_level=1) const
Call to print output messages in the function of the verbosity level.
A class representing a CP gate.
int control_qbit
The index of the qubit which acts as a control qubit (control_qbit >= 0) in controlled operations...
void set_children(std::vector< Gate *> &children_)
Call to set the children of the current gate.
int target_qbit
The index of the qubit on which the operation acts (target_qbit >= 0)
~CP() override
Destructor of the class.
gate_type type
The type of the operation (see enumeration gate_type)
virtual CP * clone() override
Call to create a clone of the present class.
void set_parameter_start_idx(int start_idx)
Call to set the starting index of the parameters in the parameter array corresponding to the circuit ...
int get_parameter_start_idx()
Call to get the starting index of the parameters in the parameter array corresponding to the circuit ...
std::string name
A string labeling the gate operation.
std::vector< Gate * > children
list of child gates to be applied after this current gate
int parameter_num
the number of free parameters of the operation
void set_parents(std::vector< Gate *> &parents_)
Call to set the parents of the current gate.
int qbit_num
number of qubits spanning the matrix of the operation