| 360 | |
| 361 | |
| 362 | qcomp*** cpu_allocMatrixList(qindex numRows, int numMatrices) { |
| 363 | |
| 364 | // attempt to allocate the outer list |
| 365 | qcomp*** matrices = (qcomp***) malloc(numMatrices * sizeof *matrices); // nullptr if failed |
| 366 | |
| 367 | // attempt to allocate each matrix |
| 368 | if (matrices != nullptr) |
| 369 | for (int n=0; n<numMatrices; n++) |
| 370 | matrices[n] = cpu_allocMatrix(numRows); // nullptr if failed |
| 371 | |
| 372 | return matrices; // may be or contain nullptrs, user will handle |
| 373 | } |
| 374 | |
| 375 | |
| 376 | void cpu_deallocMatrixList(qcomp*** matrices, qindex numRows, int numMatrices) { |
no test coverage detected