The Quantum Exact Simulation Toolkit v4.1.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)
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!

Definition at line 467 of file channels.cpp.

467 {
468 validate_krausMapFields(map, __func__);
469 validate_numReportedNewlinesAboveZero(__func__); // because trailing newline mandatory
470
471 // pedantically demand that the map's SuperOP is GPU-synced,
472 // even though only the CPU Kraus operators are printed
473 validate_krausMapIsSynced(map, __func__);
474
475 // determine memory costs (gauranteed not to overflow)
476 bool isDense = true;
477 int numNodes = 1;
478 size_t krausMem = mem_getLocalMatrixMemoryRequired(map.numQubits, isDense, numNodes) * map.numMatrices;
479 size_t superMem = mem_getLocalSuperOpMemoryRequired(map.superop.numQubits);
480 size_t strucMem = sizeof(map);
481
482 // gauranteed not to overflow
483 size_t totalMem = krausMem + superMem + strucMem;
484 print_header(map, totalMem);
485 print_elems(map);
486
487 // exclude mandatory newline above
488 print_oneFewerNewlines();
489}

◆ reportSuperOp()

void reportSuperOp ( SuperOp op)
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!

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 print_header(op, elemMem + structMem);
460 print_elems(op);
461
462 // exclude mandatory newline above
463 print_oneFewerNewlines();
464}