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

Function localiser_statevec_setAmps

quest/src/core/localiser.cpp:592–610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

590
591
592void localiser_statevec_setAmps(qcomp* inAmps, Qureg qureg, qindex globalStartInd, qindex globalNumAmps) {
593
594 // we do not assert Qureg is a state-vector, since the
595 // density matrix routine leverages this function
596
597 // always embarrassingly parallel, since inAmps is duplicated on every node;
598 // nodes simply determine which amps overlap their partition, and use them
599
600 if (!qureg.isDistributed) {
601 accel_statevec_setAmps_sub(inAmps, qureg, globalStartInd, globalNumAmps);
602 return;
603 }
604
605 if (!util_areAnyVectorElemsWithinNode(qureg.rank, qureg.numAmpsPerNode, globalStartInd, globalNumAmps))
606 return;
607
608 auto range = util_getLocalIndRangeOfVectorElemsWithinNode(qureg.rank, qureg.numAmpsPerNode, globalStartInd, globalNumAmps);
609 accel_statevec_setAmps_sub(&inAmps[range.localDuplicStartInd], qureg, range.localDistribStartInd, range.numElems);
610}
611
612
613void localiser_densmatr_setAmps(qcomp** inAmps, Qureg qureg, qindex startRow, qindex startCol, qindex numRows, qindex numCols) {

Tested by

no test coverage detected