| 250 | |
| 251 | |
| 252 | void setQuregToMixture(Qureg out, qreal* probs, Qureg* in, int numIn) { |
| 253 | validate_quregFields(out, __func__); |
| 254 | validate_quregIsDensityMatrix(out, __func__); |
| 255 | validate_numQuregsInSum(numIn, __func__); |
| 256 | validate_quregsCanBeMixed(out, in, numIn, __func__); // also validates all init & densmatr |
| 257 | validate_probabilities(probs, numIn, __func__); |
| 258 | |
| 259 | // convert probs to complex (assume this alloc never fails) |
| 260 | vector<qcomp> coeffVec(numIn); |
| 261 | for (int i=0; i<numIn; i++) |
| 262 | coeffVec[i] = getQcomp(probs[i], 0); |
| 263 | |
| 264 | auto inVec = util_getVector(in, numIn); |
| 265 | localiser_statevec_setQuregToWeightedSum(out, coeffVec, inVec); |
| 266 | } |
| 267 | |
| 268 | |
| 269 | } // end de-mangler |
no test coverage detected