| 932 | |
| 933 | |
| 934 | void populateManyColumnQcompmatr(qcompmatr &matr, qindex startRow, qindex startCol, Qureg qureg) { |
| 935 | |
| 936 | // matr has been prior resized such that even before |
| 937 | // population, matr.size() is non-zero unless it is |
| 938 | // intended to stay empty |
| 939 | if (matr.size() == 0) |
| 940 | return; |
| 941 | |
| 942 | // prepare list of pointers to matr rows, compatible with localiser 2D input format |
| 943 | vector<qcomp*> ptrs; |
| 944 | util_tryAllocVector(ptrs, matr.size(), error_printerFailedToAllocTempMemory); |
| 945 | for (size_t r=0; r<matr.size(); r++) |
| 946 | ptrs[r] = matr[r].data(); |
| 947 | |
| 948 | // overwrite matr (throug ptrs), which may trigger communication and GPU-to-CPU copying. |
| 949 | // note this achieves node consensus; every node populates their matr, which is much more |
| 950 | // demanding than only the root note, however we expect this is not a big deal; live printing |
| 951 | // in distributed settings is exceptionally rare and will print small, tractable subsets |
| 952 | localiser_densmatr_getAmps(ptrs.data(), qureg, startRow, startCol, matr.size(), matr[0].capacity()); |
| 953 | } |
| 954 | |
| 955 | |
| 956 | // T can be qcomp** or qcomp(*)[] |
no test coverage detected