A class representing a CNOT operation.
More...
#include <CNOT.h>
A class representing a CNOT operation.
Definition at line 36 of file CNOT.h.
◆ CNOT() [1/2]
Nullary constructor of the class.
Definition at line 33 of file CNOT.cpp.
◆ CNOT() [2/2]
CNOT::CNOT |
( |
int |
qbit_num_in, |
|
|
int |
target_qbit_in, |
|
|
int |
control_qbit_in |
|
) |
| |
Constructor of the class.
- Parameters
-
qbit_num_in | The number of qubits in the unitaries |
target_qbit_in | The identification number of the target qubit. (0 <= target_qbit <= qbit_num-1) |
control_qbit_in | The identification number of the control qubit. (0 <= target_qbit <= qbit_num-1) |
Definition at line 60 of file CNOT.cpp.
◆ ~CNOT()
Destructor of the class.
Definition at line 97 of file CNOT.cpp.
◆ apply_from_right()
void CNOT::apply_from_right |
( |
Matrix & |
input | ) |
|
|
virtual |
Call to apply the gate on the input array/matrix by input*CNOT.
- Parameters
-
input | The input array on which the gate is applied |
Reimplemented from Gate.
Definition at line 183 of file CNOT.cpp.
◆ apply_to()
void CNOT::apply_to |
( |
Matrix & |
input | ) |
|
|
virtual |
Call to apply the gate on the input array/matrix by CNOT*input.
Call to apply the gate on the input array/matrix CNOT*input.
- Parameters
-
input | The input array on which the gate is applied |
Reimplemented from Gate.
Definition at line 121 of file CNOT.cpp.
◆ apply_to_list()
void Gate::apply_to_list |
( |
std::vector< Matrix > & |
input | ) |
|
|
inherited |
Call to apply the gate on the input array/matrix by U3*input.
- Parameters
-
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 110 of file Gate.cpp.
◆ clone()
Call to create a clone of the present class.
- Returns
- Return with a pointer pointing to the cloned object
Definition at line 277 of file CNOT.cpp.
◆ get_control_qbit()
int Gate::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 203 of file Gate.cpp.
◆ get_matrix()
Call to retrieve the operation matrix.
Call to retrieve the gate matrix.
- Returns
- Returns with the matrix of the operation
-
Returns with the matrix of the gate
Definition at line 106 of file CNOT.cpp.
◆ get_parameter_num()
int Gate::get_parameter_num |
( |
| ) |
|
|
inherited |
Call to get the number of free parameters.
- Returns
- Return with the number of the free parameters
Definition at line 211 of file Gate.cpp.
◆ get_qbit_num()
int Gate::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 229 of file Gate.cpp.
◆ get_target_qbit()
int Gate::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 195 of file Gate.cpp.
◆ get_type()
Call to get the type of the operation.
- Returns
- Return with the type of the operation (see gate_type for details)
Definition at line 220 of file Gate.cpp.
◆ print()
void logging::print |
( |
const std::stringstream & |
sstream, |
|
|
int |
verbose_level = 1 |
|
) |
| const |
|
inherited |
Call to print output messages in the function of the verbosity level.
- Parameters
-
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.
◆ reorder_qubits()
void CNOT::reorder_qubits |
( |
std::vector< int > |
qbit_list | ) |
|
|
virtual |
Call to reorder the qubits in the matrix of the operation.
Call to reorder the qubits in the matrix of the gate.
- Parameters
-
qbit_list | The reordered list of qubits spanning the matrix |
Reimplemented from Gate.
Definition at line 265 of file CNOT.cpp.
◆ set_debugfile()
void logging::set_debugfile |
( |
std::string |
debugfile | ) |
|
|
inherited |
Call to set the debugfile name.
- Parameters
-
debugfile | String variable. Set the debugfile name. |
Definition at line 95 of file logging.cpp.
◆ set_matrix()
void Gate::set_matrix |
( |
Matrix |
input | ) |
|
|
inherited |
Call to set the stored matrix in the operation.
- Parameters
-
input | The operation matrix to be stored. The matrix is stored by attribute matrix_alloc. |
- Returns
- Returns with 0 on success.
Definition at line 152 of file Gate.cpp.
◆ set_qbit_num()
void CNOT::set_qbit_num |
( |
int |
qbit_num | ) |
|
|
virtual |
Call to set the number of qubits spanning the matrix of the operation.
Call to set the number of qubits spanning the matrix of the gate.
- Parameters
-
qbit_num | The number of qubits |
Reimplemented from Gate.
Definition at line 253 of file CNOT.cpp.
◆ set_verbose()
void logging::set_verbose |
( |
int |
verbose_in | ) |
|
|
inherited |
Call to set the verbose attribute.
- Parameters
-
verbose_in | Integer variable. Set the number to specify the verbosity level for output messages. |
Definition at line 85 of file logging.cpp.
◆ control_qbit
The index of the qubit which acts as a control qubit (control_qbit >= 0) in controlled operations.
Definition at line 53 of file Gate.h.
◆ debug
Logical variable. Set true to write output messages to the 'debug.txt' file.
Definition at line 48 of file logging.h.
◆ debugfile_name
std::string logging::debugfile_name |
|
inherited |
String variable. Set the debug file name.
Definition at line 51 of file logging.h.
◆ matrix_size
The size N of the NxN matrix associated with the operations.
Definition at line 55 of file Gate.h.
◆ parameter_num
the number of free parameters of the operation
Definition at line 57 of file Gate.h.
◆ qbit_num
number of qubits spanning the matrix of the operation
Definition at line 47 of file Gate.h.
◆ target_qbit
The index of the qubit on which the operation acts (target_qbit >= 0)
Definition at line 51 of file Gate.h.
◆ type
The type of the operation (see enumeration gate_type)
Definition at line 49 of file Gate.h.
◆ verbose
Set the verbosity level of the output messages.
Definition at line 45 of file logging.h.
The documentation for this class was generated from the following files: