Quantum Gate Decomposer
v1.3
Powerful decomposition of almost any unitary into U3 and CNOT gates
|
A class responsible for grouping CNOT and U3 operations into layers. More...
#include <Operation_block.h>
Public Member Functions | |
void | add_cnot_to_end (int control_qbit, int target_qbit) |
Append a C_NOT gate operation to the list of operations. More... | |
void | add_cnot_to_front (int control_qbit, int target_qbit) |
Add a C_NOT gate operation to the front of the list of operations. More... | |
void | add_operation_to_end (Operation *operation) |
Append a general operation to the list of operations. More... | |
void | add_operation_to_front (Operation *operation) |
Add an operation to the front of the list of operations. More... | |
void | add_operations_to_end (std::vector< Operation * > operations_in) |
Append a list of operations to the list of operations. More... | |
void | add_operations_to_front (std::vector< Operation * > operations_in) |
Add an array of operations to the front of the list of operations. More... | |
void | add_u3_to_end (int target_qbit, bool Theta, bool Phi, bool Lambda) |
Append a U3 gate to the list of operations. More... | |
void | add_u3_to_front (int target_qbit, bool Theta, bool Phi, bool Lambda) |
Add a U3 gate to the front of the list of operations. More... | |
Operation_block * | clone () |
Create a clone of the present class. More... | |
void | combine (Operation_block *op_block) |
Call to append the operations of an operation block to the current block. More... | |
int | extract_operations (Operation_block *op_block) |
Call to extract the operations stored in the class. More... | |
int | get_control_qbit () |
Call to get the index of the control qubit. More... | |
gates_num | get_gate_nums () |
Call to get the number of the individual gate types in the list of operations. More... | |
std::vector< int > | get_involved_qubits () |
Call to get the qubits involved in the operations stored in the block of operations. More... | |
std::vector< Matrix > | get_matrices (const double *parameters) |
Call to get the list of matrix representation of the operations grouped in the block. More... | |
Matrix | get_matrix (const double *parameters) |
Call to retrieve the operation matrix (Which is the product of all the operation matrices stored in the operation block) More... | |
Matrix | get_matrix () |
Call to retrieve the operation matrix. More... | |
int | get_operation_num () |
Call to get the number of operations grouped in the class. More... | |
std::vector< Operation * > | get_operations () |
Call to get the operations stored in the class. 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... | |
operation_type | get_type () |
Call to get the type of the operation. More... | |
void | list_operations (const double *parameters, int start_index) |
Call to print the list of operations stored in the block of operations for a specific set of parameters. More... | |
Operation_block () | |
Deafult constructor of the class. More... | |
Operation_block (int qbit_num_in) | |
Constructor of the class. More... | |
void | release_operations () |
Call to release the stored operations. More... | |
void | reorder_qubits (std::vector< int > qbit_list) |
Call to reorder the qubits in the matrix of the operations. More... | |
void | set_matrix (Matrix input) |
Call to set the stored matrix in the operation. More... | |
void | set_qbit_num (int qbit_num_in) |
Set the number of qubits spanning the matrix of the operations stored in the block of operations. More... | |
virtual | ~Operation_block () |
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 | layer_num |
number of operation layers More... | |
int | matrix_size |
The size N of the NxN matrix associated with the operations. More... | |
std::vector< Operation * > | operations |
The list of stored operations. More... | |
unsigned int | parameter_num |
the number of free parameters of the operation 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... | |
operation_type | type |
The type of the operation (see enumeration operation_type) More... | |
A class responsible for grouping CNOT and U3 operations into layers.
Definition at line 36 of file Operation_block.h.
Operation_block::Operation_block | ( | ) |
Deafult constructor of the class.
Definition at line 34 of file Operation_block (copy).cpp.
Operation_block::Operation_block | ( | int | qbit_num_in | ) |
Constructor of the class.
qbit_num_in | The number of qubits in the unitaries |
Definition at line 48 of file Operation_block (copy).cpp.
|
virtual |
Destructor of the class.
Definition at line 60 of file Operation_block (copy).cpp.
void Operation_block::add_cnot_to_end | ( | int | control_qbit, |
int | target_qbit | ||
) |
Append a C_NOT gate operation to the list of operations.
control_qbit | The identification number of the control qubit. (0 <= target_qbit <= qbit_num-1) |
target_qbit | The identification number of the target qubit. (0 <= target_qbit <= qbit_num-1) |
Definition at line 264 of file Operation_block (copy).cpp.
void Operation_block::add_cnot_to_front | ( | int | control_qbit, |
int | target_qbit | ||
) |
Add a C_NOT gate operation to the front of the list of operations.
control_qbit | The identification number of the control qubit. (0 <= target_qbit <= qbit_num-1) |
target_qbit | The identification number of the target qubit. (0 <= target_qbit <= qbit_num-1) |
Definition at line 281 of file Operation_block (copy).cpp.
void Operation_block::add_operation_to_end | ( | Operation * | operation | ) |
Append a general operation to the list of operations.
operation | A pointer to a class Operation describing an operation. |
Definition at line 322 of file Operation_block (copy).cpp.
void Operation_block::add_operation_to_front | ( | Operation * | operation | ) |
Add an operation to the front of the list of operations.
operation | A pointer to a class Operation describing an operation. |
Definition at line 345 of file Operation_block (copy).cpp.
void Operation_block::add_operations_to_end | ( | std::vector< Operation * > | operations_in | ) |
Append a list of operations to the list of operations.
operations_in | A list of operation class instances. |
Definition at line 295 of file Operation_block (copy).cpp.
void Operation_block::add_operations_to_front | ( | std::vector< Operation * > | operations_in | ) |
Add an array of operations to the front of the list of operations.
operations_in | A list of operation class instances. |
Definition at line 308 of file Operation_block (copy).cpp.
Append a U3 gate to the list of operations.
target_qbit | The identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1) |
Theta | The Theta parameter of the U3 operation |
Phi | The Phi parameter of the U3 operation |
Lambda | The Lambda parameter of the U3 operation |
Definition at line 233 of file Operation_block (copy).cpp.
Add a U3 gate to the front of the list of operations.
target_qbit | The identification number of the targt qubit. (0 <= target_qbit <= qbit_num-1) |
Theta | The Theta parameter of the U3 operation |
Phi | The Phi parameter of the U3 operation |
Lambda | The Lambda parameter of the U3 operation |
Definition at line 249 of file Operation_block (copy).cpp.
Operation_block * Operation_block::clone | ( | ) |
Create a clone of the present class.
Definition at line 665 of file Operation_block (copy).cpp.
void Operation_block::combine | ( | Operation_block * | op_block | ) |
Call to append the operations of an operation block to the current block.
op_block | A pointer to an instance of class Operation_block |
Definition at line 593 of file Operation_block (copy).cpp.
int Operation_block::extract_operations | ( | Operation_block * | op_block | ) |
Call to extract the operations stored in the class.
op_block | An instance of Operation_block class in which the operations will be stored. (The current operations will be erased) |
Definition at line 686 of file Operation_block (copy).cpp.
|
inherited |
Call to get the index of the control qubit.
Definition at line 157 of file Operation.cpp.
gates_num Operation_block::get_gate_nums | ( | ) |
Call to get the number of the individual gate types in the list of operations.
Definition at line 369 of file Operation_block (copy).cpp.
std::vector< int > Operation_block::get_involved_qubits | ( | ) |
Call to get the qubits involved in the operations stored in the block of operations.
Definition at line 552 of file Operation_block (copy).cpp.
std::vector< Matrix > Operation_block::get_matrices | ( | const double * | parameters | ) |
Call to get the list of matrix representation of the operations grouped in the block.
parameters | Array of parameters to calculate the matrix of the operation block |
Definition at line 174 of file Operation_block (copy).cpp.
Matrix Operation_block::get_matrix | ( | const double * | parameters | ) |
Call to retrieve the operation matrix (Which is the product of all the operation matrices stored in the operation block)
parameters | An array pointing to the parameters of the operations |
Definition at line 106 of file Operation_block (copy).cpp.
|
inherited |
Call to retrieve the operation matrix.
Definition at line 97 of file Operation.cpp.
int Operation_block::get_operation_num | ( | ) |
Call to get the number of operations grouped in the class.
Definition at line 418 of file Operation_block (copy).cpp.
std::vector< Operation * > Operation_block::get_operations | ( | ) |
Call to get the operations stored in the class.
Definition at line 584 of file Operation_block (copy).cpp.
int Operation_block::get_parameter_num | ( | ) |
Call to get the number of free parameters.
Definition at line 409 of file Operation_block (copy).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.
void Operation_block::list_operations | ( | const double * | parameters, |
int | start_index | ||
) |
Call to print the list of operations stored in the block of operations for a specific set of parameters.
parameters | The parameters of the operations that should be printed. |
start_index | The ordinal number of the first operation. |
Definition at line 428 of file Operation_block (copy).cpp.
void Operation_block::release_operations | ( | ) |
Call to release the stored operations.
Definition at line 68 of file Operation_block (copy).cpp.
|
virtual |
Call to reorder the qubits in the matrix of the operations.
Call to reorder the qubits in the matrix of the operation.
qbit_list | The reordered list of qubits spanning the matrix |
Reimplemented from Operation.
Definition at line 522 of file Operation_block (copy).cpp.
|
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.
|
virtual |
Set the number of qubits spanning the matrix of the operations stored in the block of operations.
qbit_num_in | The number of qubits spanning the matrices. |
Reimplemented from Operation.
Definition at line 633 of file Operation_block (copy).cpp.
|
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 |
number of operation layers
Definition at line 43 of file Operation_block.h.
|
protectedinherited |
The size N of the NxN matrix associated with the operations.
Definition at line 54 of file Operation.h.
|
protected |
The list of stored operations.
Definition at line 41 of file Operation_block.h.
|
protectedinherited |
the number of free parameters of the operation
Definition at line 56 of file Operation.h.
|
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.
|
protectedinherited |
The type of the operation (see enumeration operation_type)
Definition at line 48 of file Operation.h.