MCPcopy Create free account
hub / github.com/QuEST-Kit/QuEST / demo_createInlinePauliStrSum

Function demo_createInlinePauliStrSum

examples/isolated/initialising_paulis.cpp:93–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91
92
93void demo_createInlinePauliStrSum() {
94
95 reportStr("[demo_createInlinePauliStrSum]");
96
97 // coeffs can be real, imag, or complex (via C++ raw multilines)
98 PauliStrSum a = createInlinePauliStrSum(R"(
99 0.123 XXIXX
100 1.23i XYZXZ
101 -1-6i IIIII
102 )");
103 reportPauliStrSum(a);
104 destroyPauliStrSum(a);
105
106 // and use scientific notation, with any amount of whitespace
107 PauliStrSum b = createInlinePauliStrSum(R"(
108 + 5E2-1i XYZ
109 - 1E-50i IXY
110 + 1 - 6E-5i IIX
111 0 III
112 5. XXX
113 .5 ZZZ
114 )");
115 reportPauliStrSum(b);
116 destroyPauliStrSum(b);
117
118 // paulis can be lowercase and 0-3, with any whitespace
119 PauliStrSum c = createInlinePauliStrSum(R"(
120 2.5 0123 ixyz IXYZ
121 3.5 0iII 1xXX 2yYY
122
123 -1.5E-15 - 5.123E-30i 0 0 0 0 0 0 0 0 1 1 1 1
124 1.5 + 5i 3 3 3 3 2 2 2 2 I X Y Z
125 )");
126 reportPauliStrSum(c);
127 destroyPauliStrSum(c);
128}
129
130
131void demo_createPauliStrSum() {

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Calls 4

reportStrFunction · 0.85
createInlinePauliStrSumFunction · 0.85
reportPauliStrSumFunction · 0.85
destroyPauliStrSumFunction · 0.85

Tested by

no test coverage detected