gate_named_two.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef _MSC_VER
4 extern "C" {
5 #include <csim/update_ops.h>
6 }
7 #else
8 #include <csim/update_ops.h>
9 #endif
10 
11 #include "gate_named.hpp"
12 #include "state.hpp"
13 
18 public:
25  ClsCNOTGate(UINT control_qubit_index, UINT target_qubit_index) {
26  this->_update_func = CNOT_gate;
27  this->_name = "CNOT";
28  this->_target_qubit_list.push_back(TargetQubitInfo(target_qubit_index, FLAG_X_COMMUTE ));
29  this->_control_qubit_list.push_back(ControlQubitInfo(control_qubit_index, 1 ));
31  this->_matrix_element = ComplexMatrix::Zero(2,2);
32  this->_matrix_element << 0,1,1,0;
33  }
34 };
35 
40 public:
47  ClsCZGate(UINT control_qubit_index, UINT target_qubit_index) {
48  this->_update_func = CZ_gate;
49  this->_name = "CZ";
50  this->_target_qubit_list.push_back(TargetQubitInfo(target_qubit_index, FLAG_Z_COMMUTE ));
51  this->_control_qubit_list.push_back(ControlQubitInfo(control_qubit_index, 1 ));
53  this->_matrix_element = ComplexMatrix::Zero(2,2);
54  this->_matrix_element << 1,0,0,-1;
55  }
56 };
57 
62 public:
69  ClsSWAPGate(UINT target_qubit_index1, UINT target_qubit_index2) {
70  this->_update_func = SWAP_gate;
71  this->_name = "SWAP";
72  this->_target_qubit_list.push_back(TargetQubitInfo(target_qubit_index1, 0 ));
73  this->_target_qubit_list.push_back(TargetQubitInfo(target_qubit_index2, 0 ));
75  this->_matrix_element = ComplexMatrix::Zero(4,4);
76  this->_matrix_element << 1,0,0,0 , 0,0,1,0 , 0,1,0,0 , 0,0,0,1;
77  }
78 };
std::vector< TargetQubitInfo > _target_qubit_list
Definition: gate.hpp:77
std::string _name
Definition: gate.hpp:80
Definition: qubit_info.hpp:41
std::vector< ControlQubitInfo > _control_qubit_list
Definition: gate.hpp:78
#define FLAG_X_COMMUTE
Flags for bit property: diagonal in X-basis.
Definition: qubit_info.hpp:7
Definition: qubit_info.hpp:86
ComplexMatrix _matrix_element
Definition: gate_named.hpp:90
ClsCZGate(UINT control_qubit_index, UINT target_qubit_index)
Definition: gate_named_two.hpp:47
#define FLAG_Z_COMMUTE
Flags for bit property: diagonal in Z-basis.
Definition: qubit_info.hpp:11
Definition: gate_named_two.hpp:17
T_UPDATE_FUNC * _update_func
Definition: gate_named.hpp:89
Definition: gate_named_two.hpp:39
Definition: gate_named_two.hpp:61
ClsCNOTGate(UINT control_qubit_index, UINT target_qubit_index)
Definition: gate_named_two.hpp:25
ComplexMatrix _matrix_element
Definition: gate_named.hpp:53
Definition: gate_named.hpp:49
ClsSWAPGate(UINT target_qubit_index1, UINT target_qubit_index2)
Definition: gate_named_two.hpp:69
#define FLAG_CLIFFORD
Flgas for gate property: gate is Clifford.
Definition: gate.hpp:63
T_UPDATE_FUNC * _update_func
Definition: gate_named.hpp:52
UINT _gate_property
Definition: gate.hpp:79
Definition: gate_named.hpp:86