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

Function populateDistributedVectorRowLabels

quest/src/core/printer.cpp:1182–1196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1180// T can be Qureg (.isDistributed=1, .isDensityMatrix=0) or FullStateDiagMatr
1181template <class T>
1182void populateDistributedVectorRowLabels(vector<string> &upperRowLabels, vector<string> &lowerRowLabels, T obj, MatrixQuadrantInds inds) {
1183
1184 // these might already contain kets; resize preserves existing elems
1185 upperRowLabels.resize(inds.numUpperLeftRows);
1186 lowerRowLabels.resize(inds.numLowerLeftRows);
1187
1188 // to ensure rank aligns nicely, pad existing labels with the widest elem (which is the last one)
1189 int len = (lowerRowLabels.empty()? upperRowLabels : lowerRowLabels).back().length();
1190 for (auto &label : upperRowLabels) label += string(len - label.length(), MATRIX_SPACE_CHAR);
1191 for (auto &label : lowerRowLabels) label += string(len - label.length(), MATRIX_SPACE_CHAR);
1192
1193 int lastRank = -1;
1194 setRowLabelsToRanks(upperRowLabels, lastRank, inds.upperStartRow, obj);
1195 setRowLabelsToRanks(lowerRowLabels, lastRank, inds.lowerStartRow, obj);
1196}
1197
1198
1199// T can be any 1D type, e.g. Qureg (.isDensityMatrix=0), FullStateDiagMatr, DiagMatr/1/2

Callers 1

printVectorFunction · 0.85

Calls 1

setRowLabelsToRanksFunction · 0.85

Tested by

no test coverage detected