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

Functions for printing Pauli data structures. More...

Functions

void reportPauliStr (PauliStr str)
 
void reportPauliStrSum (PauliStrSum str)
 

Detailed Description

Functions for printing Pauli data structures.

Function Documentation

◆ reportPauliStr()

void reportPauliStr ( PauliStr str)
Note
Documentation for this function or struct is under construction!
Warning
This function has not yet been unit tested and may contain bugs. Please use with caution!
See also

Definition at line 264 of file paulis.cpp.

264 {
265
266 printer_sync();
267
268 // no header, so no indentation
269 string indent = "";
270 print_elemsWithoutNewline(str, indent);
271
272 // print all user-set newlines (including none)
273 print_newlines();
274
275 printer_sync();
276}

◆ reportPauliStrSum()

void reportPauliStrSum ( PauliStrSum str)
Note
Documentation for this function or struct is under construction!
Warning
This function has not yet been unit tested and may contain bugs. Please use with caution!
See also

Definition at line 279 of file paulis.cpp.

279 {
280 validate_pauliStrSumFields(sum, __func__);
281 validate_numReportedNewlinesAboveZero(__func__);
282
283 // calculate memory usage
284 qindex numStrBytes = sum.numTerms * sizeof *sum.strings;
285 qindex numCoeffBytes = sum.numTerms * sizeof *sum.coeffs;
286 qindex numStrucBytes = sizeof(sum);
287
288 // we don't bother checking for overflow since total memory scales
289 // linearly with user input parameters, unlike Qureg and matrices.
290 qindex numTotalBytes = numStrBytes + numCoeffBytes + numStrucBytes;
291
292 printer_sync();
293
294 print_header(sum, numTotalBytes);
295 print_elems(sum);
296
297 // exclude mandatory newline above
298 print_oneFewerNewlines();
299
300 printer_sync();
301}