Sequential Quantum Gate Decomposer  v1.9.6
Powerful decomposition of general unitarias into one- and two-qubit gates gates
List of all members | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
Gates_block Class Reference

A class responsible for grouping two-qubit (CNOT,CZ,CH) and one-qubit gates into layers. More...

#include <Gates_block.h>

Inheritance diagram for Gates_block:
Inheritance graph
[legend]

Public Member Functions

void add_adaptive (int target_qbit, int control_qbit)
 Append a Adaptive gate to the list of gates. More...
 
void add_adaptive_to_front (int target_qbit, int control_qbit)
 Add a Adaptive gate to the front of the list of gates. More...
 
void add_ccx (int target_qbit, const std::vector< int > &control_qbits)
 Append a CCX gate (i.e. More...
 
void add_ccx_to_front (int target_qbit, const std::vector< int > &control_qbits)
 Add a CCX gate (i.e. More...
 
void add_ch (int target_qbit, int control_qbit)
 Append a CH gate (i.e. More...
 
void add_ch_to_front (int target_qbit, int control_qbit)
 Add a CH gate (i.e. More...
 
void add_child (Gate *child)
 Call to add a child gate to the current gate. More...
 
void add_cnot (int target_qbit, int control_qbit)
 Append a CNOT gate gate to the list of gates. More...
 
void add_cnot_to_front (int target_qbit, int control_qbit)
 Add a C_NOT gate gate to the front of the list of gates. More...
 
void add_cp (int target_qbit, int control_qbit)
 Append a CRY gate to the list of gates. More...
 
void add_cp_to_front (int target_qbit, int control_qbit)
 Add a CRY gate to the front of the list of gates. More...
 
void add_cr (int target_qbit, int control_qbit)
 Append a CR gate to the list of gates. More...
 
void add_cr_to_front (int target_qbit, int control_qbit)
 Add a CR gate to the front of the list of gates. More...
 
void add_crot (int target_qbit, int control_qbit)
 Append a CROT gate gate to the list of gates. More...
 
void add_crot_to_front (int target_qbit, int control_qbit)
 Add a CROT gate gate to the front of the list of gates. More...
 
void add_crx (int target_qbit, int control_qbit)
 Append a CRY gate to the list of gates. More...
 
void add_crx_to_front (int target_qbit, int control_qbit)
 Add a CRY gate to the front of the list of gates. More...
 
void add_cry (int target_qbit, int control_qbit)
 Append a CRY gate to the list of gates. More...
 
void add_cry_to_front (int target_qbit, int control_qbit)
 Add a CRY gate to the front of the list of gates. More...
 
void add_crz (int target_qbit, int control_qbit)
 Append a CRY gate to the list of gates. More...
 
void add_crz_to_front (int target_qbit, int control_qbit)
 Add a CRY gate to the front of the list of gates. More...
 
void add_cswap (const std::vector< int > &target_qbits, const std::vector< int > &control_qbits)
 Append a CSWAP gate (Controlled SWAP) to the list of gates. More...
 
void add_cswap_to_front (const std::vector< int > &target_qbits, const std::vector< int > &control_qbits)
 Add a CSWAP gate (Controlled SWAP) to the front of the list of gates. More...
 
void add_cu (int target_qbit, int control_qbit)
 Append a CU gate (i.e. More...
 
void add_cu_to_front (int target_qbit, int control_qbit)
 Add a CU gate (i.e. More...
 
void add_cz (int target_qbit, int control_qbit)
 Append a CZ gate gate to the list of gates. More...
 
void add_cz_to_front (int target_qbit, int control_qbit)
 Add a CZ gate gate to the front of the list of gates. More...
 
void add_gate (Gate *gate)
 Append a general gate to the list of gates. More...
 
void add_gate_nums (std::map< std::string, int > &gate_nums)
 Call to add the number of the individual gate types in the circuit to the map given in the argument. More...
 
void add_gate_to_front (Gate *gate)
 Add an gate to the front of the list of gates. More...
 
void add_gates (std::vector< Gate *> gates_in)
 Append a list of gates to the list of gates. More...
 
void add_gates_to_front (std::vector< Gate *> gates_in)
 Add an array of gates to the front of the list of gates. More...
 
void add_general_operation (const Matrix &operation_mtx, const std::vector< int > &target_qbits=std::vector< int >(), const std::vector< int > &control_qbits=std::vector< int >())
 Append a GENERAL_OPERATION gate with an explicitly provided matrix. More...
 
void add_h (int target_qbit)
 Append a Hadamard gate to the list of gates. More...
 
void add_h_to_front (int target_qbit)
 Add a Hadamard gate to the front of the list of gates. More...
 
void add_parent (Gate *parent)
 Call to add a parent gate to the current gate. More...
 
void add_r (int target_qbit)
 Append a R gate to the list of gates. More...
 
void add_r_to_front (int target_qbit)
 Add a R gate to the front of the list of gates. More...
 
void add_rx (int target_qbit)
 Append a RX gate to the list of gates. More...
 
void add_rx_to_front (int target_qbit)
 Add a RX gate to the front of the list of gates. More...
 
void add_rxx (std::vector< int > target_qbits)
 Append a RXX gate to the list of gates. More...
 
void add_rxx_to_front (std::vector< int > target_qbits)
 Add a RXX gate to the front of the list of gates. More...
 
void add_ry (int target_qbit)
 Append a RY gate to the list of gates. More...
 
void add_ry_to_front (int target_qbit)
 Add a RY gate to the front of the list of gates. More...
 
void add_ryy (std::vector< int > target_qbits)
 Append a RYY gate to the list of gates. More...
 
void add_ryy_to_front (std::vector< int > target_qbits)
 Add a RYY gate to the front of the list of gates. More...
 
void add_rz (int target_qbit)
 Append a RZ gate to the list of gates. More...
 
void add_rz_to_front (int target_qbit)
 Add a RZ gate to the front of the list of gates. More...
 
void add_rzz (std::vector< int > target_qbits)
 Append a RZZ gate to the list of gates. More...
 
void add_rzz_to_front (std::vector< int > target_qbits)
 Add a RZZ gate to the front of the list of gates. More...
 
void add_s (int target_qbit)
 Append a S gate to the list of gates. More...
 
void add_s_to_front (int target_qbit)
 Add a S gate to the front of the list of gates. More...
 
void add_sdg (int target_qbit)
 Append a Sdg gate to the list of gates. More...
 
void add_sdg_to_front (int target_qbit)
 Add a Sdg gate to the front of the list of gates. More...
 
void add_swap (const std::vector< int > &target_qbits)
 Append a SWAP gate to the list of gates. More...
 
void add_swap_to_front (const std::vector< int > &target_qbits)
 Add a SWAP gate to the front of the list of gates. More...
 
void add_sx (int target_qbit)
 Append a SX gate to the list of gates. More...
 
void add_sx_to_front (int target_qbit)
 Add a SX gate to the front of the list of gates. More...
 
void add_sxdg (int target_qbit)
 Append a SXdg gate to the list of gates. More...
 
void add_sxdg_to_front (int target_qbit)
 Add a SXdg gate to the front of the list of gates. More...
 
void add_syc (int target_qbit, int control_qbit)
 Append a Sycamore gate (i.e. More...
 
void add_syc_to_front (int target_qbit, int control_qbit)
 Add a Sycamore gate (i.e. More...
 
void add_t (int target_qbit)
 Append a T gate to the list of gates. More...
 
void add_t_to_front (int target_qbit)
 Add a T gate to the front of the list of gates. More...
 
void add_tdg (int target_qbit)
 Append a Tdg gate to the list of gates. More...
 
void add_tdg_to_front (int target_qbit)
 Add a Tdg gate to the front of the list of gates. More...
 
void add_u1 (int target_qbit)
 Append a U1 gate to the list of gates. More...
 
void add_u1_to_front (int target_qbit)
 Add a U1 gate to the front of the list of gates. More...
 
void add_u2 (int target_qbit)
 Append a U2 gate to the list of gates. More...
 
void add_u2_to_front (int target_qbit)
 Add a U2 gate to the front of the list of gates. More...
 
void add_u3 (int target_qbit)
 Append a U3 gate to the list of gates. More...
 
void add_u3_to_front (int target_qbit)
 Add a U3 gate to the front of the list of gates. More...
 
void add_x (int target_qbit)
 Append a X gate to the list of gates. More...
 
void add_x_to_front (int target_qbit)
 Add a X gate to the front of the list of gates. More...
 
void add_y (int target_qbit)
 Append a Y gate to the list of gates. More...
 
void add_y_to_front (int target_qbit)
 Add a Y gate to the front of the list of gates. More...
 
void add_z (int target_qbit)
 Append a Z gate to the list of gates. More...
 
void add_z_to_front (int target_qbit)
 Add a Z gate to the front of the list of gates. More...
 
virtual std::vector< Matrixapply_derivate_to (Matrix_real &parameters_mtx, Matrix &input, int parallel) override
 Call to evaluate the derivate of the circuit on an inout with respect to all of the free parameters. More...
 
virtual void apply_derivate_to (Matrix_real &parameters_mtx, Matrix &input, int parallel, std::vector< Matrix > &output) override
 
void apply_derivate_to (Matrix_real &parameters_mtx, Matrix &input, int parallel, std::vector< Matrix > &output, size_t output_offset, bool resize_output)
 
virtual std::vector< Matrix_floatapply_derivate_to (Matrix_real_float &parameters_mtx, Matrix_float &input, int parallel) override
 Float32 overload: evaluate the derivative of the circuit w.r.t. More...
 
virtual void apply_derivate_to (Matrix_real_float &parameters_mtx, Matrix_float &input, int parallel, std::vector< Matrix_float > &output) override
 
void apply_derivate_to (Matrix_real_float &parameters_mtx, Matrix_float &input, int parallel, std::vector< Matrix_float > &output, size_t output_offset, bool resize_output)
 
virtual void apply_from_right (Matrix_real &parameters_mtx, Matrix &input) override
 Call to apply the gate on the input array/matrix by input*CNOT. More...
 
virtual void apply_from_right (Matrix_real_float &parameters_mtx, Matrix_float &input) override
 Float32 overload for right-side parametric gate application by input*Gate. More...
 
virtual void apply_from_right (Matrix &input)
 Call to apply the gate on the input array/matrix by input*Gate. More...
 
virtual void apply_from_right (Matrix_float &input)
 Float32 overload for right-side gate application by input*Gate. More...
 
virtual void apply_from_right_inner (Matrix_real &parameters_mtx, const Matrix_real &precomputed_sincos, Matrix &input) override
 Internal right-apply entry that consumes already precomputed sin/cos values. More...
 
virtual void apply_from_right_inner (Matrix_real_float &parameters_mtx, const Matrix_real_float &precomputed_sincos, Matrix_float &input) override
 Float32 internal right-apply entry that consumes already precomputed sin/cos values. More...
 
virtual void apply_to (Matrix_real &parameters_mtx, Matrix &input, int parallel=0) override
 Call to apply the gate on the input array/matrix Gates_block*input. More...
 
virtual void apply_to (Matrix_float &input, int parallel=0) override
 Float32 overload for gate application. More...
 
virtual void apply_to (Matrix_real_float &parameters_mtx, Matrix_float &input, int parallel=0) override
 Float32 overload for parametric gate application. More...
 
virtual void apply_to (Matrix_real_any &parameters_mtx, Matrix_any &input, int parallel=0)
 Precision-agnostic apply entry point for float32/float64 execution. More...
 
virtual void apply_to (Matrix &input, int parallel)
 Call to apply the gate on the input array/matrix. More...
 
void apply_to (Matrix_any &input, int parallel)
 Precision-agnostic dispatch helper for matrix/state application. More...
 
virtual std::vector< Matrixapply_to_combined (Matrix_real &parameters_mtx, Matrix &input, int parallel) override
 Combined forward + derivative application with shared precomputed trig cache. More...
 
virtual void apply_to_combined (Matrix_real &parameters_mtx, Matrix &input, int parallel, std::vector< Matrix > &output) override
 
virtual std::vector< Matrix_floatapply_to_combined (Matrix_real_float &parameters_mtx, Matrix_float &input, int parallel) override
 Float32 combined forward + derivative application. More...
 
virtual void apply_to_combined (Matrix_real_float &parameters_mtx, Matrix_float &input, int parallel, std::vector< Matrix_float > &output) override
 
virtual std::vector< Matrixapply_to_combined_inner (Matrix_real &parameters_mtx, const Matrix_real &precomputed_sincos, Matrix &input, int parallel) override
 Internal combined forward+derivative entry with precomputed sin/cos. More...
 
virtual void apply_to_combined_inner (Matrix_real &parameters_mtx, const Matrix_real &precomputed_sincos, Matrix &input, int parallel, std::vector< Matrix > &output) override
 
virtual std::vector< Matrix_floatapply_to_combined_inner (Matrix_real_float &parameters_mtx, const Matrix_real_float &precomputed_sincos, Matrix_float &input, int parallel) override
 Float32 internal combined forward+derivative entry with precomputed sin/cos. More...
 
virtual void apply_to_combined_inner (Matrix_real_float &parameters_mtx, const Matrix_real_float &precomputed_sincos, Matrix_float &input, int parallel, std::vector< Matrix_float > &output) override
 
virtual void apply_to_inner (Matrix_real &parameters_mtx, const Matrix_real &precomputed_sincos, Matrix &input, int parallel=0) override
 Internal apply entry that consumes already precomputed sin/cos values. More...
 
virtual void apply_to_inner (Matrix_real_float &parameters_mtx, const Matrix_real_float &precomputed_sincos, Matrix_float &input, int parallel=0) override
 Float32 internal apply entry that consumes already precomputed sin/cos values. More...
 
void apply_to_list (Matrix_real &parameters, std::vector< Matrix > &inputs, int parallel) override
 Call to apply the gate on the input array/matrix by U3*input. More...
 
void apply_to_list (Matrix_real_float &parameters, std::vector< Matrix_float > &inputs, int parallel) override
 Float32 overload: apply circuit to a list of float32 matrices. More...
 
virtual void apply_to_list (std::vector< Matrix > &inputs, int parallel)
 Call to apply the gate on a list of inputs. More...
 
virtual void apply_to_list (std::vector< Matrix_float > &inputs, int parallel)
 Float32 overload: apply gate to a list of float32 inputs without parameters. More...
 
void clear_children ()
 Call to erase data on children. More...
 
void clear_parents ()
 Call to erase data on parents. More...
 
virtual Gates_blockclone () override
 Create a clone of the present class. More...
 
void combine (Gates_block *op_block)
 Call to append the gates of an gate block to the current block. More...
 
Matrix_real compute_precomputed_sincos (const Matrix_real &parameters) const
 Public wrapper to precompute gate-local sin/cos pairs. More...
 
Matrix_real_float compute_precomputed_sincos (const Matrix_real_float &parameters) const
 Float32 public wrapper to precompute gate-local sin/cos pairs. More...
 
bool contains_adaptive_gate ()
 Call to determine, whether the circuit contains daptive gate or not. More...
 
bool contains_adaptive_gate (int idx)
 Call to determine, whether the sub-circuit at a given position in the circuit contains daptive gate or not. More...
 
Gates_blockcreate_remapped_circuit (const std::map< int, int > &qbit_map)
 Call to create a new circuit with remapped qubits. More...
 
Gates_blockcreate_remapped_circuit (const std::map< int, int > &qbit_map, const int qbit_num_)
 Call to create a new circuit with remapped qubits. More...
 
virtual Matrix derivative_aux_kernel (const Matrix_real &precomputed_sincos, int param_idx)
 
virtual Matrix_float derivative_aux_kernel (const Matrix_real_float &precomputed_sincos, int param_idx)
 
virtual void derivative_aux_kernel_to (const Matrix_real &precomputed_sincos, int param_idx, Matrix &output)
 
virtual void derivative_aux_kernel_to (const Matrix_real_float &precomputed_sincos, int param_idx, Matrix_float &output)
 
virtual Matrix derivative_kernel (const Matrix_real &precomputed_sincos, int param_idx)
 
virtual Matrix_float derivative_kernel (const Matrix_real_float &precomputed_sincos, int param_idx)
 
virtual void derivative_kernel_to (const Matrix_real &precomputed_sincos, int param_idx, Matrix &output)
 
virtual void derivative_kernel_to (const Matrix_real_float &precomputed_sincos, int param_idx, Matrix_float &output)
 
void determine_children (Gate *gate)
 Call to obtain the child gates in the circuit. More...
 
void determine_parents (Gate *gate)
 Call to obtain the parent gates in the circuit. More...
 
int extract_gates (Gates_block *op_block)
 Call to extract the gates stored in the class. More...
 
virtual Matrix_real_float extract_parameters (Matrix_real_float &parameters)
 Float32 overload of extract_parameters. More...
 
virtual Matrix_real extract_parameters (Matrix_real &parameters) override
 Call to extract parameters from the parameter array corresponding to the circuit, in which the gate is embedded. More...
 
void fragment_circuit ()
 
virtual Matrix gate_kernel (const Matrix_real &precomputed_sincos)
 Compute the gate kernel matrix from precomputed trigonometric values. More...
 
virtual Matrix_float gate_kernel (const Matrix_real_float &precomputed_sincos)
 
virtual void gate_kernel_to (const Matrix_real &precomputed_sincos, Matrix &output)
 
virtual void gate_kernel_to (const Matrix_real_float &precomputed_sincos, Matrix_float &output)
 
 Gates_block ()
 Default constructor of the class. More...
 
 Gates_block (int qbit_num_in)
 Constructor of the class. More...
 
std::vector< Gate * > get_children ()
 Call to get the children of the current gate. More...
 
int get_control_qbit ()
 Call to get the index of the control qubit. More...
 
std::vector< intget_control_qbits () const
 Call to get the vector of control qubits. More...
 
Gates_blockget_flat_circuit ()
 Method to generate a flat circuit. More...
 
Gateget_gate (int idx)
 Call to get the gates stored in the class. More...
 
int get_gate_num ()
 Call to get the number of gates grouped in the class. More...
 
std::map< std::string, intget_gate_nums ()
 Call to get the number of the individual gate types in the list of gates. More...
 
std::vector< Gate * > get_gates ()
 Call to get the gates stored in the class. More...
 
std::vector< intget_involved_qubits (bool only_target=false) override
 Call to get the qubits involved in the gates stored in the block of gates. More...
 
Matrix get_matrix (Matrix_real &parameters) override
 Call to retrieve the gate matrix (Which is the product of all the gate matrices stored in the gate block) More...
 
Matrix get_matrix (Matrix_real &parameters, int parallel) override
 Call to retrieve the gate matrix (Which is the product of all the gate matrices stored in the gate block) More...
 
Matrix_float get_matrix (Matrix_real_float &parameters)
 
Matrix_float get_matrix (Matrix_real_float &parameters, int parallel) override
 Float32 overload: retrieve the gate matrix. More...
 
virtual Matrix get_matrix ()
 Retrieve the gate matrix for zero-parameter gates (no parameters). More...
 
virtual Matrix get_matrix (int parallel)
 Retrieve the gate matrix for zero-parameter gates with parallel flag. More...
 
std::string get_name ()
 Call to get the name label of the gate. More...
 
void get_parameter_max (Matrix_real &range_max)
 
virtual std::vector< double > get_parameter_multipliers () const
 Returns the per-parameter multipliers relative to 2π used by extract_parameters. More...
 
int get_parameter_num () override
 Call to get the number of free parameters. More...
 
int get_parameter_start_idx ()
 Call to get the starting index of the parameters in the parameter array corresponding to the circuit in which the current gate is incorporated. More...
 
std::vector< Gate * > get_parents ()
 Call to get the parents of the current gate. More...
 
int get_qbit_num ()
 Call to get the number of qubits composing the unitary. More...
 
Matrix get_reduced_density_matrix (Matrix_real &parameters_mtx, Matrix &input_state, matrix_base< int > &qbit_list_subset)
 Call to evaluate the reduced densiy matrix. More...
 
double get_second_Renyi_entropy (Matrix_real &parameters_mtx, Matrix &input_state, matrix_base< int > &qbit_list)
 Call to evaluate the seconf Rényi entropy. More...
 
int get_target_qbit ()
 Call to get the index of the target qubit. More...
 
std::vector< intget_target_qbits () const
 Call to get the vector of target qubits. More...
 
gate_type get_type ()
 Call to get the type of the operation. More...
 
void insert_gate (Gate *gate, int idx)
 Call to insert a gate at a given position. More...
 
virtual Matrix inverse_gate_kernel (const Matrix_real &precomputed_sincos)
 
virtual Matrix_float inverse_gate_kernel (const Matrix_real_float &precomputed_sincos)
 
virtual void inverse_gate_kernel_to (const Matrix_real &precomputed_sincos, Matrix &output)
 
virtual void inverse_gate_kernel_to (const Matrix_real_float &precomputed_sincos, Matrix_float &output)
 
void list_gates (const Matrix_real &parameters, int start_index)
 Call to print the list of gates stored in the block of gates for a specific set of parameters. More...
 
void print (const std::stringstream &sstream, int verbose_level=1) const
 Call to print output messages in the function of the verbosity level. More...
 
void release_gate (int idx)
 Call to release one gate in the list. More...
 
void release_gates ()
 Call to release the stored gates. More...
 
virtual void reorder_qubits (std::vector< int > qbit_list) override
 Call to reorder the qubits in the matrix of the gates (Obsolete function) More...
 
void reset_dependency_graph ()
 Method to reset the dependency graph of the gates in the circuit. More...
 
void reset_parameter_start_indices ()
 Method to reset the parameter start indices of gate operations incorporated in the circuit. More...
 
void set_children (std::vector< Gate *> &children_)
 Call to set the children of the current gate. More...
 
void set_control_qbit (int control_qbit_in)
 Call to set the control qubit for the gate operation. More...
 
void set_control_qbits (const std::vector< int > &control_qbits_in)
 Call to set the control qubits for the gate operation. More...
 
void set_debugfile (std::string debugfile)
 Call to set the debugfile name. More...
 
void set_matrix (Matrix input)
 Call to set the stored matrix in the operation. More...
 
void set_matrix (Matrix_float input)
 
void set_min_fusion (int min_fusion)
 
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 in which the current gate is incorporated. More...
 
void set_parents (std::vector< Gate *> &parents_)
 Call to set the parents of the current gate. More...
 
virtual void set_qbit_num (int qbit_num_in) override
 Set the number of qubits spanning the matrix of the gates stored in the block of gates. More...
 
void set_target_qbit (int target_qbit_in)
 Call to set the target qubit for the gate operation. More...
 
void set_target_qbits (const std::vector< int > &target_qbits_in)
 Call to set the target qubits for the gate operation. More...
 
void set_verbose (int verbose_in)
 Call to set the verbose attribute. More...
 
 ~Gates_block () override
 Destructor of the class. More...
 

Static Public Member Functions

static Matrix calc_one_qubit_u3 (double ThetaOver2=0.0, double Phi=0.0, double Lambda=0.0)
 Build a 2x2 U3 kernel from angles (theta/2, phi, lambda). More...
 
static Matrix_float calc_one_qubit_u3 (float ThetaOver2, float Phi, float Lambda)
 

Public Attributes

bool debug
 Logical variable. Set true to write output messages to the 'debug.txt' file. More...
 
std::string debugfile_name
 String variable. Set the debug file name. More...
 
int verbose
 Set the verbosity level of the output messages. More...
 

Protected Member Functions

std::vector< Matrixapply_derivative_to_precomputed (const Matrix_real &precomputed_sincos, Matrix &input, int parallel)
 Call to evaluate the derivate of the circuit on an inout with respect to all of the free parameters. More...
 
void apply_derivative_to_precomputed (const Matrix_real &precomputed_sincos, Matrix &input, int parallel, std::vector< Matrix > &output, size_t offset=0, bool resize_output=true)
 
std::vector< Matrix_floatapply_derivative_to_precomputed (const Matrix_real_float &precomputed_sincos, Matrix_float &input, int parallel)
 
void apply_derivative_to_precomputed (const Matrix_real_float &precomputed_sincos, Matrix_float &input, int parallel, std::vector< Matrix_float > &output, size_t offset=0, bool resize_output=true)
 
void apply_kernel_from_right (Matrix &u3_1qbit, Matrix &input, const Matrix *alt_kernel=nullptr)
 Call to apply the gate kernel on the input state or unitary from right (no AVX support) More...
 
void apply_kernel_from_right (Matrix_float &u3_1qbit, Matrix_float &input, const Matrix_float *alt_kernel=nullptr)
 
void apply_kernel_to (Matrix &u3_1qbit, Matrix &input, bool deriv=false, int parallel=0, const Matrix *alt_kernel=nullptr)
 Call to apply the gate kernel on the input state or unitary with optional AVX support. More...
 
void apply_kernel_to (Matrix_float &u3_1qbit, Matrix_float &input, bool deriv=false, int parallel=0, const Matrix_float *alt_kernel=nullptr)
 Float32 overload of one-qubit kernel application helper. More...
 
void invalidate_structure_cache ()
 
Matrix_real precompute_sincos (const Matrix_real &parameters) const
 Precompute sin/cos pairs for each gate-local parameter. More...
 
Matrix_real_float precompute_sincos (const Matrix_real_float &parameters) const
 Float32 precompute sin/cos pairs for each gate-local parameter. More...
 

Protected Attributes

std::vector< Gate * > children
 list of child gates to be applied after this current gate More...
 
int control_qbit
 The index of the qubit which acts as a control qubit (control_qbit >= 0) in controlled operations. More...
 
std::vector< intcontrol_qbits
 Vector of control qubit indices (for multi-qubit gates) More...
 
SmartAtomicPtr< Gates_blockfusion_block
 
std::vector< Gate * > gates
 The list of stored gates. More...
 
std::vector< intinvolved_qubits_cache
 
std::shared_ptr< tbb::spin_mutex > involved_qubits_cache_mutex
 
bool involved_qubits_cache_valid
 
std::vector< intinvolved_target_qubits_cache
 
bool involved_target_qubits_cache_valid
 
int layer_num
 number of gate layers More...
 
int matrix_size
 The size N of the NxN matrix associated with the operations. More...
 
int min_fusion
 maximal number of qubits in partitions More...
 
std::string name
 A string labeling the gate operation. More...
 
int parameter_num
 the number of free parameters of the operation More...
 
int parameter_start_idx
 the index in the parameter array (corrensponding to the encapsulated circuit) where the gate parameters begin (if gates are placed into a circuit a single parameter array is used to execute the whole circuit) More...
 
std::vector< Gate * > parents
 list of parent gates to be applied in the circuit prior to this current gate More...
 
int qbit_num
 number of qubits spanning the matrix of the operation More...
 
int target_qbit
 The index of the qubit on which the operation acts (target_qbit >= 0) More...
 
std::vector< inttarget_qbits
 Vector of target qubit indices (for multi-qubit gates) More...
 
gate_type type
 The type of the operation (see enumeration gate_type) More...
 

Detailed Description

A class responsible for grouping two-qubit (CNOT,CZ,CH) and one-qubit gates into layers.

Definition at line 44 of file Gates_block.h.

Constructor & Destructor Documentation

◆ Gates_block() [1/2]

Gates_block::Gates_block ( )

Default constructor of the class.

Definition at line 82 of file Gates_block.cpp.

Here is the caller graph for this function:

◆ Gates_block() [2/2]

Gates_block::Gates_block ( int  qbit_num_in)

Constructor of the class.

Parameters
qbit_num_inThe number of qubits in the unitaries

Definition at line 103 of file Gates_block.cpp.

◆ ~Gates_block()

Gates_block::~Gates_block ( )
override

Destructor of the class.

Definition at line 136 of file Gates_block.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ add_adaptive()

void Gates_block::add_adaptive ( int  target_qbit,
int  control_qbit 
)

Append a Adaptive gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2440 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_adaptive_to_front()

void Gates_block::add_adaptive_to_front ( int  target_qbit,
int  control_qbit 
)

Add a Adaptive gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2455 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_ccx()

void Gates_block::add_ccx ( int  target_qbit,
const std::vector< int > &  control_qbits 
)

Append a CCX gate (i.e.

Toffoli gate) to the list of gates

Parameters
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitsVector of control qubit indices (should contain exactly 2 elements for CCX)

Toffoli gate) operation to the list of gates

Parameters
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitsVector of control qubit indices (should contain exactly 2 elements for CCX)

Definition at line 2342 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_ccx_to_front()

void Gates_block::add_ccx_to_front ( int  target_qbit,
const std::vector< int > &  control_qbits 
)

Add a CCX gate (i.e.

Toffoli gate) to the front of the list of gates

Parameters
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitsVector of control qubit indices (should contain exactly 2 elements for CCX)

Toffoli gate) operation to the front of the list of gates

Parameters
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitsVector of control qubit indices (should contain exactly 2 elements for CCX)

Definition at line 2354 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_ch()

void Gates_block::add_ch ( int  target_qbit,
int  control_qbit 
)

Append a CH gate (i.e.

controlled Hadamard gate) gate to the list of gates

Parameters
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)

controlled Hadamard gate) operation to the list of gates

Parameters
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2278 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_ch_to_front()

void Gates_block::add_ch_to_front ( int  target_qbit,
int  control_qbit 
)

Add a CH gate (i.e.

controlled Hadamard gate) gate to the front of the list of gates

Parameters
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)

controlled Hadamard gate) operation to the front of the list of gates

Parameters
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2295 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_child()

void Gate::add_child ( Gate child)
inherited

Call to add a child gate to the current gate.

Parameters
childThe parent gate of the current gate.

Definition at line 1264 of file Gate.cpp.

Here is the caller graph for this function:

◆ add_cnot()

void Gates_block::add_cnot ( int  target_qbit,
int  control_qbit 
)

Append a CNOT gate gate to the list of gates.

Append a C_NOT gate operation to the list of gates.

Parameters
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1880 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_cnot_to_front()

void Gates_block::add_cnot_to_front ( int  target_qbit,
int  control_qbit 
)

Add a C_NOT gate gate to the front of the list of gates.

Add a C_NOT gate operation to the front of the list of gates.

Parameters
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1897 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_cp()

void Gates_block::add_cp ( int  target_qbit,
int  control_qbit 
)

Append a CRY gate to the list of gates.

Append a CRX gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1758 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_cp_to_front()

void Gates_block::add_cp_to_front ( int  target_qbit,
int  control_qbit 
)

Add a CRY gate to the front of the list of gates.

Add a CRX gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1774 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_cr()

void Gates_block::add_cr ( int  target_qbit,
int  control_qbit 
)

Append a CR gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1789 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_cr_to_front()

void Gates_block::add_cr_to_front ( int  target_qbit,
int  control_qbit 
)

Add a CR gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1805 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_crot()

void Gates_block::add_crot ( int  target_qbit,
int  control_qbit 
)

Append a CROT gate gate to the list of gates.

Append a CROT gate to the list of gates.

Parameters
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1821 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_crot_to_front()

void Gates_block::add_crot_to_front ( int  target_qbit,
int  control_qbit 
)

Add a CROT gate gate to the front of the list of gates.

Add a CROT gate to the front of the list of gates.

Parameters
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1837 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_crx()

void Gates_block::add_crx ( int  target_qbit,
int  control_qbit 
)

Append a CRY gate to the list of gates.

Append a CRX gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1696 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_crx_to_front()

void Gates_block::add_crx_to_front ( int  target_qbit,
int  control_qbit 
)

Add a CRY gate to the front of the list of gates.

Add a CRX gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1712 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_cry()

void Gates_block::add_cry ( int  target_qbit,
int  control_qbit 
)

Append a CRY gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1665 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_cry_to_front()

void Gates_block::add_cry_to_front ( int  target_qbit,
int  control_qbit 
)

Add a CRY gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1681 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_crz()

void Gates_block::add_crz ( int  target_qbit,
int  control_qbit 
)

Append a CRY gate to the list of gates.

Append a CRX gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1727 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_crz_to_front()

void Gates_block::add_crz_to_front ( int  target_qbit,
int  control_qbit 
)

Add a CRY gate to the front of the list of gates.

Add a CRX gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1743 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_cswap()

void Gates_block::add_cswap ( const std::vector< int > &  target_qbits,
const std::vector< int > &  control_qbits 
)

Append a CSWAP gate (Controlled SWAP) to the list of gates.

Parameters
target_qbitsVector of target qubit indices (should contain exactly 2 elements)
control_qbitsVector of control qubit indices (should contain exactly 1 element)

Definition at line 2388 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_cswap_to_front()

void Gates_block::add_cswap_to_front ( const std::vector< int > &  target_qbits,
const std::vector< int > &  control_qbits 
)

Add a CSWAP gate (Controlled SWAP) to the front of the list of gates.

Parameters
target_qbitsVector of target qubit indices (should contain exactly 2 elements)
control_qbitsVector of control qubit indices (should contain exactly 1 element)

Definition at line 2400 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_cu()

void Gates_block::add_cu ( int  target_qbit,
int  control_qbit 
)

Append a CU gate (i.e.

controlled U gate) gate to the list of gates

Parameters
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)

controlled U gate) operation to the list of gates

Parameters
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2310 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_cu_to_front()

void Gates_block::add_cu_to_front ( int  target_qbit,
int  control_qbit 
)

Add a CU gate (i.e.

controlled U gate) gate to the front of the list of gates

Parameters
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)

controlled U gate) operation to the front of the list of gates

Parameters
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2327 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_cz()

void Gates_block::add_cz ( int  target_qbit,
int  control_qbit 
)

Append a CZ gate gate to the list of gates.

Append a CZ gate operation to the list of gates.

Parameters
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1915 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_cz_to_front()

void Gates_block::add_cz_to_front ( int  target_qbit,
int  control_qbit 
)

Add a CZ gate gate to the front of the list of gates.

Add a CZ gate operation to the front of the list of gates.

Parameters
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1932 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_gate()

void Gates_block::add_gate ( Gate gate)

Append a general gate to the list of gates.

Parameters
gateA pointer to a class Gate describing an gate.
gateA pointer to a class Gate describing a gate operation.

Definition at line 2500 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_gate_nums()

void Gates_block::add_gate_nums ( std::map< std::string, int > &  gate_nums)

Call to add the number of the individual gate types in the circuit to the map given in the argument.

Parameters
Amap<gate_name, gate_count> describing the number of the individual gate types

Definition at line 2598 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_gate_to_front()

void Gates_block::add_gate_to_front ( Gate gate)

Add an gate to the front of the list of gates.

Add a gate to the front of the list of gates.

Parameters
gateA pointer to a class Gate describing an gate.
gateA pointer to a class Gate describing a gate.

Definition at line 2533 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_gates()

void Gates_block::add_gates ( std::vector< Gate *>  gates_in)

Append a list of gates to the list of gates.

Parameters
gates_inA list of gate class instances.
gates_inA list of operation class instances.

Definition at line 2411 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_gates_to_front()

void Gates_block::add_gates_to_front ( std::vector< Gate *>  gates_in)

Add an array of gates to the front of the list of gates.

Parameters
gates_inA list of gate class instances.
gates_inA list of operation class instances.

Definition at line 2424 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_general_operation()

void Gates_block::add_general_operation ( const Matrix operation_mtx,
const std::vector< int > &  target_qbits = std::vector<int>(),
const std::vector< int > &  control_qbits = std::vector<int>() 
)

Append a GENERAL_OPERATION gate with an explicitly provided matrix.

Parameters
operation_mtxThe operation matrix. Must be matrix_size x matrix_size.
target_qbitsOptional metadata for target qubits involved in this gate.
control_qbitsOptional metadata for control qubits involved in this gate.

Definition at line 2472 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_h()

void Gates_block::add_h ( int  target_qbit)

Append a Hadamard gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1946 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_h_to_front()

void Gates_block::add_h_to_front ( int  target_qbit)

Add a Hadamard gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1959 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_parent()

void Gate::add_parent ( Gate parent)
inherited

Call to add a parent gate to the current gate.

Parameters
parentThe parent gate of the current gate.

Definition at line 1247 of file Gate.cpp.

Here is the caller graph for this function:

◆ add_r()

void Gates_block::add_r ( int  target_qbit)

Append a R gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1605 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_r_to_front()

void Gates_block::add_r_to_front ( int  target_qbit)

Add a R gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1618 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_rx()

void Gates_block::add_rx ( int  target_qbit)

Append a RX gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1498 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_rx_to_front()

void Gates_block::add_rx_to_front ( int  target_qbit)

Add a RX gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1511 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_rxx()

void Gates_block::add_rxx ( std::vector< int target_qbits)

Append a RXX gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1525 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_rxx_to_front()

void Gates_block::add_rxx_to_front ( std::vector< int target_qbits)

Add a RXX gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1538 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_ry()

void Gates_block::add_ry ( int  target_qbit)

Append a RY gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1633 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_ry_to_front()

void Gates_block::add_ry_to_front ( int  target_qbit)

Add a RY gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1647 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_ryy()

void Gates_block::add_ryy ( std::vector< int target_qbits)

Append a RYY gate to the list of gates.

Parameters
target_qbitsThe identification numbers of the target qubits (should contain exactly 2 elements)

Definition at line 1552 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_ryy_to_front()

void Gates_block::add_ryy_to_front ( std::vector< int target_qbits)

Add a RYY gate to the front of the list of gates.

Parameters
target_qbitsThe identification numbers of the target qubits (should contain exactly 2 elements)

Definition at line 1565 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_rz()

void Gates_block::add_rz ( int  target_qbit)

Append a RZ gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1851 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_rz_to_front()

void Gates_block::add_rz_to_front ( int  target_qbit)

Add a RZ gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1864 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_rzz()

void Gates_block::add_rzz ( std::vector< int target_qbits)

Append a RZZ gate to the list of gates.

Parameters
target_qbitsThe identification numbers of the target qubits (should contain exactly 2 elements)

Definition at line 1579 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_rzz_to_front()

void Gates_block::add_rzz_to_front ( std::vector< int target_qbits)

Add a RZZ gate to the front of the list of gates.

Parameters
target_qbitsThe identification numbers of the target qubits (should contain exactly 2 elements)

Definition at line 1592 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_s()

void Gates_block::add_s ( int  target_qbit)

Append a S gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2065 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_s_to_front()

void Gates_block::add_s_to_front ( int  target_qbit)

Add a S gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2078 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_sdg()

void Gates_block::add_sdg ( int  target_qbit)

Append a Sdg gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2094 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_sdg_to_front()

void Gates_block::add_sdg_to_front ( int  target_qbit)

Add a Sdg gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2107 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_swap()

void Gates_block::add_swap ( const std::vector< int > &  target_qbits)

Append a SWAP gate to the list of gates.

Parameters
target_qbitsVector of target qubit indices (should contain exactly 2 elements for SWAP)

Definition at line 2365 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_swap_to_front()

void Gates_block::add_swap_to_front ( const std::vector< int > &  target_qbits)

Add a SWAP gate to the front of the list of gates.

Parameters
target_qbitsVector of target qubit indices (should contain exactly 2 elements for SWAP)

Definition at line 2376 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_sx()

void Gates_block::add_sx ( int  target_qbit)

Append a SX gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2186 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_sx_to_front()

void Gates_block::add_sx_to_front ( int  target_qbit)

Add a SX gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2199 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_sxdg()

void Gates_block::add_sxdg ( int  target_qbit)

Append a SXdg gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2214 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_sxdg_to_front()

void Gates_block::add_sxdg_to_front ( int  target_qbit)

Add a SXdg gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2227 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_syc()

void Gates_block::add_syc ( int  target_qbit,
int  control_qbit 
)

Append a Sycamore gate (i.e.

Append a Sycamore gate operation to the list of gates.

controlled Hadamard gate) gate to the list of gates

Parameters
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2243 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_syc_to_front()

void Gates_block::add_syc_to_front ( int  target_qbit,
int  control_qbit 
)

Add a Sycamore gate (i.e.

Add a Sycamore gate operation to the front of the list of gates.

controlled Hadamard gate) gate to the front of the list of gates

Parameters
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)
control_qbitThe identification number of the control qubit. (0 <= target_qbit <= qbit_num-1)
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2260 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_t()

void Gates_block::add_t ( int  target_qbit)

Append a T gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2124 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_t_to_front()

void Gates_block::add_t_to_front ( int  target_qbit)

Add a T gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2137 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_tdg()

void Gates_block::add_tdg ( int  target_qbit)

Append a Tdg gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2154 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_tdg_to_front()

void Gates_block::add_tdg_to_front ( int  target_qbit)

Add a Tdg gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2167 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_u1()

void Gates_block::add_u1 ( int  target_qbit)

Append a U1 gate to the list of gates.

Parameters
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1419 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_u1_to_front()

void Gates_block::add_u1_to_front ( int  target_qbit)

Add a U1 gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1432 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_u2()

void Gates_block::add_u2 ( int  target_qbit)

Append a U2 gate to the list of gates.

Parameters
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1445 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_u2_to_front()

void Gates_block::add_u2_to_front ( int  target_qbit)

Add a U2 gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the target qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1458 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_u3()

void Gates_block::add_u3 ( int  target_qbit)

Append a U3 gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)
ThetaThe Theta parameter of the U3 gate
PhiThe Phi parameter of the U3 gate
LambdaThe Lambda parameter of the U3 gate
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1471 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_u3_to_front()

void Gates_block::add_u3_to_front ( int  target_qbit)

Add a U3 gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)
ThetaThe Theta parameter of the U3 gate
PhiThe Phi parameter of the U3 gate
LambdaThe Lambda parameter of the U3 gate
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1484 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_x()

void Gates_block::add_x ( int  target_qbit)

Append a X gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1977 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_x_to_front()

void Gates_block::add_x_to_front ( int  target_qbit)

Add a X gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 1990 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_y()

void Gates_block::add_y ( int  target_qbit)

Append a Y gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2006 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_y_to_front()

void Gates_block::add_y_to_front ( int  target_qbit)

Add a Y gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2019 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_z()

void Gates_block::add_z ( int  target_qbit)

Append a Z gate to the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2035 of file Gates_block.cpp.

Here is the call graph for this function:

◆ add_z_to_front()

void Gates_block::add_z_to_front ( int  target_qbit)

Add a Z gate to the front of the list of gates.

Parameters
target_qbitThe identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1)

Definition at line 2048 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_derivate_to() [1/6]

std::vector< Matrix > Gates_block::apply_derivate_to ( Matrix_real parameters_mtx_in,
Matrix input,
int  parallel 
)
overridevirtual

Call to evaluate the derivate of the circuit on an inout with respect to all of the free parameters.

Parameters
parametersAn array of the input parameters.
inputThe input array on which the gate is applied
parallelSet 0 for sequential execution, 1 for parallel execution with OpenMP (NOT IMPLEMENTED YET) and 2 for parallel with TBB (optional)

Reimplemented from Gate.

Definition at line 996 of file Gates_block.cpp.

Here is the caller graph for this function:

◆ apply_derivate_to() [2/6]

void Gates_block::apply_derivate_to ( Matrix_real parameters_mtx,
Matrix input,
int  parallel,
std::vector< Matrix > &  output 
)
overridevirtual

Reimplemented from Gate.

Definition at line 1005 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_derivate_to() [3/6]

void Gates_block::apply_derivate_to ( Matrix_real parameters_mtx,
Matrix input,
int  parallel,
std::vector< Matrix > &  output,
size_t  output_offset,
bool  resize_output 
)

Definition at line 1012 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_derivate_to() [4/6]

std::vector< Matrix_float > Gates_block::apply_derivate_to ( Matrix_real_float parameters_mtx_in,
Matrix_float input,
int  parallel 
)
overridevirtual

Float32 overload: evaluate the derivative of the circuit w.r.t.

all free parameters. Stabilized path: casts inputs to float64, runs the float64 derivative, then casts the results back to float32. Identical computational route to the float64 overload.

Parameters
parameters_mtx_inFloat32 parameter array
inputFloat32 input matrix/state
parallelSet 0 for sequential execution, 1 for parallel with TBB (optional)

Reimplemented from Gate.

Definition at line 1162 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_derivate_to() [5/6]

void Gates_block::apply_derivate_to ( Matrix_real_float parameters_mtx,
Matrix_float input,
int  parallel,
std::vector< Matrix_float > &  output 
)
overridevirtual

Reimplemented from Gate.

Definition at line 1171 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_derivate_to() [6/6]

void Gates_block::apply_derivate_to ( Matrix_real_float parameters_mtx,
Matrix_float input,
int  parallel,
std::vector< Matrix_float > &  output,
size_t  output_offset,
bool  resize_output 
)

Definition at line 1178 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_derivative_to_precomputed() [1/4]

std::vector< Matrix > Gate::apply_derivative_to_precomputed ( const Matrix_real precomputed_sincos,
Matrix input,
int  parallel 
)
protectedinherited

Call to evaluate the derivate of the circuit on an inout with respect to all of the free parameters.

Parameters
parametersAn array of the input parameters.
inputThe input array on which the gate is applied
parallelSet 0 for sequential execution, 1 for parallel execution with OpenMP (NOT IMPLEMENTED YET) and 2 for parallel with TBB (optional)

Definition at line 636 of file Gate.cpp.

◆ apply_derivative_to_precomputed() [2/4]

void Gate::apply_derivative_to_precomputed ( const Matrix_real precomputed_sincos,
Matrix input,
int  parallel,
std::vector< Matrix > &  output,
size_t  offset = 0,
bool  resize_output = true 
)
protectedinherited

Definition at line 645 of file Gate.cpp.

Here is the call graph for this function:

◆ apply_derivative_to_precomputed() [3/4]

std::vector< Matrix_float > Gate::apply_derivative_to_precomputed ( const Matrix_real_float precomputed_sincos,
Matrix_float input,
int  parallel 
)
protectedinherited

Definition at line 710 of file Gate.cpp.

◆ apply_derivative_to_precomputed() [4/4]

void Gate::apply_derivative_to_precomputed ( const Matrix_real_float precomputed_sincos,
Matrix_float input,
int  parallel,
std::vector< Matrix_float > &  output,
size_t  offset = 0,
bool  resize_output = true 
)
protectedinherited

Definition at line 719 of file Gate.cpp.

Here is the call graph for this function:

◆ apply_from_right() [1/4]

void Gates_block::apply_from_right ( Matrix_real parameters_mtx,
Matrix input 
)
overridevirtual

Call to apply the gate on the input array/matrix by input*CNOT.

Call to apply the gate on the input array/matrix by input*Gate_block.

Parameters
inputThe input array on which the gate is applied

Reimplemented from Gate.

Definition at line 885 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_from_right() [2/4]

void Gates_block::apply_from_right ( Matrix_real_float parameter_mtx,
Matrix_float input 
)
overridevirtual

Float32 overload for right-side parametric gate application by input*Gate.

Parameters
parameter_mtxFloat32 parameter matrix
inputThe float32 input array on which the gate is applied

Reimplemented from Gate.

Definition at line 939 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_from_right() [3/4]

void Gate::apply_from_right ( Matrix input)
virtualinherited

Call to apply the gate on the input array/matrix by input*Gate.

Parameters
inputThe input array on which the gate is applied

Definition at line 919 of file Gate.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ apply_from_right() [4/4]

void Gate::apply_from_right ( Matrix_float input)
virtualinherited

Float32 overload for right-side gate application by input*Gate.

Parameters
inputThe float32 input array on which the gate is applied

Definition at line 933 of file Gate.cpp.

Here is the call graph for this function:

◆ apply_from_right_inner() [1/2]

void Gates_block::apply_from_right_inner ( Matrix_real parameter_mtx,
const Matrix_real precomputed_sincos,
Matrix input 
)
overridevirtual

Internal right-apply entry that consumes already precomputed sin/cos values.

Reimplemented from Gate.

Definition at line 893 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ apply_from_right_inner() [2/2]

void Gates_block::apply_from_right_inner ( Matrix_real_float parameter_mtx,
const Matrix_real_float precomputed_sincos,
Matrix_float input 
)
overridevirtual

Float32 internal right-apply entry that consumes already precomputed sin/cos values.

Reimplemented from Gate.

Definition at line 947 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_kernel_from_right() [1/2]

void Gate::apply_kernel_from_right ( Matrix u3_1qbit,
Matrix input,
const Matrix alt_kernel = nullptr 
)
protectedinherited

Call to apply the gate kernel on the input state or unitary from right (no AVX support)

Parameters
u3_1qbitThe 2x2 kernel of the gate operation
inputThe input matrix on which the transformation is applied
derivSet true to apply derivate transformation, false otherwise

Definition at line 2082 of file Gate.cpp.

Here is the call graph for this function:

◆ apply_kernel_from_right() [2/2]

void Gate::apply_kernel_from_right ( Matrix_float u3_1qbit,
Matrix_float input,
const Matrix_float alt_kernel = nullptr 
)
protectedinherited

Definition at line 2289 of file Gate.cpp.

Here is the call graph for this function:

◆ apply_kernel_to() [1/2]

void Gate::apply_kernel_to ( Matrix u3_1qbit,
Matrix input,
bool  deriv = false,
int  parallel = 0,
const Matrix alt_kernel = nullptr 
)
protectedinherited

Call to apply the gate kernel on the input state or unitary with optional AVX support.

Parameters
u3_1qbitThe 2x2 kernel of the gate operation
inputThe input matrix on which the transformation is applied
derivSet true to apply derivate transformation, false otherwise (optional)
parallelSet true to apply parallel kernels, false otherwise (optional)
parallelSet 0 for sequential execution (default), 1 for parallel execution with OpenMP and 2 for parallel with TBB (optional)
u3_1qbitThe 2x2 kernel of the gate operation
inputThe input matrix on which the transformation is applied
derivSet true to apply derivate transformation, false otherwise (optional)
derivSet true to apply parallel kernels, false otherwise (optional)
parallelSet 0 for sequential execution (default), 1 for parallel execution with OpenMP and 2 for parallel with TBB (optional)

Definition at line 1478 of file Gate.cpp.

Here is the call graph for this function:

◆ apply_kernel_to() [2/2]

void Gate::apply_kernel_to ( Matrix_float u3_1qbit,
Matrix_float input,
bool  deriv = false,
int  parallel = 0,
const Matrix_float alt_kernel = nullptr 
)
protectedinherited

Float32 overload of one-qubit kernel application helper.

Definition at line 1772 of file Gate.cpp.

Here is the call graph for this function:

◆ apply_to() [1/6]

void Gates_block::apply_to ( Matrix_real parameters_mtx_in,
Matrix input,
int  parallel = 0 
)
overridevirtual

Call to apply the gate on the input array/matrix Gates_block*input.

Parameters
parametersAn array of the input parameters.
inputThe input array on which the gate is applied
parallelSet 0 for sequential execution, 1 for parallel execution with OpenMP and 2 for parallel with TBB (optional)
parametersAn array of parameters to calculate the matrix of the U3 gate.
inputThe input array on which the gate is applied
parallelSet 0 for sequential execution, 1 for parallel execution with OpenMP and 2 for parallel with TBB (optional)

Reimplemented from Gate.

Definition at line 606 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ apply_to() [2/6]

void Gates_block::apply_to ( Matrix_float input,
int  parallel = 0 
)
overridevirtual

Float32 overload for gate application.

Parameters
inputFloat32 input matrix/state
parallelSet 0 for sequential execution, 1 for parallel execution with OpenMP and 2 for parallel with TBB (optional)

Reimplemented from Gate.

Definition at line 714 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_to() [3/6]

void Gates_block::apply_to ( Matrix_real_float parameter_mtx,
Matrix_float input,
int  parallel = 0 
)
overridevirtual

Float32 overload for parametric gate application.

Parameters
parameter_mtxFloat32 parameter matrix
inputFloat32 input matrix/state
parallelSet 0 for sequential execution, 1 for parallel execution with OpenMP and 2 for parallel with TBB (optional)

Reimplemented from Gate.

Definition at line 722 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_to() [4/6]

void Gates_block::apply_to ( Matrix_real_any parameters_mtx,
Matrix_any input,
int  parallel = 0 
)
virtual

Precision-agnostic apply entry point for float32/float64 execution.

Parameters
parameters_mtxPrecision-tagged parameter matrix carrier
inputPrecision-tagged matrix/state carrier
parallelSet 0 for sequential execution, 1 for OpenMP and 2 for TBB

Definition at line 838 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_to() [5/6]

void Gate::apply_to ( Matrix input,
int  parallel 
)
virtualinherited

Call to apply the gate on the input array/matrix.

Parameters
inputThe input array on which the gate is applied
parallelSet 0 for sequential execution, 1 for parallel execution with OpenMP and 2 for parallel with TBB (optional)

Definition at line 433 of file Gate.cpp.

Here is the caller graph for this function:

◆ apply_to() [6/6]

void Gate::apply_to ( Matrix_any input,
int  parallel 
)
inherited

Precision-agnostic dispatch helper for matrix/state application.

Parameters
inputPrecision-tagged matrix carrier
parallelParallel mode selector

Definition at line 599 of file Gate.cpp.

Here is the call graph for this function:

◆ apply_to_combined() [1/4]

std::vector< Matrix > Gates_block::apply_to_combined ( Matrix_real parameters_mtx_in,
Matrix input,
int  parallel 
)
overridevirtual

Combined forward + derivative application with shared precomputed trig cache.

Return format: first element is forward apply_to result, remaining elements are derivatives.

Parameters
parameters_mtx_inParameter matrix for the gate
inputInput matrix/state
parallelParallel mode selector

Reimplemented from Gate.

Definition at line 1320 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ apply_to_combined() [2/4]

void Gates_block::apply_to_combined ( Matrix_real parameters_mtx,
Matrix input,
int  parallel,
std::vector< Matrix > &  output 
)
overridevirtual

Reimplemented from Gate.

Definition at line 1328 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_to_combined() [3/4]

std::vector< Matrix_float > Gates_block::apply_to_combined ( Matrix_real_float parameters_mtx_in,
Matrix_float input,
int  parallel 
)
overridevirtual

Float32 combined forward + derivative application.

Return format: first element is forward apply_to result, remaining elements are derivatives.

Parameters
parameters_mtx_inFloat32 parameter matrix for the gate
inputFloat32 input matrix/state
parallelParallel mode selector

Reimplemented from Gate.

Definition at line 1368 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_to_combined() [4/4]

void Gates_block::apply_to_combined ( Matrix_real_float parameters_mtx,
Matrix_float input,
int  parallel,
std::vector< Matrix_float > &  output 
)
overridevirtual

Reimplemented from Gate.

Definition at line 1376 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_to_combined_inner() [1/4]

std::vector< Matrix > Gates_block::apply_to_combined_inner ( Matrix_real parameters_mtx_in,
const Matrix_real precomputed_sincos,
Matrix input,
int  parallel 
)
overridevirtual

Internal combined forward+derivative entry with precomputed sin/cos.

Reimplemented from Gate.

Definition at line 1336 of file Gates_block.cpp.

Here is the caller graph for this function:

◆ apply_to_combined_inner() [2/4]

void Gates_block::apply_to_combined_inner ( Matrix_real parameters_mtx,
const Matrix_real precomputed_sincos,
Matrix input,
int  parallel,
std::vector< Matrix > &  output 
)
overridevirtual

Reimplemented from Gate.

Definition at line 1345 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_to_combined_inner() [3/4]

std::vector< Matrix_float > Gates_block::apply_to_combined_inner ( Matrix_real_float parameters_mtx_in,
const Matrix_real_float precomputed_sincos,
Matrix_float input,
int  parallel 
)
overridevirtual

Float32 internal combined forward+derivative entry with precomputed sin/cos.

Reimplemented from Gate.

Definition at line 1384 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_to_combined_inner() [4/4]

void Gates_block::apply_to_combined_inner ( Matrix_real_float parameters_mtx,
const Matrix_real_float precomputed_sincos,
Matrix_float input,
int  parallel,
std::vector< Matrix_float > &  output 
)
overridevirtual

Reimplemented from Gate.

Definition at line 1393 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_to_inner() [1/2]

void Gates_block::apply_to_inner ( Matrix_real parameter_mtx,
const Matrix_real precomputed_sincos,
Matrix input,
int  parallel = 0 
)
overridevirtual

Internal apply entry that consumes already precomputed sin/cos values.

parameter_mtx is preserved for gates with custom parameter handling.

Reimplemented from Gate.

Definition at line 614 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ apply_to_inner() [2/2]

void Gates_block::apply_to_inner ( Matrix_real_float parameter_mtx,
const Matrix_real_float precomputed_sincos,
Matrix_float input,
int  parallel = 0 
)
overridevirtual

Float32 internal apply entry that consumes already precomputed sin/cos values.

parameter_mtx is preserved for gates with custom parameter handling.

Reimplemented from Gate.

Definition at line 730 of file Gates_block.cpp.

Here is the call graph for this function:

◆ apply_to_list() [1/4]

void Gates_block::apply_to_list ( Matrix_real parameters_mtx,
std::vector< Matrix > &  inputs,
int  parallel 
)
overridevirtual

Call to apply the gate on the input array/matrix by U3*input.

Parameters
parametersAn array of parameters to calculate the matrix of the U3 gate.
inputsThe input array on which the gate is applied
parallelSet 0 for sequential execution, 1 for parallel execution with OpenMP and 2 for parallel with TBB (optional)
parametersAn array of parameters to calculate the matrix of the U3 gate.
inputThe input array on which the gate is applied

Reimplemented from Gate.

Definition at line 578 of file Gates_block.cpp.

◆ apply_to_list() [2/4]

void Gates_block::apply_to_list ( Matrix_real_float parameters_mtx,
std::vector< Matrix_float > &  inputs,
int  parallel 
)
overridevirtual

Float32 overload: apply circuit to a list of float32 matrices.

Parameters
parameters_mtxFloat32 parameter array
inputsFloat32 input matrices/states
parallelSet 0 for sequential execution, 1 for parallel execution with OpenMP and 2 for parallel with TBB (optional)

Reimplemented from Gate.

Definition at line 592 of file Gates_block.cpp.

◆ apply_to_list() [3/4]

void Gate::apply_to_list ( std::vector< Matrix > &  inputs,
int  parallel 
)
virtualinherited

Call to apply the gate on a list of inputs.

Parameters
inputsThe input array on which the gate is applied
parallelSet 0 for sequential execution, 1 for parallel execution with OpenMP and 2 for parallel with TBB (optional)

Definition at line 320 of file Gate.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ apply_to_list() [4/4]

void Gate::apply_to_list ( std::vector< Matrix_float > &  inputs,
int  parallel 
)
virtualinherited

Float32 overload: apply gate to a list of float32 inputs without parameters.

Parameters
inputsFloat32 input matrices/states
parallelSet 0 for sequential execution, 1 for parallel execution with OpenMP and 2 for parallel with TBB (optional)

Definition at line 380 of file Gate.cpp.

Here is the call graph for this function:

◆ calc_one_qubit_u3() [1/2]

Matrix Gate::calc_one_qubit_u3 ( double  ThetaOver2 = 0.0,
double  Phi = 0.0,
double  Lambda = 0.0 
)
staticinherited

Build a 2x2 U3 kernel from angles (theta/2, phi, lambda).

Static utility to avoid gate-specific conversion hooks.

Definition at line 2650 of file Gate.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calc_one_qubit_u3() [2/2]

Matrix_float Gate::calc_one_qubit_u3 ( float  ThetaOver2,
float  Phi,
float  Lambda 
)
staticinherited

Definition at line 2662 of file Gate.cpp.

Here is the call graph for this function:

◆ clear_children()

void Gate::clear_children ( )
inherited

Call to erase data on children.

Definition at line 1279 of file Gate.cpp.

Here is the caller graph for this function:

◆ clear_parents()

void Gate::clear_parents ( )
inherited

Call to erase data on parents.

Definition at line 1289 of file Gate.cpp.

Here is the caller graph for this function:

◆ clone()

Gates_block * Gates_block::clone ( )
overridevirtual

Create a clone of the present class.

Returns
Return with a pointer pointing to the cloned object.

Reimplemented from Gate.

Reimplemented in Sub_Matrix_Decomposition.

Definition at line 3321 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ combine()

void Gates_block::combine ( Gates_block op_block)

Call to append the gates of an gate block to the current block.

Call to append the gates of a gate block to the current circuit.

Parameters
op_blockA pointer to an instance of class Gate_block
op_blockA pointer to an instance of class Gates_block

Definition at line 3243 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compute_precomputed_sincos() [1/2]

Matrix_real Gate::compute_precomputed_sincos ( const Matrix_real parameters) const
inherited

Public wrapper to precompute gate-local sin/cos pairs.

Definition at line 1017 of file Gate.cpp.

Here is the caller graph for this function:

◆ compute_precomputed_sincos() [2/2]

Matrix_real_float Gate::compute_precomputed_sincos ( const Matrix_real_float parameters) const
inherited

Float32 public wrapper to precompute gate-local sin/cos pairs.

Definition at line 1024 of file Gate.cpp.

◆ contains_adaptive_gate() [1/2]

bool Gates_block::contains_adaptive_gate ( )

Call to determine, whether the circuit contains daptive gate or not.

Returns
Return with true if the circuit contains an adaptive gate.

Definition at line 3394 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ contains_adaptive_gate() [2/2]

bool Gates_block::contains_adaptive_gate ( int  idx)

Call to determine, whether the sub-circuit at a given position in the circuit contains daptive gate or not.

Parameters
idxThe position of the gate to be checked.
Returns
Return with true if the circuit contains an adaptive gate.

Definition at line 3421 of file Gates_block.cpp.

Here is the call graph for this function:

◆ create_remapped_circuit() [1/2]

Gates_block * Gates_block::create_remapped_circuit ( const std::map< int, int > &  qbit_map)

Call to create a new circuit with remapped qubits.

Parameters
qbit_mapThe map to reorder the qbits in a form of map: {int(initial_qbit): int(remapped_qbit)}.
Returns
Returns with the remapped circuit

Definition at line 3014 of file Gates_block.cpp.

Here is the caller graph for this function:

◆ create_remapped_circuit() [2/2]

Gates_block * Gates_block::create_remapped_circuit ( const std::map< int, int > &  qbit_map,
const int  qbit_num_ 
)

Call to create a new circuit with remapped qubits.

Parameters
qbit_mapThe map to reorder the qbits in a form of map: {int(initial_qbit): int(remapped_qbit)}. .
qbit_numThe number of qubits in the remapped circuit
Returns
Returns with the remapped circuit

Definition at line 3028 of file Gates_block.cpp.

Here is the call graph for this function:

◆ derivative_aux_kernel() [1/2]

Matrix Gate::derivative_aux_kernel ( const Matrix_real precomputed_sincos,
int  param_idx 
)
virtualinherited

Reimplemented in CROT.

Definition at line 1415 of file Gate.cpp.

◆ derivative_aux_kernel() [2/2]

Matrix_float Gate::derivative_aux_kernel ( const Matrix_real_float precomputed_sincos,
int  param_idx 
)
virtualinherited

Reimplemented in CROT.

Definition at line 1423 of file Gate.cpp.

◆ derivative_aux_kernel_to() [1/2]

void Gate::derivative_aux_kernel_to ( const Matrix_real precomputed_sincos,
int  param_idx,
Matrix output 
)
virtualinherited

Reimplemented in CROT.

Definition at line 2629 of file Gate.cpp.

◆ derivative_aux_kernel_to() [2/2]

void Gate::derivative_aux_kernel_to ( const Matrix_real_float precomputed_sincos,
int  param_idx,
Matrix_float output 
)
virtualinherited

Reimplemented in CROT.

Definition at line 2635 of file Gate.cpp.

◆ derivative_kernel() [1/2]

Matrix Gate::derivative_kernel ( const Matrix_real precomputed_sincos,
int  param_idx 
)
virtualinherited

Reimplemented in RXX, RYY, RZZ, CROT, U3, CU, R, RX, RY, RZ, U1, and U2.

Definition at line 1371 of file Gate.cpp.

Here is the call graph for this function:

◆ derivative_kernel() [2/2]

Matrix_float Gate::derivative_kernel ( const Matrix_real_float precomputed_sincos,
int  param_idx 
)
virtualinherited

Reimplemented in RXX, RYY, RZZ, CROT, U3, CU, R, RX, RY, RZ, U1, and U2.

Definition at line 1393 of file Gate.cpp.

Here is the call graph for this function:

◆ derivative_kernel_to() [1/2]

void Gate::derivative_kernel_to ( const Matrix_real precomputed_sincos,
int  param_idx,
Matrix output 
)
virtualinherited

Reimplemented in RXX, RYY, RZZ, CROT, U3, CU, R, RX, RY, RZ, U1, and U2.

Definition at line 2617 of file Gate.cpp.

◆ derivative_kernel_to() [2/2]

void Gate::derivative_kernel_to ( const Matrix_real_float precomputed_sincos,
int  param_idx,
Matrix_float output 
)
virtualinherited

Reimplemented in RXX, RYY, RZZ, CROT, U3, CU, R, RX, RY, RZ, U1, and U2.

Definition at line 2623 of file Gate.cpp.

◆ determine_children()

void Gates_block::determine_children ( Gate gate)

Call to obtain the child gates in the circuit.

A child gate needs to be applied after the given gate. The children gates are stored via the "children" attribute of the gate instance

Parameters
gateThe gate for which the children are determined.

Definition at line 3741 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ determine_parents()

void Gates_block::determine_parents ( Gate gate)

Call to obtain the parent gates in the circuit.

A parent gate needs to be applied prior to the given gate. The parent gates are stored via the "parents" attribute of the gate instance

Parameters
gateThe gate for which the parents are determined.

Definition at line 3695 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extract_gates()

int Gates_block::extract_gates ( Gates_block op_block)

Call to extract the gates stored in the class.

Parameters
op_blockAn instance of Gates_block class in which the gates will be stored. (The current gates will be erased)
Returns
Return with 0 on success.

Definition at line 3346 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extract_parameters() [1/2]

Matrix_real_float Gate::extract_parameters ( Matrix_real_float parameters)
virtualinherited

Float32 overload of extract_parameters.

Uses get_parameter_multipliers() identically.

Parameters
parametersThe float32 parameter array corresponding to the circuit in which the gate is embedded
Returns
Returns with the float32 array of the extracted parameters.

Uses get_parameter_multipliers() identically. Multiplier m → extracted[i] = fmodf(m * params[start+i], m * 2π).

Definition at line 2710 of file Gate.cpp.

Here is the call graph for this function:

◆ extract_parameters() [2/2]

Matrix_real Gates_block::extract_parameters ( Matrix_real parameters)
overridevirtual

Call to extract parameters from the parameter array corresponding to the circuit, in which the gate is embedded.

Parameters
parametersThe parameter array corresponding to the circuit in which the gate is embedded
Returns
Returns with the array of the extracted parameters.

Reimplemented from Gate.

Definition at line 3866 of file Gates_block.cpp.

Here is the call graph for this function:

◆ fragment_circuit()

void Gates_block::fragment_circuit ( )

◆ gate_kernel() [1/2]

Matrix Gate::gate_kernel ( const Matrix_real precomputed_sincos)
virtualinherited

Compute the gate kernel matrix from precomputed trigonometric values.

Default gate_kernel: throws if not overridden.

Returns a 2x2 matrix for single-qubit (and controlled single-qubit) gates, or a 4x4 matrix for 2-qubit gates (RXX, RYY, RZZ, etc.). Zero-parameter gates ignore the precomputed_sincos argument.

Parameters
precomputed_sincosGate-local sin/cos table with shape (parameter_num, 2).
Returns
Gate kernel matrix (2x2 or 4x4).

Reimplemented in SYC, RXX, RYY, RZZ, CROT, U3, H, S, SDG, SX, SXdg, T, Tdg, X, Y, Z, CU, R, RX, RY, RZ, U1, and U2.

Definition at line 2546 of file Gate.cpp.

Here is the caller graph for this function:

◆ gate_kernel() [2/2]

Matrix_float Gate::gate_kernel ( const Matrix_real_float precomputed_sincos)
virtualinherited

Reimplemented in SYC, RXX, RYY, RZZ, CROT, U3, H, S, SDG, SX, SXdg, T, Tdg, X, Y, Z, CU, R, RX, RY, RZ, U1, and U2.

Definition at line 2553 of file Gate.cpp.

◆ gate_kernel_to() [1/2]

void Gate::gate_kernel_to ( const Matrix_real precomputed_sincos,
Matrix output 
)
virtualinherited

Reimplemented in RXX, RYY, RZZ, CROT, U3, H, S, SDG, SX, SXdg, T, Tdg, X, Y, Z, CU, R, RX, RY, RZ, U1, and U2.

Definition at line 2593 of file Gate.cpp.

◆ gate_kernel_to() [2/2]

void Gate::gate_kernel_to ( const Matrix_real_float precomputed_sincos,
Matrix_float output 
)
virtualinherited

Reimplemented in RXX, RYY, RZZ, CROT, U3, H, S, SDG, SX, SXdg, T, Tdg, X, Y, Z, CU, R, RX, RY, RZ, U1, and U2.

Definition at line 2599 of file Gate.cpp.

◆ get_children()

std::vector< Gate * > Gate::get_children ( )
inherited

Call to get the children of the current gate.

Returns
Returns with the list of the children

Definition at line 1312 of file Gate.cpp.

Here is the caller graph for this function:

◆ get_control_qbit()

int Gate::get_control_qbit ( )
inherited

Call to get the index of the control qubit.

Returns
Return with the index of the control qubit (return with -1 if control qubit was not set)

Definition at line 1211 of file Gate.cpp.

Here is the caller graph for this function:

◆ get_control_qbits()

std::vector< int > Gate::get_control_qbits ( ) const
inherited

Call to get the vector of control qubits.

Returns
Returns vector of control qubit indices

Definition at line 1135 of file Gate.cpp.

Here is the caller graph for this function:

◆ get_flat_circuit()

Gates_block * Gates_block::get_flat_circuit ( )

Method to generate a flat circuit.

A flat circuit is a circuit does not containing subcircuits: there are no Gates_block instances (containing subcircuits) in the resulting circuit. If the original circuit contains subcircuits, the gates in the subcircuits are directly incorporated in the resulting flat circuit.

Definition at line 3828 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_gate()

Gate * Gates_block::get_gate ( int  idx)

Call to get the gates stored in the class.

Call to get a gate stored in the class.

Returns
Return with a list of the gates.
Return with a pointer to the gate. (Borrowed reference, dont free the memory)

Definition at line 3229 of file Gates_block.cpp.

Here is the caller graph for this function:

◆ get_gate_num()

int Gates_block::get_gate_num ( )

Call to get the number of gates grouped in the class.

Returns
Return with the number of the gates grouped in the gate block.

Definition at line 2656 of file Gates_block.cpp.

Here is the caller graph for this function:

◆ get_gate_nums()

std::map< std::string, int > Gates_block::get_gate_nums ( )

Call to get the number of the individual gate types in the list of gates.

Returns
Returns with a map<gate_name, gate_count> describing the number of the individual gate types

Definition at line 2630 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_gates()

std::vector< Gate * > Gates_block::get_gates ( )

Call to get the gates stored in the class.

Returns
Return with a list of the gates.

(The resulting vector contains borrowed pointers to the gates, so they dont need to be deleted.)

Returns
Return with a list of the gates.

Definition at line 3220 of file Gates_block.cpp.

Here is the caller graph for this function:

◆ get_involved_qubits()

std::vector< int > Gates_block::get_involved_qubits ( bool  only_target = false)
overridevirtual

Call to get the qubits involved in the gates stored in the block of gates.

Returns
Return with a list of the involved qubits
Return with a list of the invovled qubits

Reimplemented from Gate.

Definition at line 3158 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_matrix() [1/6]

Matrix Gates_block::get_matrix ( Matrix_real parameters)
overridevirtual

Call to retrieve the gate matrix (Which is the product of all the gate matrices stored in the gate block)

Call to retrieve the operation matrix (Which is the product of all the operation matrices stored in the operation block)

Parameters
parametersAn array pointing to the parameters of the gates
Returns
Returns with the gate matrix
Parameters
parametersAn array pointing to the parameters of the gates
Returns
Returns with the operation matrix

Reimplemented from Gate.

Definition at line 193 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_matrix() [2/6]

Matrix Gates_block::get_matrix ( Matrix_real parameters,
int  parallel 
)
overridevirtual

Call to retrieve the gate matrix (Which is the product of all the gate matrices stored in the gate block)

Call to retrieve the operation matrix (Which is the product of all the operation matrices stored in the operation block)

Parameters
parametersAn array pointing to the parameters of the gates
parallelSet 0 for sequential execution, 1 for parallel execution with OpenMP and 2 for parallel with TBB (optional)
Returns
Returns with the gate matrix
Parameters
parametersAn array pointing to the parameters of the gates
parallelSet 0 for sequential execution, 1 for parallel execution with OpenMP and 2 for parallel with TBB (optional)
Returns
Returns with the operation matrix

Reimplemented from Gate.

Definition at line 209 of file Gates_block.cpp.

Here is the call graph for this function:

◆ get_matrix() [3/6]

Matrix_float Gates_block::get_matrix ( Matrix_real_float parameters)

Definition at line 233 of file Gates_block.cpp.

Here is the call graph for this function:

◆ get_matrix() [4/6]

Matrix_float Gates_block::get_matrix ( Matrix_real_float parameters,
int  parallel 
)
overridevirtual

Float32 overload: retrieve the gate matrix.

Parameters
parametersFloat32 parameter array
parallelSet 0 for sequential execution, 1 for parallel execution with OpenMP and 2 for parallel with TBB (optional)
Returns
Returns with a float32 matrix of the gate

Base implementation creates a float32 identity and applies the gate with parallel=0 to avoid any broken AVX path. Derived classes should override this.

Parameters
parametersFloat32 parameter array
parallelUnused in the base implementation (always uses sequential path)
Returns
Returns with a float32 matrix of the gate

Reimplemented from Gate.

Definition at line 238 of file Gates_block.cpp.

Here is the call graph for this function:

◆ get_matrix() [5/6]

Matrix Gate::get_matrix ( )
virtualinherited

Retrieve the gate matrix for zero-parameter gates (no parameters).

Definition at line 283 of file Gate.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_matrix() [6/6]

Matrix Gate::get_matrix ( int  parallel)
virtualinherited

Retrieve the gate matrix for zero-parameter gates with parallel flag.

Definition at line 290 of file Gate.cpp.

Here is the call graph for this function:

◆ get_name()

std::string Gate::get_name ( )
inherited

Call to get the name label of the gate.

Returns
Returns with the name label of the gate

Definition at line 2740 of file Gate.cpp.

Here is the caller graph for this function:

◆ get_parameter_max()

void Gates_block::get_parameter_max ( Matrix_real range_max)

◆ get_parameter_multipliers()

std::vector< double > Gate::get_parameter_multipliers ( ) const
virtualinherited

Returns the per-parameter multipliers relative to 2π used by extract_parameters.

Returns the per-parameter multipliers relative to 2π.

A multiplier of 2 means extracted = fmod(2*p, 4π); multiplier of 1 means fmod(p, 2π). Zero-parameter gates return an empty vector. Override in every parametric gate subclass.

Returns
Vector of multipliers (one per parameter, in order).

Default implementation: empty (zero-parameter gate).

Reimplemented in RXX, RYY, RZZ, CROT, U3, CU, R, RX, RY, RZ, U1, and U2.

Definition at line 2644 of file Gate.cpp.

◆ get_parameter_num()

int Gates_block::get_parameter_num ( )
overridevirtual

Call to get the number of free parameters.

Returns
Return with the number of parameters of the gates grouped in the gate block.

Reimplemented from Gate.

Definition at line 2645 of file Gates_block.cpp.

Here is the caller graph for this function:

◆ get_parameter_start_idx()

int Gate::get_parameter_start_idx ( )
inherited

Call to get the starting index of the parameters in the parameter array corresponding to the circuit in which the current gate is incorporated.

Parameters
start_idxThe starting index

Definition at line 2535 of file Gate.cpp.

Here is the caller graph for this function:

◆ get_parents()

std::vector< Gate * > Gate::get_parents ( )
inherited

Call to get the parents of the current gate.

Returns
Returns with the list of the parents

Definition at line 1301 of file Gate.cpp.

Here is the caller graph for this function:

◆ get_qbit_num()

int Gate::get_qbit_num ( )
inherited

Call to get the number of qubits composing the unitary.

Returns
Return with the number of qubits composing the unitary

Definition at line 1342 of file Gate.cpp.

Here is the caller graph for this function:

◆ get_reduced_density_matrix()

Matrix Gates_block::get_reduced_density_matrix ( Matrix_real parameters_mtx,
Matrix input_state,
matrix_base< int > &  qbit_list_subset 
)

Call to evaluate the reduced densiy matrix.

Parameters
parametersAn array of parameters to calculate the entropy
input_stateThe input state on which the gate structure is applied
qbit_listSubset of qubits for which the entropy should be calculated. (Should conatin unique elements) Returns with the reduced density matrix.

Definition at line 3448 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_second_Renyi_entropy()

double Gates_block::get_second_Renyi_entropy ( Matrix_real parameters_mtx,
Matrix input_state,
matrix_base< int > &  qbit_list_subset 
)

Call to evaluate the seconf Rényi entropy.

The quantum circuit is applied on an input state input. The entropy is evaluated for the transformed state.

Parameters
parametersAn array of parameters to calculate the entropy
input_stateThe input state on which the gate structure is applied
qbit_listSubset of qubits for which the entropy should be calculated. (Should conatin unique elements) Returns with the calculated entropy

Definition at line 3625 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_target_qbit()

int Gate::get_target_qbit ( )
inherited

Call to get the index of the target qubit.

Returns
Return with the index of the target qubit (return with -1 if target qubit was not set)

Definition at line 1203 of file Gate.cpp.

Here is the caller graph for this function:

◆ get_target_qbits()

std::vector< int > Gate::get_target_qbits ( ) const
inherited

Call to get the vector of target qubits.

Returns
Returns vector of target qubit indices

Definition at line 1143 of file Gate.cpp.

Here is the caller graph for this function:

◆ get_type()

gate_type Gate::get_type ( )
inherited

Call to get the type of the operation.

Returns
Return with the type of the operation (see gate_type for details)

Definition at line 1333 of file Gate.cpp.

Here is the caller graph for this function:

◆ insert_gate()

void Gates_block::insert_gate ( Gate gate,
int  idx 
)

Call to insert a gate at a given position.

Parameters
gateA pointer to a class Gate describing a gate.
idxThe position where to insert the gate.

Definition at line 2569 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ invalidate_structure_cache()

void Gates_block::invalidate_structure_cache ( )
protected

Definition at line 121 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ inverse_gate_kernel() [1/2]

Matrix Gate::inverse_gate_kernel ( const Matrix_real precomputed_sincos)
virtualinherited

Reimplemented in SYC, RXX, RYY, RZZ, CROT, U3, H, S, SDG, SX, SXdg, T, Tdg, X, Y, Z, CU, R, RX, RY, RZ, U1, and U2.

Definition at line 2560 of file Gate.cpp.

◆ inverse_gate_kernel() [2/2]

Matrix_float Gate::inverse_gate_kernel ( const Matrix_real_float precomputed_sincos)
virtualinherited

Reimplemented in SYC, RXX, RYY, RZZ, CROT, U3, H, S, SDG, SX, SXdg, T, Tdg, X, Y, Z, CU, R, RX, RY, RZ, U1, and U2.

Definition at line 2576 of file Gate.cpp.

◆ inverse_gate_kernel_to() [1/2]

void Gate::inverse_gate_kernel_to ( const Matrix_real precomputed_sincos,
Matrix output 
)
virtualinherited

Reimplemented in RXX, RYY, RZZ, CROT, U3, H, S, SDG, SX, SXdg, T, Tdg, X, Y, Z, CU, R, RX, RY, RZ, U1, and U2.

Definition at line 2605 of file Gate.cpp.

◆ inverse_gate_kernel_to() [2/2]

void Gate::inverse_gate_kernel_to ( const Matrix_real_float precomputed_sincos,
Matrix_float output 
)
virtualinherited

Reimplemented in RXX, RYY, RZZ, CROT, U3, H, S, SDG, SX, SXdg, T, Tdg, X, Y, Z, CU, R, RX, RY, RZ, U1, and U2.

Definition at line 2611 of file Gate.cpp.

◆ list_gates()

void Gates_block::list_gates ( const Matrix_real parameters,
int  start_index 
)

Call to print the list of gates stored in the block of gates for a specific set of parameters.

Parameters
parametersThe parameters of the gates that should be printed.
start_indexThe ordinal number of the first gate.

Definition at line 2666 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ precompute_sincos() [1/2]

Matrix_real Gate::precompute_sincos ( const Matrix_real parameters) const
protectedinherited

Precompute sin/cos pairs for each gate-local parameter.

Parameters
parametersGate-local angle parameters.
Returns
Matrix with shape (parameter_num, 2): [sin(theta_i), cos(theta_i)].

Definition at line 1431 of file Gate.cpp.

Here is the call graph for this function:

◆ precompute_sincos() [2/2]

Matrix_real_float Gate::precompute_sincos ( const Matrix_real_float parameters) const
protectedinherited

Float32 precompute sin/cos pairs for each gate-local parameter.

Parameters
parametersGate-local angle parameters.
Returns
Matrix with shape (parameter_num, 2): [sin(theta_i), cos(theta_i)].

Definition at line 1450 of file Gate.cpp.

Here is the call graph for this function:

◆ print()

void logging::print ( const std::stringstream &  sstream,
int  verbose_level = 1 
) const
inherited

Call to print output messages in the function of the verbosity level.

Parameters
sstreamThe stringstream input to store the output messages.
verbose_levelInteger input. High level means write more to the standart output, 0 means write nothing. The default value is set to 1.

Definition at line 55 of file logging.cpp.

◆ release_gate()

void Gates_block::release_gate ( int  idx)

Call to release one gate in the list.

Definition at line 168 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ release_gates()

void Gates_block::release_gates ( )

Call to release the stored gates.

Definition at line 146 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reorder_qubits()

void Gates_block::reorder_qubits ( std::vector< int qbit_list)
overridevirtual

Call to reorder the qubits in the matrix of the gates (Obsolete function)

Call to reorder the qubits in the matrix of the gate (OBSOLETE function)

Parameters
qbit_listThe reordered list of qubits spanning the matrix

Reimplemented from Gate.

Reimplemented in Decomposition_Base.

Definition at line 3140 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_dependency_graph()

void Gates_block::reset_dependency_graph ( )

Method to reset the dependency graph of the gates in the circuit.

Definition at line 3799 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_parameter_start_indices()

void Gates_block::reset_parameter_start_indices ( )

Method to reset the parameter start indices of gate operations incorporated in the circuit.

Method reset the parameter start indices of gate operations incorporated in the circuit.

(When a gate is inserted into the circuit at other position than the end.)

Definition at line 3778 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_children()

void Gate::set_children ( std::vector< Gate *> &  children_)
inherited

Call to set the children of the current gate.

Parameters
children_the list of the children

Definition at line 2523 of file Gate.cpp.

Here is the caller graph for this function:

◆ set_control_qbit()

void Gate::set_control_qbit ( int  control_qbit_in)
inherited

Call to set the control qubit for the gate operation.

Parameters
control_qbit_inThe control qubit. Should be: 0 <= control_qbit_in < qbit_num

Definition at line 1054 of file Gate.cpp.

Here is the caller graph for this function:

◆ set_control_qbits()

void Gate::set_control_qbits ( const std::vector< int > &  control_qbits_in)
inherited

Call to set the control qubits for the gate operation.

Parameters
control_qbits_inVector of control qubit indices

Definition at line 1097 of file Gate.cpp.

Here is the caller graph for this function:

◆ set_debugfile()

void logging::set_debugfile ( std::string  debugfile)
inherited

Call to set the debugfile name.

Parameters
debugfileString variable. Set the debugfile name.

Definition at line 95 of file logging.cpp.

Here is the caller graph for this function:

◆ set_matrix() [1/2]

void Gate::set_matrix ( Matrix  input)
inherited

Call to set the stored matrix in the operation.

Parameters
inputThe operation matrix to be stored. The matrix is stored by attribute matrix_alloc.
Returns
Returns with 0 on success.

Definition at line 1036 of file Gate.cpp.

Here is the caller graph for this function:

◆ set_matrix() [2/2]

void Gate::set_matrix ( Matrix_float  input)
inherited

Definition at line 1043 of file Gate.cpp.

◆ set_min_fusion()

void Gates_block::set_min_fusion ( int  min_fusion)

Definition at line 3264 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_parameter_start_idx()

void Gate::set_parameter_start_idx ( int  start_idx)
inherited

Call to set the starting index of the parameters in the parameter array corresponding to the circuit in which the current gate is incorporated.

Parameters
start_idxThe starting index

Definition at line 2500 of file Gate.cpp.

Here is the caller graph for this function:

◆ set_parents()

void Gate::set_parents ( std::vector< Gate *> &  parents_)
inherited

Call to set the parents of the current gate.

Parameters
parents_the list of the parents

Definition at line 2511 of file Gate.cpp.

Here is the caller graph for this function:

◆ set_qbit_num()

void Gates_block::set_qbit_num ( int  qbit_num_in)
overridevirtual

Set the number of qubits spanning the matrix of the gates stored in the block of gates.

Parameters
qbit_num_inThe number of qubits spanning the matrices.

Reimplemented from Gate.

Reimplemented in Decomposition_Base.

Definition at line 3278 of file Gates_block.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_target_qbit()

void Gate::set_target_qbit ( int  target_qbit_in)
inherited

Call to set the target qubit for the gate operation.

Parameters
target_qbit_inThe target qubit on which the gate is applied. Should be: 0 <= target_qbit_in < qbit_num

Definition at line 1076 of file Gate.cpp.

Here is the caller graph for this function:

◆ set_target_qbits()

void Gate::set_target_qbits ( const std::vector< int > &  target_qbits_in)
inherited

Call to set the target qubits for the gate operation.

Parameters
target_qbits_inVector of target qubit indices

Definition at line 1116 of file Gate.cpp.

Here is the caller graph for this function:

◆ set_verbose()

void logging::set_verbose ( int  verbose_in)
inherited

Call to set the verbose attribute.

Parameters
verbose_inInteger variable. Set the number to specify the verbosity level for output messages.

Definition at line 85 of file logging.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ children

std::vector<Gate*> Gate::children
protectedinherited

list of child gates to be applied after this current gate

Definition at line 114 of file Gate.h.

◆ control_qbit

int Gate::control_qbit
protectedinherited

The index of the qubit which acts as a control qubit (control_qbit >= 0) in controlled operations.

Definition at line 100 of file Gate.h.

◆ control_qbits

std::vector<int> Gate::control_qbits
protectedinherited

Vector of control qubit indices (for multi-qubit gates)

Definition at line 104 of file Gate.h.

◆ debug

bool logging::debug
inherited

Logical variable. Set true to write output messages to the 'debug.txt' file.

Definition at line 53 of file logging.h.

◆ debugfile_name

std::string logging::debugfile_name
inherited

String variable. Set the debug file name.

Definition at line 56 of file logging.h.

◆ fusion_block

SmartAtomicPtr<Gates_block> Gates_block::fusion_block
protected

Definition at line 56 of file Gates_block.h.

◆ gates

std::vector<Gate*> Gates_block::gates
protected

The list of stored gates.

Definition at line 49 of file Gates_block.h.

◆ involved_qubits_cache

std::vector<int> Gates_block::involved_qubits_cache
mutableprotected

Definition at line 59 of file Gates_block.h.

◆ involved_qubits_cache_mutex

std::shared_ptr<tbb::spin_mutex> Gates_block::involved_qubits_cache_mutex
mutableprotected

Definition at line 61 of file Gates_block.h.

◆ involved_qubits_cache_valid

bool Gates_block::involved_qubits_cache_valid
mutableprotected

Definition at line 57 of file Gates_block.h.

◆ involved_target_qubits_cache

std::vector<int> Gates_block::involved_target_qubits_cache
mutableprotected

Definition at line 60 of file Gates_block.h.

◆ involved_target_qubits_cache_valid

bool Gates_block::involved_target_qubits_cache_valid
mutableprotected

Definition at line 58 of file Gates_block.h.

◆ layer_num

int Gates_block::layer_num
protected

number of gate layers

Definition at line 51 of file Gates_block.h.

◆ matrix_size

int Gate::matrix_size
protectedinherited

The size N of the NxN matrix associated with the operations.

Definition at line 106 of file Gate.h.

◆ min_fusion

int Gates_block::min_fusion
protected

maximal number of qubits in partitions

Definition at line 55 of file Gates_block.h.

◆ name

std::string Gate::name
protectedinherited

A string labeling the gate operation.

Definition at line 92 of file Gate.h.

◆ parameter_num

int Gate::parameter_num
protectedinherited

the number of free parameters of the operation

Definition at line 108 of file Gate.h.

◆ parameter_start_idx

int Gate::parameter_start_idx
protectedinherited

the index in the parameter array (corrensponding to the encapsulated circuit) where the gate parameters begin (if gates are placed into a circuit a single parameter array is used to execute the whole circuit)

Definition at line 110 of file Gate.h.

◆ parents

std::vector<Gate*> Gate::parents
protectedinherited

list of parent gates to be applied in the circuit prior to this current gate

Definition at line 112 of file Gate.h.

◆ qbit_num

int Gate::qbit_num
protectedinherited

number of qubits spanning the matrix of the operation

Definition at line 94 of file Gate.h.

◆ target_qbit

int Gate::target_qbit
protectedinherited

The index of the qubit on which the operation acts (target_qbit >= 0)

Definition at line 98 of file Gate.h.

◆ target_qbits

std::vector<int> Gate::target_qbits
protectedinherited

Vector of target qubit indices (for multi-qubit gates)

Definition at line 102 of file Gate.h.

◆ type

gate_type Gate::type
protectedinherited

The type of the operation (see enumeration gate_type)

Definition at line 96 of file Gate.h.

◆ verbose

int logging::verbose
inherited

Set the verbosity level of the output messages.

Definition at line 50 of file logging.h.


The documentation for this class was generated from the following files: