64 Tdg::Tdg(
int qbit_num_in,
int target_qbit_in) {
77 std::stringstream sstream;
78 sstream <<
"The index of the target qubit is larger than the number of qubits" << std::endl;
81 throw "The index of the target qubit is larger than the number of qubits";
128 if (Z_matrix.
isnan()) {
129 std::stringstream sstream;
130 sstream <<
"Tdg::get_matrix: Z_matrix contains NaN." << std::endl;
151 std::string err(
"Tdg::apply_to: Wrong input size in Z gate apply");
176 std::stringstream sstream;
179 std::stringstream sstream;
180 sstream <<
"Wrong matrix size in U3 apply_from_right" << std::endl;
245 u3_1qbit[0].real = 1.0; u3_1qbit[0].imag = 0.0;
246 u3_1qbit[1].real = 0.0; u3_1qbit[1].imag = 0.0;
247 u3_1qbit[2].real = 0.0; u3_1qbit[2].imag = 0.0;
std::vector< Gate * > parents
list of parent gates to be applied in the circuit prior to this current gate
bool isnan()
Call to check the array for NaN entries.
void print(const std::stringstream &sstream, int verbose_level=1) const
Call to print output messages in the function of the verbosity level.
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.
virtual void set_qbit_num(int qbit_num_in)
Set the number of qubits spanning the matrix of the operation.
int target_qbit
The index of the qubit on which the operation acts (target_qbit >= 0)
~Tdg()
Destructor of the class.
void apply_kernel_from_right(Matrix &u3_1qbit, Matrix &input)
Call to apply the gate kernel on the input state or unitary from right (no AVX support) ...
A class representing a U3 gate.
Header file for a class representing the Tdg gate.
Matrix get_matrix()
Call to retrieve the gate matrix.
int matrix_size
The size N of the NxN matrix associated with the operations.
Tdg()
NullaRX constructor of the class.
gate_type type
The type of the operation (see enumeration gate_type)
int rows
The number of rows.
void apply_from_right(Matrix &input)
Call to apply the gate on the input array/matrix by input*U3.
int cols
The number of columns.
void apply_to(Matrix &input, int parallel)
Call to apply the gate on the input array/matrix by U3*input.
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 ...
Tdg * clone()
Call to create a clone of the present class.
int get_parameter_start_idx()
Call to get the starting index of the parameters in the parameter array corresponding to the circuit ...
int Power_of_2(int n)
Calculates the n-th power of 2.
Class to store data of complex arrays and its properties.
Matrix calc_one_qubit_u3()
Set static values for matrix of the gates.
std::string name
A string labeling the gate operation.
std::vector< Gate * > children
list of child gates to be applied after this current gate
void apply_kernel_to(Matrix &u3_1qbit, Matrix &input, bool deriv=false, int parallel=0)
Call to apply the gate kernel on the input state or unitary with optional AVX support.
Matrix create_identity(int matrix_size)
Call to create an identity matrix.
int parameter_num
the number of free parameters of the operation
void set_qbit_num(int qbit_num_in)
Call to set the number of qubits spanning the matrix of the gate.
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
virtual void reorder_qubits(std::vector< int > qbit_list)
Call to reorder the qubits in the matrix of the operation.
void reorder_qubits(std::vector< int > qbit_list)
Call to reorder the qubits in the matrix of the gate.