-
Notifications
You must be signed in to change notification settings - Fork 1
/
gate.h
42 lines (35 loc) · 986 Bytes
/
gate.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
This header file provides functionality of quantum Gates respresented as type Matrices.
The following functions are supported:
- getNumQubits : returns type int of number of qubits
- printGate() : prints the current gate configuration
*/
#ifndef _GATE_H_
#define _GATE_H_
#include "matrix.h"
class Gate {
Matrix gate;
int num_qubits;
std::string gate_code;
friend class Qubits;
bool checkUnitary(int num_qubits, Matrix gate);
public:
Gate() = default;
Gate(int num_qubits);
Gate(int num_qubits, std::string gate_code);
Gate(int num_qubits, Matrix gate);
Gate(int num_qubits, Matrix gate, std::string gate_code);
Gate(int num_qubits, std::vector<std::vector<Complex>> gate);
Matrix getMatrix();
int getNumQubits();
void printGate();
std::string getGateCode();
};
Gate H();
Gate X();
Gate Y();
Gate Z();
Gate CX();
Gate U(double theta,double phi,double lambda);
Gate Controlled(Gate gate);
#endif