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

Functions for printing channels. More...

Functions

void reportKrausMap (KrausMap map)
 
void reportSuperOp (SuperOp op)
 

Detailed Description

Functions for printing channels.

Function Documentation

◆ reportKrausMap()

void reportKrausMap ( KrausMap map)

Prints a KrausMap.

Example
KrausMap map = createInlineKrausMap(1, 3, {
{{1,2},{3,4}},
{{5,5},{6,6}},
{{1i,2i},{-3i,-4i}}
});
void reportKrausMap(KrausMap map)
Definition channels.cpp:471
KrausMap (1 qubit, 3 2x2 matrices, 1 4x4 superoperator, 528 bytes):
[matrix 0]
1 2
3 4
[matrix 1]
5 5
6 6
[matrix 2]
i 2i
-3i -4i
Parameters
[in]mapthe KrausMap to print.
Exceptions
error
  • if map is uninitialised.
Author
Tyson Jones

Definition at line 471 of file channels.cpp.

471 {
472 validate_krausMapFields(map, __func__);
473 validate_numReportedNewlinesAboveZero(__func__); // because trailing newline mandatory
474
475 // pedantically demand that the map's SuperOP is GPU-synced,
476 // even though only the CPU Kraus operators are printed
477 validate_krausMapIsSynced(map, __func__);
478
479 // determine memory costs (gauranteed not to overflow)
480 bool isDense = true;
481 int numNodes = 1;
482 size_t krausMem = mem_getLocalMatrixMemoryRequired(map.numQubits, isDense, numNodes) * map.numMatrices;
483 size_t superMem = mem_getLocalSuperOpMemoryRequired(map.superop.numQubits);
484 size_t strucMem = sizeof(map);
485
486 printer_sync();
487
488 // gauranteed not to overflow
489 size_t totalMem = krausMem + superMem + strucMem;
490 print_header(map, totalMem);
491 print_elems(map);
492
493 // exclude mandatory newline above
494 print_oneFewerNewlines();
495
496 printer_sync();
497}
SuperOp superop
Definition channels.h:278
int numQubits
Definition channels.h:231
int numMatrices
Definition channels.h:239
int numQubits
Definition channels.h:112

◆ reportSuperOp()

void reportSuperOp ( SuperOp op)

Prints a SuperOp.

Example
SuperOp op = createInlineSuperOp(1, {
{1,2,3,4},
{5,-(10E-2)*3.14i,7,8},
{9,10,11,12},
{13,14,15,16+1.23i}
});
void reportSuperOp(SuperOp op)
Definition channels.cpp:447
SuperOp (1 qubit, 4x4 qcomps, 304 bytes):
1 2 3 4
5 -0.314i 7 8
9 10 11 12
13 14 15 16+1.23i
Parameters
[in]opthe SuperOp to print.
Exceptions
error
  • if op is uninitialised.
Author
Tyson Jones

Definition at line 447 of file channels.cpp.

447 {
448 validate_superOpFields(op, __func__);
449 validate_numReportedNewlinesAboveZero(__func__); // because trailing newline mandatory
450
451 // demand that SuperOp is GPU-synced, since the
452 // to-be-printed GPU elems will overwrite CPU
453 validate_superOpIsSynced(op, __func__);
454
455 // determine memory costs; heap memory and struct fields
456 size_t elemMem = mem_getLocalSuperOpMemoryRequired(op.numQubits);
457 size_t structMem = sizeof(op);
458
459 printer_sync();
460
461 print_header(op, elemMem + structMem);
462 print_elems(op);
463
464 // exclude mandatory newline above
465 print_oneFewerNewlines();
466
467 printer_sync();
468}