| 201 | */ |
| 202 | |
| 203 | void 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 | |
| 217 | void setSubMatrix(qmatrix &dest, qvector sub, size_t flatInd) { |
| 218 | DEMAND( sub.size() + flatInd <= dest.size()*dest.size() ); |
no outgoing calls
no test coverage detected