Sequential Quantum Gate Decomposer
v1.8.8
Powerful decomposition of general unitarias into one- and two-qubit gates gates
|
A class representing a U3 gate. More...
#include <U3.h>
Public Member Functions | |
virtual std::vector< Matrix > | apply_derivate_to (Matrix_real ¶meters, Matrix &input) |
Call to evaluate the derivate of the circuit on an inout with respect to all of the free parameters. 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_real ¶meters, Matrix &input) |
Call to apply the gate on the input array/matrix by input*U3. More... | |
virtual void | apply_to (Matrix &input, bool parallel=false) |
Call to apply the gate on the input array/matrix. More... | |
virtual void | apply_to (Matrix_real ¶meters, Matrix &input, bool parallel=false) |
Call to apply the gate on the input array/matrix by U3*input. More... | |
void | apply_to_list (std::vector< Matrix > &input) |
Call to apply the gate on the input array/matrix by U3*input. More... | |
void | apply_to_list (Matrix_real ¶meters, std::vector< Matrix > &input) |
Call to apply the gate on the input array/matrix by U3*input. More... | |
Matrix | calc_one_qubit_u3 (double Theta, double Phi, double Lambda) |
Calculate the matrix of a U3 gate gate corresponding to the given parameters acting on a single qbit space. More... | |
virtual Matrix | calc_one_qubit_u3 () |
Calculate the matrix of the constans gates. More... | |
virtual U3 * | clone () |
Call to create a clone of the present class. More... | |
int | get_control_qbit () |
Call to get the index of the control qubit. More... | |
Matrix | get_matrix (Matrix_real ¶meters) |
Call to retrieve the gate matrix. More... | |
Matrix | get_matrix () |
Call to retrieve the operation matrix. More... | |
Matrix | get_matrix (Matrix_real ¶meters, bool parallel) |
Call to retrieve the gate matrix. More... | |
Matrix_real | get_optimized_parameters () |
Call to get the final optimized parameters of the gate. More... | |
int | get_parameter_num () |
Call to get the number of free parameters. 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... | |
gate_type | get_type () |
Call to get the type of the operation. More... | |
bool | is_lambda_parameter () |
Call to check whether Lambda is a free parameter of the gate. More... | |
bool | is_phi_parameter () |
Call to check whether Phi is a free parameter of the gate. More... | |
bool | is_theta_parameter () |
Call to check whether theta is a free parameter of the gate. More... | |
virtual void | parameters_for_calc_one_qubit (double &ThetaOver2, double &Phi, double &Lambda) |
Calculate the matrix of a U3 gate gate corresponding to the given parameters acting on a single qbit space. 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... | |
virtual void | reorder_qubits (std::vector< int > qbit_list) |
Call to reorder the qubits in the matrix of the gate. More... | |
void | set_control_qbit (int control_qbit_in) |
Call to set the control qubit for the gate operation. More... | |
void | set_debugfile (std::string debugfile) |
Call to set the debugfile name. More... | |
void | set_lambda (double lambda_in) |
Call to set the parameter lambda0. More... | |
void | set_matrix (Matrix input) |
Call to set the stored matrix in the operation. More... | |
void | set_optimized_parameters (double Theta, double Phi, double Lambda) |
Call to set the final optimized parameters of the gate. More... | |
void | set_phi (double phi_in) |
Call to set the parameter phi0. More... | |
virtual void | set_qbit_num (int qbit_num_in) |
Call to set the number of qubits spanning the matrix of the gate. More... | |
void | set_target_qbit (int target_qbit_in) |
Call to set the target qubit for the gate operation. More... | |
void | set_theta (double theta_in) |
Call to set the parameter theta0. More... | |
void | set_verbose (int verbose_in) |
Call to set the verbose attribute. More... | |
U3 () | |
Nullary constructor of the class. More... | |
U3 (int qbit_num_in, int target_qbit_in, bool theta_in, bool phi_in, bool lambda_in) | |
Constructor of the class. More... | |
virtual | ~U3 () |
Destructor of the class. More... | |
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 | |
void | apply_kernel_from_right (Matrix &u3_1qbit, Matrix &input) |
Call to apply the gate kernel on the input state or unitary from right (no AVX support) More... | |
void | apply_kernel_to (Matrix &u3_1qbit, Matrix &input, bool deriv=false, bool parallel=false) |
Call to apply the gate kernel on the input state or unitary with optional AVX support. More... | |
Protected Attributes | |
int | control_qbit |
The index of the qubit which acts as a control qubit (control_qbit >= 0) in controlled operations. More... | |
bool | lambda |
logical value indicating whether the matrix creation takes an argument lambda More... | |
double | lambda0 |
value applied for lambda if it is not varied during the gate decomposition More... | |
int | matrix_size |
The size N of the NxN matrix associated with the operations. More... | |
int | parameter_num |
the number of free parameters of the operation More... | |
Matrix_real | parameters |
Parameters theta, phi, lambda of the U3 gate after the decomposition of the unitary is done. More... | |
bool | phi |
logical value indicating whether the matrix creation takes an argument phi More... | |
double | phi0 |
value applied for phi if it is not varied during the gate decomposition 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... | |
bool | theta |
logical value indicating whether the matrix creation takes an argument theta More... | |
double | theta0 |
value applied for theta if it is not varied during the gate decomposition More... | |
gate_type | type |
The type of the operation (see enumeration gate_type) More... | |
U3::U3 | ( | ) |
Constructor of the class.
qbit_num_in | The number of qubits spanning the gate. |
target_qbit_in | The 0<=ID<qbit_num of the target qubit. |
theta_in | logical value indicating whether the matrix creation takes an argument theta. |
phi_in | logical value indicating whether the matrix creation takes an argument phi |
lambda_in | logical value indicating whether the matrix creation takes an argument lambda |
Definition at line 70 of file U3.cpp.
|
virtual |
Call to evaluate the derivate of the circuit on an inout with respect to all of the free parameters.
parameters | An array of the input parameters. |
input | The input array on which the gate is applied |
Reimplemented in RY, Adaptive, CRY, RX, RZ, and RZ_P.
Definition at line 368 of file U3.cpp.
|
virtualinherited |
Call to apply the gate on the input array/matrix by input*Gate.
input | The input array on which the gate is applied |
Reimplemented in SX, X, Y, Z, SYC, CH, CNOT, and CZ.
Definition at line 156 of file Gate.cpp.
|
virtual |
Call to apply the gate on the input array/matrix by input*U3.
parameters | An array of parameters to calculate the matrix of the U3 gate. |
input | The input array on which the gate is applied |
Reimplemented in Adaptive, RY, CRY, RX, RZ, RZ_P, and custom_kernel_1qubit_gate.
Definition at line 291 of file U3.cpp.
Call to apply the gate kernel on the input state or unitary from right (no AVX support)
u3_1qbit | The 2x2 kernel of the gate operation |
input | The input matrix on which the transformation is applied |
deriv | Set true to apply derivate transformation, false otherwise |
Definition at line 359 of file Gate.cpp.
|
protectedinherited |
Call to apply the gate kernel on the input state or unitary with optional AVX support.
u3_1qbit | The 2x2 kernel of the gate operation |
input | The input matrix on which the transformation is applied |
deriv | Set true to apply derivate transformation, false otherwise (optional) |
parallel | Set true to apply parallel kernels, false otherwise (optional) |
u3_1qbit | The 2x2 kernel of the gate operation |
input | The input matrix on which the transformation is applied |
deriv | Set true to apply derivate transformation, false otherwise (optional) |
deriv | Set true to apply parallel kernels, false otherwise (optional) |
Definition at line 292 of file Gate.cpp.
Call to apply the gate on the input array/matrix.
input | The input array on which the gate is applied |
parallel | Set true to apply parallel kernels, false otherwise (optional) |
Reimplemented in SX, X, Y, Z, CH, CZ, SYC, and CNOT.
Definition at line 143 of file Gate.cpp.
|
virtual |
Call to apply the gate on the input array/matrix by U3*input.
parameters | An array of parameters to calculate the matrix of the U3 gate. |
input | The input array on which the gate is applied |
parallel | Set true to apply parallel kernels, false otherwise (optional) |
Reimplemented in Adaptive, RY, CRY, RX, RZ, and RZ_P.
Definition at line 207 of file U3.cpp.
|
inherited |
Call to apply the gate on the input array/matrix by U3*input.
parameters | An array of parameters to calculate the matrix of the U3 gate. |
input | The input array on which the gate is applied |
Definition at line 127 of file Gate.cpp.
void U3::apply_to_list | ( | Matrix_real & | parameters_mtx, |
std::vector< Matrix > & | input | ||
) |
Call to apply the gate on the input array/matrix by U3*input.
parameters | An array of parameters to calculate the matrix of the U3 gate. |
input | The input array on which the gate is applied |
Definition at line 189 of file U3.cpp.
|
inherited |
Calculate the matrix of a U3 gate gate corresponding to the given parameters acting on a single qbit space.
Theta | Real parameter standing for the parameter theta. |
Phi | Real parameter standing for the parameter phi. |
Lambda | Real parameter standing for the parameter lambda. |
ThetaOver2 | Real parameter standing for the parameter theta. |
Phi | Real parameter standing for the parameter phi. |
Lambda | Real parameter standing for the parameter lambda. |
Definition at line 439 of file Gate.cpp.
|
virtualinherited |
|
virtual |
Call to create a clone of the present class.
Reimplemented from Gate.
Reimplemented in Adaptive, RY, RX, RZ, RZ_P, CRY, SX, X, Y, Z, and custom_kernel_1qubit_gate.
Definition at line 530 of file U3.cpp.
|
inherited |
Matrix U3::get_matrix | ( | Matrix_real & | parameters | ) |
|
inherited |
Matrix U3::get_matrix | ( | Matrix_real & | parameters, |
bool | parallel | ||
) |
Call to retrieve the gate matrix.
parameters | An array of parameters to calculate the matrix of the U3 gate. |
parallel | Set true to apply parallel kernels, false otherwise |
parameters | An array of parameters to calculate the matrix of the U3 gate. |
Definition at line 165 of file U3.cpp.
Matrix_real U3::get_optimized_parameters | ( | ) |
Call to get the final optimized parameters of the gate.
parameters_in | Preallocated pointer to store the parameters Theta, Phi and Lambda of the U3 gate. |
parameters_in | Preallocated pointer to store the parameters ThetaOver2, Phi and Lambda of the U3 gate. |
Definition at line 566 of file U3.cpp.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
bool U3::is_lambda_parameter | ( | ) |
bool U3::is_phi_parameter | ( | ) |
bool U3::is_theta_parameter | ( | ) |
|
virtualinherited |
Calculate the matrix of a U3 gate gate corresponding to the given parameters acting on a single qbit space.
Set static values for the angles and constans parameters for calculating the matrix of the gates.
Theta | Real parameter standing for the parameter theta. |
Phi | Real parameter standing for the parameter phi. |
Lambda | Real parameter standing for the parameter lambda. |
ThetaOver2 | Real parameter standing for the parameter theta. |
Phi | Real parameter standing for the parameter phi. |
Lambda | Real parameter standing for the parameter lambda. |
|
inherited |
Call to print output messages in the function of the verbosity level.
sstream | The stringstream input to store the output messages. |
verbose_level | Integer 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.
|
virtual |
Call to reorder the qubits in the matrix of the gate.
qbit_list | The reordered list of qubits spanning the matrix |
Reimplemented from Gate.
Reimplemented in SX, X, Y, and Z.
Definition at line 491 of file U3.cpp.
|
inherited |
|
inherited |
Call to set the debugfile name.
debugfile | String variable. Set the debugfile name. |
Definition at line 95 of file logging.cpp.
void U3::set_lambda | ( | double | lambda_in | ) |
|
inherited |
void U3::set_optimized_parameters | ( | double | ThetaOver2, |
double | Phi, | ||
double | Lambda | ||
) |
Call to set the final optimized parameters of the gate.
Theta | Real parameter standing for the parameter theta. |
Phi | Real parameter standing for the parameter phi. |
Lambda | Real parameter standing for the parameter lambda. |
ThetaOver2 | Real parameter standing for the parameter theta. |
Phi | Real parameter standing for the parameter phi. |
Lambda | Real parameter standing for the parameter lambda. |
Definition at line 551 of file U3.cpp.
void U3::set_phi | ( | double | phi_in | ) |
|
virtual |
|
inherited |
void U3::set_theta | ( | double | theta_in | ) |
|
inherited |
Call to set the verbose attribute.
verbose_in | Integer variable. Set the number to specify the verbosity level for output messages. |
Definition at line 85 of file logging.cpp.
|
protectedinherited |
|
inherited |
|
inherited |
|
protected |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protected |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protected |
|
protectedinherited |
|
inherited |