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
CRY Class Reference

A class representing a CRY gate. More...

#include <CRY.h>

Inheritance diagram for CRY:
Inheritance graph
[legend]

Public Member Functions

void add_child (Gate *child)
 Call to add a child gate to the current gate. More...
 
void add_parent (Gate *parent)
 Call to add a parent gate to the current gate. More...
 
virtual std::vector< Matrixapply_derivate_to (Matrix_real &parameters_mtx_in, Matrix &input, int parallel)
 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_in, Matrix &input, int parallel, std::vector< Matrix > &output)
 
virtual std::vector< Matrix_floatapply_derivate_to (Matrix_real_float &parameters_mtx_in, Matrix_float &input, int parallel)
 Float32 overload for derivative evaluation. More...
 
virtual void apply_derivate_to (Matrix_real_float &parameters_mtx_in, Matrix_float &input, int parallel, std::vector< Matrix_float > &output)
 
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 (Matrix_real &parameter_mtx, Matrix &input)
 Call to apply the gate on the input array/matrix by input*Gate. More...
 
virtual void apply_from_right (Matrix_real_float &parameter_mtx, Matrix_float &input)
 Float32 overload for right-side parametric gate application by input*Gate. More...
 
virtual void apply_from_right_inner (Matrix_real &parameter_mtx, const Matrix_real &precomputed_sincos, Matrix &input)
 Internal right-apply entry that consumes already precomputed sin/cos values. More...
 
virtual void apply_from_right_inner (Matrix_real_float &parameter_mtx, const Matrix_real_float &precomputed_sincos, Matrix_float &input)
 Float32 internal right-apply entry that consumes already precomputed sin/cos values. More...
 
virtual void apply_to (Matrix &input, int parallel)
 Call to apply the gate on the input array/matrix. More...
 
virtual void apply_to (Matrix_float &input, int parallel)
 Float32 overload for gate application. More...
 
virtual void apply_to (Matrix_real &parameter_mtx, Matrix &input, int parallel)
 Abstract function to be overriden in derived classes to be used to transform an input upon a parametric gate operation. More...
 
virtual void apply_to (Matrix_real_float &parameter_mtx, Matrix_float &input, int parallel)
 Float32 overload for parametric gate application. More...
 
void apply_to (Matrix_any &input, int parallel)
 Precision-agnostic dispatch helper for matrix/state application. More...
 
void apply_to (Matrix_real_any &parameter_mtx, Matrix_any &input, int parallel)
 Precision-agnostic dispatch helper for parametric application. More...
 
virtual std::vector< Matrixapply_to_combined (Matrix_real &parameters_mtx_in, Matrix &input, int parallel)
 Combined forward + derivative application with shared precomputed trig cache. More...
 
virtual void apply_to_combined (Matrix_real &parameters_mtx_in, Matrix &input, int parallel, std::vector< Matrix > &output)
 
virtual std::vector< Matrix_floatapply_to_combined (Matrix_real_float &parameters_mtx_in, Matrix_float &input, int parallel)
 Float32 combined forward + derivative application. More...
 
virtual void apply_to_combined (Matrix_real_float &parameters_mtx_in, Matrix_float &input, int parallel, std::vector< Matrix_float > &output)
 
virtual std::vector< Matrixapply_to_combined_inner (Matrix_real &parameters_mtx_in, const Matrix_real &precomputed_sincos, Matrix &input, int parallel)
 Internal combined forward+derivative entry with precomputed sin/cos. More...
 
virtual void apply_to_combined_inner (Matrix_real &parameters_mtx_in, const Matrix_real &precomputed_sincos, Matrix &input, int parallel, std::vector< Matrix > &output)
 
virtual std::vector< Matrix_floatapply_to_combined_inner (Matrix_real_float &parameters_mtx_in, const Matrix_real_float &precomputed_sincos, Matrix_float &input, int parallel)
 Float32 internal combined forward+derivative entry with precomputed sin/cos. More...
 
virtual void apply_to_combined_inner (Matrix_real_float &parameters_mtx_in, const Matrix_real_float &precomputed_sincos, Matrix_float &input, int parallel, std::vector< Matrix_float > &output)
 
virtual void apply_to_inner (Matrix_real &parameter_mtx, const Matrix_real &precomputed_sincos, Matrix &input, int parallel)
 Internal apply entry that consumes already precomputed sin/cos values. More...
 
virtual void apply_to_inner (Matrix_real_float &parameter_mtx, const Matrix_real_float &precomputed_sincos, Matrix_float &input, int parallel)
 Float32 internal apply entry that consumes already precomputed sin/cos values. 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 (Matrix_real &parameters_mtx, std::vector< Matrix > &inputs, int parallel)
 Abstract function to be overriden in derived classes to be used to transform a list of inputs upon a parametric gate operation. 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...
 
virtual void apply_to_list (Matrix_real_float &parameters_mtx, std::vector< Matrix_float > &inputs, int parallel)
 Float32 overload: apply gate to a list of float32 inputs with float32 parameters. More...
 
void clear_children ()
 Call to erase data on children. More...
 
void clear_parents ()
 Call to erase data on parents. More...
 
virtual CRYclone () override
 Call to create a clone of the present class. 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...
 
 CRY ()
 Nullary constructor of the class. More...
 
 CRY (int qbit_num_in, int target_qbit_in, int control_qbit_in)
 Constructor of the class. 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) override
 
virtual Matrix_float derivative_kernel (const Matrix_real_float &precomputed_sincos, int param_idx) override
 
virtual void derivative_kernel_to (const Matrix_real &precomputed_sincos, int param_idx, Matrix &output) override
 
virtual void derivative_kernel_to (const Matrix_real_float &precomputed_sincos, int param_idx, Matrix_float &output) override
 
virtual Matrix_real extract_parameters (Matrix_real &parameters)
 Call to extract parameters from the parameter array corresponding to the circuit, in which the gate is embedded. More...
 
virtual Matrix_real_float extract_parameters (Matrix_real_float &parameters)
 Float32 overload of extract_parameters. More...
 
virtual Matrix gate_kernel (const Matrix_real &precomputed_sincos) override
 Compute the gate kernel matrix from precomputed trigonometric values. More...
 
virtual Matrix_float gate_kernel (const Matrix_real_float &precomputed_sincos) override
 
virtual void gate_kernel_to (const Matrix_real &precomputed_sincos, Matrix &output) override
 
virtual void gate_kernel_to (const Matrix_real_float &precomputed_sincos, Matrix_float &output) override
 
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...
 
virtual std::vector< intget_involved_qubits (bool only_target=false)
 Call to get the qubits involved in the gate operation. More...
 
virtual Matrix get_matrix (Matrix_real &parameters, int parallel)
 Call to retrieve the gate matrix. More...
 
virtual Matrix get_matrix (Matrix_real &parameters)
 Convenience overload: retrieve the gate matrix (sequential). 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...
 
virtual Matrix_float get_matrix (Matrix_real_float &parameters, int parallel)
 Float32 overload: retrieve the gate matrix. More...
 
std::string get_name ()
 Call to get the name label of the gate. More...
 
virtual std::vector< double > get_parameter_multipliers () const override
 Returns the per-parameter multipliers relative to 2π used by extract_parameters. More...
 
virtual int get_parameter_num ()
 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...
 
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...
 
virtual Matrix inverse_gate_kernel (const Matrix_real &precomputed_sincos) override
 
virtual Matrix_float inverse_gate_kernel (const Matrix_real_float &precomputed_sincos) override
 
virtual void inverse_gate_kernel_to (const Matrix_real &precomputed_sincos, Matrix &output) override
 
virtual void inverse_gate_kernel_to (const Matrix_real_float &precomputed_sincos, Matrix_float &output) override
 
void print (const std::stringstream &sstream, int verbose_level=1) const
 Call to print output messages in the function of the verbosity level. More...
 
virtual void reorder_qubits (std::vector< int > qbit_list)
 Call to reorder the qubits in the matrix of the operation. 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_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)
 Set the number of qubits spanning the matrix of the operation. 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...
 
 ~CRY () 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...
 
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...
 
int matrix_size
 The size N of the NxN matrix associated with the operations. 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 representing a CRY gate.

Definition at line 37 of file CRY.h.

Constructor & Destructor Documentation

◆ CRY() [1/2]

CRY::CRY ( )

Nullary constructor of the class.

Definition at line 31 of file CRY.cpp.

Here is the caller graph for this function:

◆ CRY() [2/2]

CRY::CRY ( int  qbit_num_in,
int  target_qbit_in,
int  control_qbit_in 
)

Constructor of the class.

Parameters
qbit_num_inThe number of qubits spanning the gate.
target_qbit_inThe 0<=ID<qbit_num of the target qubit.
qbit_num_inThe number of qubits spanning the gate.
target_qbit_inThe 0<=ID<qbit_num of the target qubit.
theta_inlogical value indicating whether the matrix creation takes an argument theta.
phi_inlogical value indicating whether the matrix creation takes an argument phi
lambda_inlogical value indicating whether the matrix creation takes an argument lambda

Definition at line 51 of file CRY.cpp.

Here is the call graph for this function:

◆ ~CRY()

CRY::~CRY ( )
override

Destructor of the class.

Definition at line 76 of file CRY.cpp.

Member Function Documentation

◆ 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_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:

◆ apply_derivate_to() [1/4]

std::vector< Matrix > Gate::apply_derivate_to ( Matrix_real parameters_mtx_in,
Matrix input,
int  parallel 
)
virtualinherited

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 in Gates_block, and Adaptive.

Definition at line 784 of file Gate.cpp.

Here is the caller graph for this function:

◆ apply_derivate_to() [2/4]

void Gate::apply_derivate_to ( Matrix_real parameters_mtx_in,
Matrix input,
int  parallel,
std::vector< Matrix > &  output 
)
virtualinherited

Reimplemented in Gates_block.

Definition at line 792 of file Gate.cpp.

◆ apply_derivate_to() [3/4]

std::vector< Matrix_float > Gate::apply_derivate_to ( Matrix_real_float parameters_mtx_in,
Matrix_float input,
int  parallel 
)
virtualinherited

Float32 overload for derivative evaluation.

Parameters
parameters_mtx_inFloat32 parameter matrix
inputFloat32 input matrix/state
parallelParallel mode selector

Reimplemented in Gates_block, and Adaptive.

Definition at line 800 of file Gate.cpp.

◆ apply_derivate_to() [4/4]

void Gate::apply_derivate_to ( Matrix_real_float parameters_mtx_in,
Matrix_float input,
int  parallel,
std::vector< Matrix_float > &  output 
)
virtualinherited

Reimplemented in Gates_block.

Definition at line 808 of file Gate.cpp.

◆ 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 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() [2/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() [3/4]

void Gate::apply_from_right ( Matrix_real parameter_mtx,
Matrix input 
)
virtualinherited

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

Apply the gate on input from the right (Matrix_real version)

Parameters
parameter_mtxAn array of the input parameters.
inputThe input array on which the gate is applied
parameter_mtxThe gate parameters.
inputThe input array on which the gate is applied

Reimplemented in Gates_block, and Adaptive.

Definition at line 950 of file Gate.cpp.

◆ apply_from_right() [4/4]

void Gate::apply_from_right ( Matrix_real_float parameter_mtx,
Matrix_float input 
)
virtualinherited

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 in Gates_block, and Adaptive.

Definition at line 964 of file Gate.cpp.

◆ apply_from_right_inner() [1/2]

void Gate::apply_from_right_inner ( Matrix_real parameter_mtx,
const Matrix_real precomputed_sincos,
Matrix input 
)
virtualinherited

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

Reimplemented in Gates_block, and Adaptive.

Definition at line 977 of file Gate.cpp.

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

◆ apply_from_right_inner() [2/2]

void Gate::apply_from_right_inner ( Matrix_real_float parameter_mtx,
const Matrix_real_float precomputed_sincos,
Matrix_float input 
)
virtualinherited

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

Reimplemented in Gates_block, and Adaptive.

Definition at line 997 of file Gate.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 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() [2/6]

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

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 in Gates_block.

Definition at line 468 of file Gate.cpp.

◆ apply_to() [3/6]

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

Abstract function to be overriden in derived classes to be used to transform an input upon a parametric gate operation.

Parameters
parameter_mtxAn array conatining the 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)

Reimplemented in Gates_block, and Adaptive.

Definition at line 501 of file Gate.cpp.

Here is the call graph for this function:

◆ apply_to() [4/6]

void Gate::apply_to ( Matrix_real_float parameter_mtx,
Matrix_float input,
int  parallel 
)
virtualinherited

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 in Gates_block, and Adaptive.

Definition at line 530 of file Gate.cpp.

Here is the call graph for this function:

◆ apply_to() [5/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() [6/6]

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

Precision-agnostic dispatch helper for parametric application.

Parameters
parameter_mtxPrecision-tagged parameter carrier
inputPrecision-tagged matrix carrier
parallelParallel mode selector

Definition at line 611 of file Gate.cpp.

Here is the call graph for this function:

◆ apply_to_combined() [1/4]

std::vector< Matrix > Gate::apply_to_combined ( Matrix_real parameters_mtx_in,
Matrix input,
int  parallel 
)
virtualinherited

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 in Gates_block.

Definition at line 816 of file Gate.cpp.

Here is the caller graph for this function:

◆ apply_to_combined() [2/4]

void Gate::apply_to_combined ( Matrix_real parameters_mtx_in,
Matrix input,
int  parallel,
std::vector< Matrix > &  output 
)
virtualinherited

Reimplemented in Gates_block.

Definition at line 824 of file Gate.cpp.

◆ apply_to_combined() [3/4]

std::vector< Matrix_float > Gate::apply_to_combined ( Matrix_real_float parameters_mtx_in,
Matrix_float input,
int  parallel 
)
virtualinherited

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 in Gates_block.

Definition at line 865 of file Gate.cpp.

◆ apply_to_combined() [4/4]

void Gate::apply_to_combined ( Matrix_real_float parameters_mtx_in,
Matrix_float input,
int  parallel,
std::vector< Matrix_float > &  output 
)
virtualinherited

Reimplemented in Gates_block.

Definition at line 873 of file Gate.cpp.

◆ apply_to_combined_inner() [1/4]

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

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

Reimplemented in Gates_block.

Definition at line 832 of file Gate.cpp.

◆ apply_to_combined_inner() [2/4]

void Gate::apply_to_combined_inner ( Matrix_real parameters_mtx_in,
const Matrix_real precomputed_sincos,
Matrix input,
int  parallel,
std::vector< Matrix > &  output 
)
virtualinherited

Reimplemented in Gates_block.

Definition at line 841 of file Gate.cpp.

Here is the call graph for this function:

◆ apply_to_combined_inner() [3/4]

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

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

Reimplemented in Gates_block.

Definition at line 881 of file Gate.cpp.

◆ apply_to_combined_inner() [4/4]

void Gate::apply_to_combined_inner ( Matrix_real_float parameters_mtx_in,
const Matrix_real_float precomputed_sincos,
Matrix_float input,
int  parallel,
std::vector< Matrix_float > &  output 
)
virtualinherited

Reimplemented in Gates_block.

Definition at line 890 of file Gate.cpp.

Here is the call graph for this function:

◆ apply_to_inner() [1/2]

void Gate::apply_to_inner ( Matrix_real parameter_mtx,
const Matrix_real precomputed_sincos,
Matrix input,
int  parallel 
)
virtualinherited

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

parameter_mtx is preserved for gates with custom parameter handling.

Reimplemented in Gates_block, and Adaptive.

Definition at line 549 of file Gate.cpp.

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

◆ apply_to_inner() [2/2]

void Gate::apply_to_inner ( Matrix_real_float parameter_mtx,
const Matrix_real_float precomputed_sincos,
Matrix_float input,
int  parallel 
)
virtualinherited

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

parameter_mtx is preserved for gates with custom parameter handling.

Reimplemented in Gates_block, and Adaptive.

Definition at line 574 of file Gate.cpp.

Here is the call graph for this function:

◆ apply_to_list() [1/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() [2/4]

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

Abstract function to be overriden in derived classes to be used to transform a list of inputs upon a parametric gate operation.

Parameters
parameter_mtxAn array conatining the parameters of the 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)

Reimplemented in Gates_block.

Definition at line 355 of file Gate.cpp.

Here is the call graph for this function:

◆ apply_to_list() [3/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:

◆ apply_to_list() [4/4]

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

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

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

Reimplemented in Gates_block.

Definition at line 407 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()

CRY * CRY::clone ( )
overridevirtual

Call to create a clone of the present class.

Returns
Return with a pointer pointing to the cloned object

Reimplemented from RY.

Reimplemented in Adaptive.

Definition at line 92 of file CRY.cpp.

Here is the call 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.

◆ 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 RY::derivative_kernel ( const Matrix_real precomputed_sincos,
int  param_idx 
)
overridevirtualinherited

Reimplemented from U3.

Definition at line 55 of file RY.cpp.

◆ derivative_kernel() [2/2]

Matrix_float RY::derivative_kernel ( const Matrix_real_float precomputed_sincos,
int  param_idx 
)
overridevirtualinherited

Reimplemented from U3.

Definition at line 65 of file RY.cpp.

◆ derivative_kernel_to() [1/2]

void RY::derivative_kernel_to ( const Matrix_real precomputed_sincos,
int  param_idx,
Matrix output 
)
overridevirtualinherited

Reimplemented from U3.

Definition at line 91 of file RY.cpp.

◆ derivative_kernel_to() [2/2]

void RY::derivative_kernel_to ( const Matrix_real_float precomputed_sincos,
int  param_idx,
Matrix_float output 
)
overridevirtualinherited

Reimplemented from U3.

Definition at line 99 of file RY.cpp.

◆ extract_parameters() [1/2]

Matrix_real Gate::extract_parameters ( Matrix_real parameters)
virtualinherited

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.

Uses get_parameter_multipliers() to apply fmod wrapping generically. Multiplier m → extracted[i] = fmod(m * params[start+i], m * 2π).

Reimplemented in Gates_block.

Definition at line 2679 of file Gate.cpp.

Here is the call graph for this function:

◆ extract_parameters() [2/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:

◆ gate_kernel() [1/2]

Matrix RY::gate_kernel ( const Matrix_real precomputed_sincos)
overridevirtualinherited

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 from U3.

Definition at line 27 of file RY.cpp.

◆ gate_kernel() [2/2]

Matrix_float RY::gate_kernel ( const Matrix_real_float precomputed_sincos)
overridevirtualinherited

Reimplemented from U3.

Definition at line 34 of file RY.cpp.

◆ gate_kernel_to() [1/2]

void RY::gate_kernel_to ( const Matrix_real precomputed_sincos,
Matrix output 
)
overridevirtualinherited

Reimplemented from U3.

Definition at line 75 of file RY.cpp.

◆ gate_kernel_to() [2/2]

void RY::gate_kernel_to ( const Matrix_real_float precomputed_sincos,
Matrix_float output 
)
overridevirtualinherited

Reimplemented from U3.

Definition at line 79 of file RY.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_involved_qubits()

std::vector< int > Gate::get_involved_qubits ( bool  only_target = false)
virtualinherited

Call to get the qubits involved in the gate operation.

Returns
Return with a list of the involved qubits

Reimplemented in Gates_block.

Definition at line 1219 of file Gate.cpp.

Here is the caller graph for this function:

◆ get_matrix() [1/5]

Matrix Gate::get_matrix ( Matrix_real parameters,
int  parallel 
)
virtualinherited

Call to retrieve the gate matrix.

Parameters
parametersAn array of parameters to calculate the matrix of the U3 gate.
parallelSet 0 for sequential execution, 1 for parallel execution with OpenMP and 2 for parallel with TBB (optional)
Returns
Returns with a matrix of the gate

Reimplemented in Gates_block.

Definition at line 269 of file Gate.cpp.

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

◆ get_matrix() [2/5]

Matrix Gate::get_matrix ( Matrix_real parameters)
virtualinherited

Convenience overload: retrieve the gate matrix (sequential).

Reimplemented in Gates_block.

Definition at line 278 of file Gate.cpp.

◆ get_matrix() [3/5]

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() [4/5]

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_matrix() [5/5]

Matrix_float Gate::get_matrix ( Matrix_real_float parameters,
int  parallel 
)
virtualinherited

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 in Gates_block.

Definition at line 306 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_multipliers()

std::vector< double > RY::get_parameter_multipliers ( ) const
overridevirtualinherited

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 from U3.

Definition at line 23 of file RY.cpp.

◆ get_parameter_num()

int Gate::get_parameter_num ( )
virtualinherited

Call to get the number of free parameters.

Returns
Return with the number of the free parameters

Reimplemented in Gates_block.

Definition at line 1324 of file Gate.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_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:

◆ inverse_gate_kernel() [1/2]

Matrix RY::inverse_gate_kernel ( const Matrix_real precomputed_sincos)
overridevirtualinherited

Reimplemented from U3.

Definition at line 41 of file RY.cpp.

◆ inverse_gate_kernel() [2/2]

Matrix_float RY::inverse_gate_kernel ( const Matrix_real_float precomputed_sincos)
overridevirtualinherited

Reimplemented from U3.

Definition at line 48 of file RY.cpp.

◆ inverse_gate_kernel_to() [1/2]

void RY::inverse_gate_kernel_to ( const Matrix_real precomputed_sincos,
Matrix output 
)
overridevirtualinherited

Reimplemented from U3.

Definition at line 83 of file RY.cpp.

◆ inverse_gate_kernel_to() [2/2]

void RY::inverse_gate_kernel_to ( const Matrix_real_float precomputed_sincos,
Matrix_float output 
)
overridevirtualinherited

Reimplemented from U3.

Definition at line 87 of file RY.cpp.

◆ 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.

◆ reorder_qubits()

void Gate::reorder_qubits ( std::vector< int qbit_list)
virtualinherited

Call to reorder the qubits in the matrix of the operation.

Parameters
qbit_listThe reordered list of qubits spanning the matrix

Reimplemented in Gates_block, and Decomposition_Base.

Definition at line 1151 of file Gate.cpp.

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_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 Gate::set_qbit_num ( int  qbit_num_in)
virtualinherited

Set the number of qubits spanning the matrix of the operation.

Parameters
qbit_num_inThe number of qubits spanning the matrix

Reimplemented in Gates_block, and Decomposition_Base.

Definition at line 244 of file Gate.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.

◆ 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.

◆ 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: