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

Function setQuregToMixture

quest/src/api/initialisations.cpp:252–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250
251
252void 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

Callers 1

SECTIONFunction · 0.85

Calls 9

validate_quregFieldsFunction · 0.85
validate_numQuregsInSumFunction · 0.85
validate_probabilitiesFunction · 0.85
getQcompFunction · 0.85
util_getVectorFunction · 0.85

Tested by

no test coverage detected