The Quantum Exact Simulation Toolkit v4.0.0
Loading...
Searching...
No Matches

Testing utilities which evaluate measurements upon reference qvector and qmatrix states. These are slow, serial, un-optimised, defensively-designed routines. More...

Functions

vector< qreal > getAllReferenceProbabilities (qmatrix state, vector< int > targets)
 
vector< qreal > getAllReferenceProbabilities (qvector state, vector< int > targets)
 
qcomp getReferenceExpectationValue (qmatrix state, PauliStr str)
 
qcomp getReferenceExpectationValue (qmatrix state, PauliStrSum sum)
 
qcomp getReferenceExpectationValue (qmatrix state, qmatrix observable)
 
qcomp getReferenceExpectationValue (qvector state, PauliStr str)
 
qcomp getReferenceExpectationValue (qvector state, PauliStrSum sum)
 
qcomp getReferenceExpectationValue (qvector state, qmatrix observable)
 
qreal getReferenceProbability (qmatrix state)
 
qreal getReferenceProbability (qmatrix state, qindex basisIndex)
 
qreal getReferenceProbability (qmatrix state, vector< int > targets, vector< int > outcomes)
 
qreal getReferenceProbability (qvector state)
 
qreal getReferenceProbability (qvector state, qindex basisIndex)
 
qreal getReferenceProbability (qvector state, vector< int > targets, vector< int > outcomes)
 
qreal getReferencePurity (qmatrix state)
 
qreal getReferencePurity (qvector state)
 

Detailed Description

Testing utilities which evaluate measurements upon reference qvector and qmatrix states. These are slow, serial, un-optimised, defensively-designed routines.

Function Documentation

◆ getAllReferenceProbabilities() [1/2]

vector< qreal > getAllReferenceProbabilities ( qmatrix state,
vector< int > targets )

Definition at line 108 of file measure.cpp.

108{ return getAllRefProbsInner(state, targets); }

◆ getAllReferenceProbabilities() [2/2]

vector< qreal > getAllReferenceProbabilities ( qvector state,
vector< int > targets )

Definition at line 107 of file measure.cpp.

107{ return getAllRefProbsInner(state, targets); }

◆ getReferenceExpectationValue() [1/6]

qcomp getReferenceExpectationValue ( qmatrix state,
PauliStr str )

Definition at line 50 of file measure.cpp.

50{ return getRefExpecValInner(state, str); }

◆ getReferenceExpectationValue() [2/6]

qcomp getReferenceExpectationValue ( qmatrix state,
PauliStrSum sum )

Definition at line 52 of file measure.cpp.

52{ return getRefExpecValInner(state, sum); }

◆ getReferenceExpectationValue() [3/6]

qcomp getReferenceExpectationValue ( qmatrix state,
qmatrix observable )

Definition at line 36 of file measure.cpp.

36 {
37 DEMAND( state.size() == observable.size() );
38
39 return getTrace(observable * state);
40}

◆ getReferenceExpectationValue() [4/6]

qcomp getReferenceExpectationValue ( qvector state,
PauliStr str )

Definition at line 49 of file measure.cpp.

49{ return getRefExpecValInner(state, str); }

◆ getReferenceExpectationValue() [5/6]

qcomp getReferenceExpectationValue ( qvector state,
PauliStrSum sum )

Definition at line 51 of file measure.cpp.

51{ return getRefExpecValInner(state, sum); }

◆ getReferenceExpectationValue() [6/6]

qcomp getReferenceExpectationValue ( qvector state,
qmatrix observable )

Definition at line 30 of file measure.cpp.

30 {
31 DEMAND( state.size() == observable.size() );
32
33 return getInnerProduct(state, observable * state);
34}

◆ getReferenceProbability() [1/6]

qreal getReferenceProbability ( qmatrix state)

Definition at line 120 of file measure.cpp.

120 {
121
122 qreal out = 0;
123 for (size_t i=0; i<state.size(); i++)
124 out += std::real(state[i][i]);
125
126 return out;
127}

◆ getReferenceProbability() [2/6]

qreal getReferenceProbability ( qmatrix state,
qindex basisIndex )

Definition at line 83 of file measure.cpp.

83 {
84 DEMAND( basisIndex < (qindex) state.size() );
85
86 qcomp elem = state[basisIndex][basisIndex];
87 qreal prob = std::real(elem);
88 return prob;
89}

◆ getReferenceProbability() [3/6]

qreal getReferenceProbability ( qmatrix state,
vector< int > targets,
vector< int > outcomes )

Definition at line 72 of file measure.cpp.

72{ return getRefProbInner(state, targets, outcomes); }

◆ getReferenceProbability() [4/6]

qreal getReferenceProbability ( qvector state)

Definition at line 111 of file measure.cpp.

111 {
112
113 qreal out = 0;
114 for (auto& elem : state)
115 out += std::norm(elem);
116
117 return out;
118}

◆ getReferenceProbability() [5/6]

qreal getReferenceProbability ( qvector state,
qindex basisIndex )

Definition at line 75 of file measure.cpp.

75 {
76 DEMAND( basisIndex < (qindex) state.size() );
77
78 qcomp elem = state[basisIndex];
79 qreal prob = std::norm(elem);
80 return prob;
81}

◆ getReferenceProbability() [6/6]

qreal getReferenceProbability ( qvector state,
vector< int > targets,
vector< int > outcomes )

Definition at line 71 of file measure.cpp.

71{ return getRefProbInner(state, targets, outcomes); }

◆ getReferencePurity() [1/2]

qreal getReferencePurity ( qmatrix state)

Definition at line 130 of file measure.cpp.

130 {
131
132 return std::real(getTrace(state * state));
133}

◆ getReferencePurity() [2/2]

qreal getReferencePurity ( qvector state)

Definition at line 134 of file measure.cpp.

134 {
135
136 return getReferencePurity(getOuterProduct(state, state));
137}