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

Function util_getLocalIndexOfGlobalIndex

quest/src/core/utilities.cpp:239–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237}
238
239qindex util_getLocalIndexOfGlobalIndex(Qureg qureg, qindex globalInd) {
240
241 // equivalent to below, but clearer
242 if (!qureg.isDistributed)
243 return globalInd;
244
245 // defensive-design integrity check
246 qindex globalStart = util_getGlobalIndexOfFirstLocalAmp(qureg);
247 qindex globalEnd = globalStart + qureg.numAmpsPerNode;
248 if (globalInd < globalStart || globalInd >= globalEnd)
249 error_utilsGivenGlobalIndexOutsideNode();
250
251 return globalInd % qureg.numAmpsPerNode;
252}
253
254qindex util_getLocalIndexOfFirstDiagonalAmp(Qureg qureg) {
255 assert_utilsGivenDensMatr(qureg);

Callers 1

Tested by

no test coverage detected