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

Function setSubMatrix

tests/utils/qmatrix.cpp:203–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201 */
202
203void setSubMatrix(qmatrix &dest, qmatrix sub, size_t r, size_t c) {
204 DEMAND( sub.size() > 0 );
205 DEMAND( sub .size() + r <= dest.size() );
206 DEMAND( sub[0].size() + c <= dest.size() );
207
208 // this function cheekily supports when 'sub' is non-square,
209 // which is inconsistent with the preconditions of most of
210 // the qmatrix functions, but is needed by setDensityQuregAmps()
211
212 for (size_t i=0; i<sub.size(); i++)
213 for (size_t j=0; j<sub[i].size(); j++)
214 dest[r+i][c+j] = sub[i][j];
215}
216
217void setSubMatrix(qmatrix &dest, qvector sub, size_t flatInd) {
218 DEMAND( sub.size() + flatInd <= dest.size()*dest.size() );

Callers 3

getSwapMatrixFunction · 0.70
getControlledMatrixFunction · 0.70
SECTIONFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected