Quantum Gate Decomposer  v1.3
Powerful decomposition of almost any unitary into U3 and CNOT gates
CNOT.h
Go to the documentation of this file.
1 /*
2 Created on Fri Jun 26 14:13:26 2020
3 Copyright (C) 2020 Peter Rakyta, Ph.D.
4 
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see http://www.gnu.org/licenses/.
17 
18 @author: Peter Rakyta, Ph.D.
19 */
24 #ifndef CNOT_H
25 #define CNOT_H
26 
27 #include "qgd/matrix.h"
28 #include "qgd/Operation.h"
29 #include <math.h>
30 
31 
32 
36 class CNOT: public Operation {
37 
38 protected:
39 
40 
41 public:
48 CNOT(int qbit_num_in, int target_qbit_in, int control_qbit_in);
49 
53 ~CNOT();
54 
60 
65 void set_qbit_num(int qbit_num);
66 
72 
77 void reorder_qubits( std::vector<int> qbit_list);
78 
83 CNOT* clone();
84 
85 };
86 
87 #endif //CNOT
Base class for the representation of one- and two-qubit operations.
Definition: Operation.h:40
CNOT(int qbit_num_in, int target_qbit_in, int control_qbit_in)
Constructor of the class.
Definition: CNOT.cpp:38
Header file for a class for the representation of one- and two-qubit operations.
Matrix composite_cnot()
Calculate the matrix of a CNOT gate operation acting on the space of qbit_num qubits.
Definition: CNOT.cpp:87
void reorder_qubits(std::vector< int > qbit_list)
Call to reorder the qubits in the matrix of the operation.
Definition: CNOT.cpp:180
int qbit_num
number of qubits spanning the matrix of the operation
Definition: Operation.h:46
CNOT * clone()
Call to create a clone of the present class.
Definition: CNOT.cpp:192
A class representing a CNOT operation.
Definition: CNOT.h:36
void set_qbit_num(int qbit_num)
Call to set the number of qubits spanning the matrix of the operation.
Definition: CNOT.cpp:168
Class to store data of complex arrays and its properties.
Definition: matrix.h:12
~CNOT()
Destructor of the class.
Definition: CNOT.cpp:70
Matrix get_matrix()
Call to retrieve the operation matrix.
Definition: CNOT.cpp:79