31 return phi_transformed;
36 phi_transformed[0] =
static_cast<float>(
activation_function(static_cast<double>(parameters[0]), limit));
37 return phi_transformed;
70 Adaptive::Adaptive(
int qbit_num_in,
int target_qbit_in,
int control_qbit_in) :
CRY(qbit_num_in, target_qbit_in, control_qbit_in) {
90 Adaptive::Adaptive(
int qbit_num_in,
int target_qbit_in,
int control_qbit_in,
int limit_in) :
CRY(qbit_num_in, target_qbit_in, control_qbit_in) {
123 std::string err(
"Adaptive::apply_to: Wrong input size in Adaptive gate apply.");
127 Matrix_real phi_transformed = transform_adaptive_parameter(parameters,
limit);
140 std::string err(
"Adaptive::apply_to: Wrong input size in Adaptive gate apply.");
153 Matrix_real phi_transformed = transform_adaptive_parameter(parameters,
limit);
179 std::stringstream sstream;
180 sstream <<
"Wrong matrix size in Adaptive apply_from_right" << std::endl;
185 Matrix_real phi_transformed = transform_adaptive_parameter(parameters,
limit);
197 std::string err(
"Wrong matrix size in Adaptive apply_from_right");
210 Matrix_real phi_transformed = transform_adaptive_parameter(parameters,
limit);
236 std::stringstream sstream;
237 sstream <<
"Wrong matrix size in Adaptive gate apply" << std::endl;
242 Matrix_real Phi_transformed = transform_adaptive_parameter(parameters,
limit);
259 std::vector<Matrix_float>
263 std::stringstream sstream;
264 sstream <<
"Wrong matrix size in Adaptive gate apply" << std::endl;
std::vector< Gate * > parents
list of parent gates to be applied in the circuit prior to this current gate
Matrix_real compute_precomputed_sincos(const Matrix_real ¶meters) const
Public wrapper to precompute gate-local sin/cos pairs.
void print(const std::stringstream &sstream, int verbose_level=1) const
Call to print output messages in the function of the verbosity level.
Class to store single-precision real arrays and properties.
void set_limit(int limit_in)
???????????
int control_qbit
The index of the qubit which acts as a control qubit (control_qbit >= 0) in controlled operations...
virtual std::vector< Matrix > apply_derivate_to(Matrix_real ¶meters_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...
void set_children(std::vector< Gate *> &children_)
Call to set the children of the current gate.
Adaptive * clone() override
Call to create a clone of the present class.
int target_qbit
The index of the qubit on which the operation acts (target_qbit >= 0)
void apply_from_right(Matrix_real ¶meters, Matrix &input) override
Call to apply the gate on the input array/matrix by input*U3.
int matrix_size
The size N of the NxN matrix associated with the operations.
virtual void apply_from_right_inner(Matrix_real ¶meter_mtx, const Matrix_real &precomputed_sincos, Matrix &input)
Internal right-apply entry that consumes already precomputed sin/cos values.
virtual void apply_to_inner(Matrix_real ¶meter_mtx, const Matrix_real &precomputed_sincos, Matrix &input, int parallel)
Internal apply entry that consumes already precomputed sin/cos values.
void apply_to_inner(Matrix_real ¶meters, const Matrix_real &precomputed_sincos, Matrix &input, int parallel) override
Internal apply entry that consumes already precomputed sin/cos values.
gate_type type
The type of the operation (see enumeration gate_type)
A class representing a CRY gate.
int rows
The number of rows.
int cols
The number of columns.
void set_parameter_start_idx(int start_idx)
Call to set the starting index of the parameters in the parameter array corresponding to the circuit ...
int get_parameter_start_idx()
Call to get the starting index of the parameters in the parameter array corresponding to the circuit ...
std::vector< Matrix > apply_derivate_to(Matrix_real ¶meters, Matrix &input, int parallel) override
Call to evaluate the derivate of the circuit on an inout with respect to all of the free parameters...
~Adaptive()
Destructor of the class.
Double-precision complex matrix (float64).
Header file for a class representing a gate used in adaptive decomposition.
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
void apply_from_right_inner(Matrix_real ¶meters, const Matrix_real &precomputed_sincos, Matrix &input) override
Internal right-apply entry that consumes already precomputed sin/cos values.
int get_limit()
???????????
Header file for commonly used functions and wrappers to CBLAS functions.
void set_parents(std::vector< Gate *> &parents_)
Call to set the parents of the current gate.
double activation_function(double Phi, int limit)
?????
A class representing a CRY gate.
int qbit_num
number of qubits spanning the matrix of the operation
virtual void apply_to(Matrix_real ¶meters, Matrix &input, int parallel) override
Call to apply the gate on the input array/matrix.
Class to store data of complex arrays and its properties.
Adaptive()
Nullary constructor of the class.