65 SX::SX(
int qbit_num_in,
int target_qbit_in) {
80 std::stringstream sstream;
81 sstream <<
"The index of the target qubit is larger than the number of qubits" << std::endl;
83 throw "The index of the target qubit is larger than the number of qubits";
131 if (SX_matrix.
isnan()) {
132 std::stringstream sstream;
133 sstream <<
"SX::get_matrix: SX_matrix contains NaN." << std::endl;
154 std::string err(
"SX::apply_to: Wrong input size in SX gate apply.");
180 std::stringstream sstream;
181 sstream <<
"Wrong matrix size in U3 apply_from_right" << std::endl;
295 u3_1qbit[0].real = 0.5; u3_1qbit[0].imag = 0.5;
296 u3_1qbit[1].real = 0.5; u3_1qbit[1].imag = -0.5;
297 u3_1qbit[2].real = 0.5; u3_1qbit[2].imag = -0.5;
298 u3_1qbit[3].real = 0.5;u3_1qbit[3].imag = 0.5;
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.
SX()
NullaRX constructor of the class.
void print(const std::stringstream &sstream, int verbose_level=1) const
Call to print output messages in the function of the verbosity level.
void apply_to(Matrix &input, int parallel)
Call to apply the gate on the input array/matrix by U3*input.
Matrix get_matrix()
Call to retrieve the gate matrix.
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.
SX * 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.
Header file for a class representing the SX axis.
int target_qbit
The index of the qubit on which the operation acts (target_qbit >= 0)
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) ...
Matrix calc_one_qubit_u3()
Set static values for matrix of the gates.
int matrix_size
The size N of the NxN matrix associated with the operations.
void reorder_qubits(std::vector< int > qbit_list)
Call to reorder the qubits in the matrix of the gate.
gate_type type
The type of the operation (see enumeration gate_type)
int rows
The number of rows.
int cols
The number of columns.
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 ...
~SX()
Destructor of the class.
int Power_of_2(int n)
Calculates the n-th power of 2.
Class to store data of complex arrays and its properties.
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_parents(std::vector< Gate *> &parents_)
Call to set the parents of the current gate.
void set_qbit_num(int qbit_num_in)
Call to set the number of qubits spanning the matrix of the gate.
int qbit_num
number of qubits spanning the matrix of the operation
void apply_from_right(Matrix &input)
Call to apply the gate on the input array/matrix by input*U3.
A class representing a U3 gate.
virtual void reorder_qubits(std::vector< int > qbit_list)
Call to reorder the qubits in the matrix of the operation.