Quantum Gate Decomposer
v1.3
Powerful decomposition of almost any unitary into U3 and CNOT gates
|
A class representing a U3 operation. More...
#include <U3.h>
Public Member Functions | |
Matrix | calc_one_qubit_u3 (double Theta, double Phi, double Lambda) |
Calculate the matrix of a U3 gate operation corresponding to the given parameters acting on a single qbit space. More... | |
U3 * | clone () |
Call to create a clone of the present class. More... | |
QGD_Complex16 * | composite_u3 (double Theta, double Phi, double Lambda) |
Calculate the matrix of a U3 gate operation corresponding corresponding to the given parameters acting on the space of qbit_num qubits. More... | |
int | composite_u3 (double Theta, double Phi, double Lambda, Matrix &U3_matrix) |
Calculate the matrix of a U3 gate operation corresponding corresponding to the given parameters acting on the space of qbit_num qubits. More... | |
int | composite_u3_Lambda (const double *parameters, Matrix &U3_matrix) |
Calculate the matrix of a U3 gate operation corresponding to the given parameters acting on the space of qbit_num qubits. More... | |
int | composite_u3_Phi (const double *parameters, Matrix &U3_matrix) |
Calculate the matrix of a U3 gate operation corresponding to the given parameters acting on the space of qbit_num qubits. More... | |
int | composite_u3_Phi_Lambda (const double *parameters, Matrix &U3_matrix) |
Calculate the matrix of a U3 gate operation corresponding to the given parameters acting on the space of qbit_num qubits. More... | |
int | composite_u3_Theta (const double *parameters, Matrix &U3_matrix) |
Calculate the matrix of a U3 gate operation corresponding to the given parameters acting on the space of qbit_num qubits. More... | |
int | composite_u3_Theta_Lambda (const double *parameters, Matrix &U3_matrix) |
Calculate the matrix of a U3 gate operation corresponding to the given parameters acting on the space of qbit_num qubits. More... | |
int | composite_u3_Theta_Phi (const double *parameters, Matrix &U3_matrix) |
Calculate the matrix of a U3 gate operation corresponding to the given parameters acting on the space of qbit_num qubits. More... | |
int | composite_u3_Theta_Phi_Lambda (const double *parameters, Matrix &U3_matrix) |
Calculate the matrix of a U3 gate operation corresponding to the given parameters acting on the space of qbit_num qubits. More... | |
void | determine_base_indices () |
Determine the base indices corresponding to the target qubit states |0> and |1> More... | |
int | get_control_qbit () |
Call to get the index of the control qubit. More... | |
Matrix | get_matrix (const double *parameters) |
Call to retrieve the operation matrix. More... | |
Matrix | get_matrix () |
Call to retrieve the operation matrix. More... | |
void | get_optimized_parameters (double *parameters_in) |
Call to get the final optimized parameters of the operation. More... | |
unsigned 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... | |
operation_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... | |
void | reorder_qubits (std::vector< int > qbit_list) |
Call to reorder the qubits in the matrix of the operation. 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 operation. More... | |
void | set_qbit_num (int qbit_num_in) |
Call to set the number of qubits spanning the matrix of the operation. More... | |
U3 (int qbit_num_in, int target_qbit_in, bool theta_in, bool phi_in, bool lambda_in) | |
Constructor of the class. More... | |
~U3 () | |
Destructor of the class. More... | |
Protected Attributes | |
int | control_qbit |
The index of the qubit which acts as a control qubit (control_qbit >= 0) in controlled operations. More... | |
int * | indexes_target_qubit_0 |
the base indices of the target qubit for state |0> More... | |
int * | indexes_target_qubit_1 |
the base indices of the target qubit for state |1> More... | |
bool | lambda |
logical value indicating whether the matrix creation takes an argument lambda More... | |
int | matrix_size |
The size N of the NxN matrix associated with the operations. More... | |
unsigned int | parameter_num |
the number of free parameters of the operation More... | |
double * | parameters |
Parameters theta, phi, lambda of the U3 operation after the decomposition of the unitary is done. More... | |
bool | phi |
logical value indicating whether the matrix creation takes an argument phi 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... | |
operation_type | type |
The type of the operation (see enumeration operation_type) More... | |
Constructor of the class.
qbit_num_in | The number of qubits spanning the operation. |
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 36 of file U3.cpp.
U3::~U3 | ( | ) |
Matrix U3::calc_one_qubit_u3 | ( | double | Theta, |
double | Phi, | ||
double | Lambda | ||
) |
Calculate the matrix of a U3 gate operation 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. |
Definition at line 432 of file U3.cpp.
U3 * U3::clone | ( | ) |
QGD_Complex16 * U3::composite_u3 | ( | double | Theta, |
double | Phi, | ||
double | Lambda | ||
) |
Calculate the matrix of a U3 gate operation corresponding corresponding to the given parameters acting on the space of qbit_num qubits.
Theta | 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 265 of file U3.cpp.
int U3::composite_u3 | ( | double | Theta, |
double | Phi, | ||
double | Lambda, | ||
Matrix & | U3_matrix | ||
) |
Calculate the matrix of a U3 gate operation corresponding corresponding to the given parameters acting on the space of qbit_num qubits.
Theta | Real parameter standing for the parameter theta. |
Phi | Real parameter standing for the parameter phi. |
Lambda | Real parameter standing for the parameter lambda. |
U3_matrix | A pointer to the preallocated array of the operation matrix. |
Definition at line 285 of file U3.cpp.
int U3::composite_u3_Lambda | ( | const double * | parameters, |
Matrix & | U3_matrix | ||
) |
Calculate the matrix of a U3 gate operation corresponding to the given parameters acting on the space of qbit_num qubits.
parameters | An array containing the parameters of the U3 operation. |
U3_matrix | A pointer to the preallocated array of the operation matrix. |
Definition at line 234 of file U3.cpp.
int U3::composite_u3_Phi | ( | const double * | parameters, |
Matrix & | U3_matrix | ||
) |
Calculate the matrix of a U3 gate operation corresponding to the given parameters acting on the space of qbit_num qubits.
parameters | An array containing the parameters of the U3 operation. |
U3_matrix | A pointer to the preallocated array of the operation matrix. |
Definition at line 244 of file U3.cpp.
int U3::composite_u3_Phi_Lambda | ( | const double * | parameters, |
Matrix & | U3_matrix | ||
) |
Calculate the matrix of a U3 gate operation corresponding to the given parameters acting on the space of qbit_num qubits.
parameters | An array containing the parameters of the U3 operation. |
U3_matrix | A pointer to the preallocated array of the operation matrix. |
Definition at line 204 of file U3.cpp.
int U3::composite_u3_Theta | ( | const double * | parameters, |
Matrix & | U3_matrix | ||
) |
Calculate the matrix of a U3 gate operation corresponding to the given parameters acting on the space of qbit_num qubits.
parameters | An array containing the parameters of the U3 operation. |
U3_matrix | A pointer to the preallocated array of the operation matrix. |
Definition at line 254 of file U3.cpp.
int U3::composite_u3_Theta_Lambda | ( | const double * | parameters, |
Matrix & | U3_matrix | ||
) |
Calculate the matrix of a U3 gate operation corresponding to the given parameters acting on the space of qbit_num qubits.
parameters | An array containing the parameters of the U3 operation. |
U3_matrix | A pointer to the preallocated array of the operation matrix. |
Definition at line 214 of file U3.cpp.
int U3::composite_u3_Theta_Phi | ( | const double * | parameters, |
Matrix & | U3_matrix | ||
) |
Calculate the matrix of a U3 gate operation corresponding to the given parameters acting on the space of qbit_num qubits.
parameters | An array containing the parameters of the U3 operation. |
U3_matrix | A pointer to the preallocated array of the operation matrix. |
Definition at line 224 of file U3.cpp.
int U3::composite_u3_Theta_Phi_Lambda | ( | const double * | parameters, |
Matrix & | U3_matrix | ||
) |
Calculate the matrix of a U3 gate operation corresponding to the given parameters acting on the space of qbit_num qubits.
parameters | An array containing the parameters of the U3 operation. |
U3_matrix | A pointer to the preallocated array of the operation matrix. |
Definition at line 194 of file U3.cpp.
void U3::determine_base_indices | ( | ) |
|
inherited |
Call to get the index of the control qubit.
Definition at line 157 of file Operation.cpp.
Matrix U3::get_matrix | ( | const double * | parameters | ) |
|
inherited |
Call to retrieve the operation matrix.
Definition at line 97 of file Operation.cpp.
void U3::get_optimized_parameters | ( | double * | parameters_in | ) |
|
inherited |
Call to get the number of free parameters.
Definition at line 165 of file Operation.cpp.
|
inherited |
Call to get the number of qubits composing the unitary.
Definition at line 183 of file Operation.cpp.
|
inherited |
Call to get the index of the target qubit.
Definition at line 149 of file Operation.cpp.
|
inherited |
Call to get the type of the operation.
Definition at line 174 of file Operation.cpp.
bool U3::is_lambda_parameter | ( | ) |
bool U3::is_phi_parameter | ( | ) |
bool U3::is_theta_parameter | ( | ) |
|
virtual |
|
inherited |
Call to set the stored matrix in the operation.
input | The operation matrix to be stored. The matrix is stored by attribute matrix_alloc. |
Definition at line 109 of file Operation.cpp.
void U3::set_optimized_parameters | ( | double | Theta, |
double | Phi, | ||
double | Lambda | ||
) |
Call to set the final optimized parameters of the operation.
Theta | 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 483 of file U3.cpp.
|
virtual |
|
protectedinherited |
The index of the qubit which acts as a control qubit (control_qbit >= 0) in controlled operations.
Definition at line 52 of file Operation.h.
|
protected |
|
protected |
|
protected |
|
protectedinherited |
The size N of the NxN matrix associated with the operations.
Definition at line 54 of file Operation.h.
|
protectedinherited |
the number of free parameters of the operation
Definition at line 56 of file Operation.h.
|
protected |
|
protected |
|
protectedinherited |
number of qubits spanning the matrix of the operation
Definition at line 46 of file Operation.h.
|
protectedinherited |
The index of the qubit on which the operation acts (target_qbit >= 0)
Definition at line 50 of file Operation.h.
|
protected |
|
protectedinherited |
The type of the operation (see enumeration operation_type)
Definition at line 48 of file Operation.h.