This repository has been archived by the owner on Dec 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathQbit.h
57 lines (42 loc) · 1.35 KB
/
Qbit.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// Created by Filippo Valle on 15/11/2018.
//
#ifndef BB84_SIMULATION_QBIT_H
#define BB84_SIMULATION_QBIT_H
#if !defined(__CINT__) || defined(__MAKECINT__)
#include <Riostream.h>
#include <TMath.h>
#include <TRandom3.h>
#include <functional>
#endif
using std::ostream;
typedef enum base{ // definisco il tipo "base", cheè un enumeration. può assumere solo i valori Plusminuse ZeroOne
ZeroOne,
PlusMinus
} base;
typedef bool polarization; // definisco il tipo "polarization", che è un booleano. Sarà 0 o 1
class Qbit {
public:
Qbit(bool islogic = false);
Qbit(const Qbit &qbit);
Qbit &operator=(const Qbit &source);
~Qbit();
inline base GetBase() const {return fBase;}
inline polarization GetState() const {return fState;}
inline int GetNPhysicalQbits() const {return fPhysicsQbits;}
void PrepareState(base b, polarization pol);
void MeasureState(base b);
void AddNoise(std::function<double()>);
bool operator==(const Qbit &qitCompared) const; // to compare qbits
friend ostream& operator<<(ostream& os, Qbit q); // to print qbits
static const bool DEBUG = false;
private:
double* fTheta;
base fBase;
polarization fState;
bool fIsLogic;
int fPhysicsQbits;
void PrepareTheta();
polarization MeasurePhisicalqbit(int q);
};
#endif //BB84_SIMULATION_QBIT_H