Quantum Gate Decomposer  v1.3
Powerful decomposition of almost any unitary into U3 and CNOT gates
List of all members | Public Member Functions | Protected Attributes
U3 Class Reference

A class representing a U3 operation. More...

#include <U3.h>

Inheritance diagram for U3:
Inheritance graph
[legend]

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...
 
U3clone ()
 Call to create a clone of the present class. More...
 
QGD_Complex16composite_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...
 

Detailed Description

A class representing a U3 operation.

Definition at line 35 of file U3.h.

Constructor & Destructor Documentation

◆ U3()

U3::U3 ( int  qbit_num_in,
int  target_qbit_in,
bool  theta_in,
bool  phi_in,
bool  lambda_in 
)

Constructor of the class.

Parameters
qbit_num_inThe number of qubits spanning the operation.
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 36 of file U3.cpp.

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

◆ ~U3()

U3::~U3 ( )

Destructor of the class.

Definition at line 112 of file U3.cpp.

Here is the call graph for this function:

Member Function Documentation

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

Parameters
ThetaReal parameter standing for the parameter theta.
PhiReal parameter standing for the parameter phi.
LambdaReal parameter standing for the parameter lambda.
Returns
Returns with the matrix of the one-qubit matrix.

Definition at line 432 of file U3.cpp.

Here is the caller graph for this function:

◆ clone()

U3 * U3::clone ( )

Call to create a clone of the present class.

Returns
Return with a pointer pointing to the cloned object

Definition at line 462 of file U3.cpp.

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

◆ composite_u3() [1/2]

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.

Parameters
ThetaReal parameter standing for the parameter theta.
PhiReal parameter standing for the parameter phi.
LambdaReal parameter standing for the parameter lambda.
Returns
Returns with the matrix of the U3 gate.

Definition at line 265 of file U3.cpp.

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

◆ composite_u3() [2/2]

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.

Parameters
ThetaReal parameter standing for the parameter theta.
PhiReal parameter standing for the parameter phi.
LambdaReal parameter standing for the parameter lambda.
U3_matrixA pointer to the preallocated array of the operation matrix.
Returns
Returns with 0 on success.

Definition at line 285 of file U3.cpp.

Here is the call graph for this function:

◆ composite_u3_Lambda()

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
parametersAn array containing the parameters of the U3 operation.
U3_matrixA pointer to the preallocated array of the operation matrix.
Returns
Returns with 0 on success.

Definition at line 234 of file U3.cpp.

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

◆ composite_u3_Phi()

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
parametersAn array containing the parameters of the U3 operation.
U3_matrixA pointer to the preallocated array of the operation matrix.
Returns
Returns with 0 on success.

Definition at line 244 of file U3.cpp.

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

◆ composite_u3_Phi_Lambda()

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
parametersAn array containing the parameters of the U3 operation.
U3_matrixA pointer to the preallocated array of the operation matrix.
Returns
Returns with 0 on success.

Definition at line 204 of file U3.cpp.

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

◆ composite_u3_Theta()

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
parametersAn array containing the parameters of the U3 operation.
U3_matrixA pointer to the preallocated array of the operation matrix.
Returns
Returns with 0 on success.

Definition at line 254 of file U3.cpp.

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

◆ composite_u3_Theta_Lambda()

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
parametersAn array containing the parameters of the U3 operation.
U3_matrixA pointer to the preallocated array of the operation matrix.
Returns
Returns with 0 on success.

Definition at line 214 of file U3.cpp.

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

◆ composite_u3_Theta_Phi()

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
parametersAn array containing the parameters of the U3 operation.
U3_matrixA pointer to the preallocated array of the operation matrix.
Returns
Returns with 0 on success.

Definition at line 224 of file U3.cpp.

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

◆ composite_u3_Theta_Phi_Lambda()

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
parametersAn array containing the parameters of the U3 operation.
U3_matrixA pointer to the preallocated array of the operation matrix.
Returns
Returns with 0 on success.

Definition at line 194 of file U3.cpp.

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

◆ determine_base_indices()

void U3::determine_base_indices ( )

Determine the base indices corresponding to the target qubit states |0> and |1>

Definition at line 326 of file U3.cpp.

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

◆ get_control_qbit()

int Operation::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 157 of file Operation.cpp.

Here is the caller graph for this function:

◆ get_matrix() [1/2]

Matrix U3::get_matrix ( const double *  parameters)

Call to retrieve the operation matrix.

Parameters
parametersAn array of parameters to calculate the matrix of the U3 operation.
Returns
Returns with a matrix of the operation

Definition at line 138 of file U3.cpp.

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

◆ get_matrix() [2/2]

Matrix Operation::get_matrix ( )
inherited

Call to retrieve the operation matrix.

Returns
Returns with a matrix of the operation

Definition at line 97 of file Operation.cpp.

Here is the caller graph for this function:

◆ get_optimized_parameters()

void U3::get_optimized_parameters ( double *  parameters_in)

Call to get the final optimized parameters of the operation.

Parameters
parameters_inPreallocated pointer to store the parameters Theta, Phi and Lambda of the U3 operation.

Definition at line 502 of file U3.cpp.

Here is the caller graph for this function:

◆ get_parameter_num()

unsigned int Operation::get_parameter_num ( )
inherited

Call to get the number of free parameters.

Returns
Return with the number of the free parameters

Definition at line 165 of file Operation.cpp.

Here is the caller graph for this function:

◆ get_qbit_num()

int Operation::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 183 of file Operation.cpp.

◆ get_target_qbit()

int Operation::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 149 of file Operation.cpp.

Here is the caller graph for this function:

◆ get_type()

operation_type Operation::get_type ( )
inherited

Call to get the type of the operation.

Returns
Return with the type of the operation (see operation_type for details)

Definition at line 174 of file Operation.cpp.

Here is the caller graph for this function:

◆ is_lambda_parameter()

bool U3::is_lambda_parameter ( )

Call to check whether Lambda is a free parameter of the gate.

Returns
Returns with true if Lambda is a free parameter of the gate, or false otherwise.

Definition at line 419 of file U3.cpp.

Here is the caller graph for this function:

◆ is_phi_parameter()

bool U3::is_phi_parameter ( )

Call to check whether Phi is a free parameter of the gate.

Returns
Returns with true if Phi is a free parameter of the gate, or false otherwise.

Definition at line 411 of file U3.cpp.

Here is the caller graph for this function:

◆ is_theta_parameter()

bool U3::is_theta_parameter ( )

Call to check whether theta is a free parameter of the gate.

Returns
Returns with true if theta is a free parameter of the gate, or false otherwise.

Definition at line 402 of file U3.cpp.

Here is the caller graph for this function:

◆ reorder_qubits()

void U3::reorder_qubits ( std::vector< int >  qbit_list)
virtual

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

Parameters
qbit_listThe reordered list of qubits spanning the matrix

Reimplemented from Operation.

Definition at line 387 of file U3.cpp.

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

◆ set_matrix()

void Operation::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 109 of file Operation.cpp.

Here is the caller graph for this function:

◆ set_optimized_parameters()

void U3::set_optimized_parameters ( double  Theta,
double  Phi,
double  Lambda 
)

Call to set the final optimized parameters of the operation.

Parameters
ThetaReal parameter standing for the parameter theta.
PhiReal parameter standing for the parameter phi.
LambdaReal parameter standing for the parameter lambda.

Definition at line 483 of file U3.cpp.

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

◆ set_qbit_num()

void U3::set_qbit_num ( int  qbit_num_in)
virtual

Call to set the number of qubits spanning the matrix of the operation.

Parameters
qbit_num_inThe number of qubits

Reimplemented from Operation.

Definition at line 372 of file U3.cpp.

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

Member Data Documentation

◆ control_qbit

int Operation::control_qbit
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.

◆ indexes_target_qubit_0

int* U3::indexes_target_qubit_0
protected

the base indices of the target qubit for state |0>

Definition at line 40 of file U3.h.

◆ indexes_target_qubit_1

int* U3::indexes_target_qubit_1
protected

the base indices of the target qubit for state |1>

Definition at line 42 of file U3.h.

◆ lambda

bool U3::lambda
protected

logical value indicating whether the matrix creation takes an argument lambda

Definition at line 48 of file U3.h.

◆ matrix_size

int Operation::matrix_size
protectedinherited

The size N of the NxN matrix associated with the operations.

Definition at line 54 of file Operation.h.

◆ parameter_num

unsigned int Operation::parameter_num
protectedinherited

the number of free parameters of the operation

Definition at line 56 of file Operation.h.

◆ parameters

double* U3::parameters
protected

Parameters theta, phi, lambda of the U3 operation after the decomposition of the unitary is done.

Definition at line 50 of file U3.h.

◆ phi

bool U3::phi
protected

logical value indicating whether the matrix creation takes an argument phi

Definition at line 46 of file U3.h.

◆ qbit_num

int Operation::qbit_num
protectedinherited

number of qubits spanning the matrix of the operation

Definition at line 46 of file Operation.h.

◆ target_qbit

int Operation::target_qbit
protectedinherited

The index of the qubit on which the operation acts (target_qbit >= 0)

Definition at line 50 of file Operation.h.

◆ theta

bool U3::theta
protected

logical value indicating whether the matrix creation takes an argument theta

Definition at line 44 of file U3.h.

◆ type

operation_type Operation::type
protectedinherited

The type of the operation (see enumeration operation_type)

Definition at line 48 of file Operation.h.


The documentation for this class was generated from the following files: