6 RY::RY(
int qbit_num_in,
int target_qbit_in) :
U3(qbit_num_in, target_qbit_in) {
28 const int theta_offset = 0 * precomputed_sincos.
stride;
29 const double s_theta = precomputed_sincos[theta_offset + 0];
30 const double c_theta = precomputed_sincos[theta_offset + 1];
31 return ry_gate_kernel_from_trig<Matrix, double>(s_theta, c_theta);
35 const int theta_offset = 0 * precomputed_sincos.
stride;
36 const float s_theta = precomputed_sincos[theta_offset + 0];
37 const float c_theta = precomputed_sincos[theta_offset + 1];
38 return ry_gate_kernel_from_trig<Matrix_float, float>(s_theta, c_theta);
42 const int theta_offset = 0 * precomputed_sincos.
stride;
43 const double s_theta = precomputed_sincos[theta_offset + 0];
44 const double c_theta = precomputed_sincos[theta_offset + 1];
45 return ry_inverse_gate_kernel_from_trig<Matrix, double>(s_theta, c_theta);
49 const int theta_offset = 0 * precomputed_sincos.
stride;
50 const float s_theta = precomputed_sincos[theta_offset + 0];
51 const float c_theta = precomputed_sincos[theta_offset + 1];
52 return ry_inverse_gate_kernel_from_trig<Matrix_float, float>(s_theta, c_theta);
59 const int theta_offset = 0 * precomputed_sincos.
stride;
60 const double s_theta = precomputed_sincos[theta_offset + 0];
61 const double c_theta = precomputed_sincos[theta_offset + 1];
62 return ry_derivative_kernel_from_trig<Matrix, double>(s_theta, c_theta);
69 const int theta_offset = 0 * precomputed_sincos.
stride;
70 const float s_theta = precomputed_sincos[theta_offset + 0];
71 const float c_theta = precomputed_sincos[theta_offset + 1];
72 return ry_derivative_kernel_from_trig<Matrix_float, float>(s_theta, c_theta);
76 ry_gate_kernel_from_trig_to<Matrix, double>(
output, precomputed_sincos[0], precomputed_sincos[1]);
80 ry_gate_kernel_from_trig_to<Matrix_float, float>(
output, precomputed_sincos[0], precomputed_sincos[1]);
84 ry_inverse_gate_kernel_from_trig_to<Matrix, double>(
output, precomputed_sincos[0], precomputed_sincos[1]);
88 ry_inverse_gate_kernel_from_trig_to<Matrix_float, float>(
output, precomputed_sincos[0], precomputed_sincos[1]);
96 ry_derivative_kernel_from_trig_to<Matrix, double>(
output, precomputed_sincos[0], precomputed_sincos[1]);
100 if (param_idx != 0) {
104 ry_derivative_kernel_from_trig_to<Matrix_float, float>(
output, precomputed_sincos[0], precomputed_sincos[1]);
std::vector< Gate * > parents
list of parent gates to be applied in the circuit prior to this current gate
Copyright (C) Miklos Maroti, 2021 SPDX-License-Identifier: Apache-2.0.
Class to store single-precision real arrays and properties.
virtual void derivative_kernel_to(const Matrix_real &precomputed_sincos, int param_idx, Matrix &output) override
int control_qbit
The index of the qubit which acts as a control qubit (control_qbit >= 0) in controlled operations...
int stride
The column stride of the array. (The array elements in one row are a_0, a_1, ... a_{cols-1}, 0, 0, 0, 0. The number of zeros is stride-cols)
void set_children(std::vector< Gate *> &children_)
Call to set the children of the current gate.
int target_qbit
The index of the qubit on which the operation acts (target_qbit >= 0)
virtual std::vector< double > get_parameter_multipliers() const override
Returns the per-parameter multipliers relative to 2Ï used by extract_parameters. ...
virtual void inverse_gate_kernel_to(const Matrix_real &precomputed_sincos, Matrix &output) override
virtual void gate_kernel_to(const Matrix_real &precomputed_sincos, Matrix &output) override
virtual Matrix derivative_kernel(const Matrix_real &precomputed_sincos, int param_idx) override
gate_type type
The type of the operation (see enumeration gate_type)
virtual Matrix gate_kernel(const Matrix_real &precomputed_sincos) override
Compute the gate kernel matrix from precomputed trigonometric values.
void set_parameter_start_idx(int start_idx)
Call to set the starting index of the parameters in the parameter array corresponding to the circuit ...
int get_parameter_start_idx()
Call to get the starting index of the parameters in the parameter array corresponding to the circuit ...
Double-precision complex matrix (float64).
std::string name
A string labeling the gate operation.
Single-precision complex matrix (float32).
std::vector< Gate * > children
list of child gates to be applied after this current gate
int parameter_num
the number of free parameters of the operation
virtual RY * clone() override
Call to create a clone of the present class.
virtual Matrix inverse_gate_kernel(const Matrix_real &precomputed_sincos) override
void set_parents(std::vector< Gate *> &parents_)
Call to set the parents of the current gate.
int qbit_num
number of qubits spanning the matrix of the operation
Class to store data of complex arrays and its properties.