| 590 | |
| 591 | |
| 592 | void 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 | |
| 613 | void localiser_densmatr_setAmps(qcomp** inAmps, Qureg qureg, qindex startRow, qindex startCol, qindex numRows, qindex numCols) { |
no test coverage detected