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

Function printDenseSquareMatrix

quest/src/core/printer.cpp:1074–1105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1072// importantly, it excludes KrausMap which is handled separately
1073template <class T>
1074void printDenseSquareMatrix(T obj, string indent) {
1075
1076 // determine the full matrix dimension
1077 qindex numRows;
1078 if constexpr (util_isDenseMatrixType<T>())
1079 numRows = obj.numRows;
1080 else
1081 numRows = powerOf2(obj.numQubits); // this would be wrong for SuperOp
1082
1083 // work out which global amps are going to be printed, divided into quadrants
1084 MatrixQuadrantInds inds = getTruncatedMatrixQuadrantInds(numRows, numRows);
1085
1086 // populate quadrants (which may involve a GPU to CPU copy and/or communication)
1087 qcompmatr ul,ur,ll,lr;
1088 allocateMatrixQuadrants(inds, ul,ur,ll,lr);
1089 populateMatrixQuadrants(inds, ul,ur,ll,lr, obj);
1090
1091 // columns are only labelled if given a distributed Qureg (they become sender node)
1092 vector<string> leftColLabels, rightColLabels;
1093 if constexpr (util_isQuregType<T>())
1094 if (obj.isDistributed)
1095 populateDensityMatrixColumnLabels(leftColLabels, rightColLabels, obj, inds);
1096
1097 // do not label rows nor successively indent them
1098 vector<string> rowLabels = {};
1099 string indentPerRow = "";
1100
1101 printMatrixInFourQuadrants(
1102 ul, ur, ll, lr,
1103 leftColLabels, rightColLabels, rowLabels, rowLabels,
1104 indent, indentPerRow, VDOTS_CHAR);
1105}
1106
1107
1108void print_elems(CompMatr1 obj, string indent) { printDenseSquareMatrix(obj, indent); }

Callers 1

print_elemsFunction · 0.85

Calls 6

powerOf2Function · 0.85
allocateMatrixQuadrantsFunction · 0.85
populateMatrixQuadrantsFunction · 0.85

Tested by

no test coverage detected