| 371 | |
| 372 | |
| 373 | void demo_setFullStateDiagMatr() { |
| 374 | |
| 375 | // force use of available hardware acceleration |
| 376 | QuESTEnv env = getQuESTEnv(); |
| 377 | FullStateDiagMatr matr = createCustomFullStateDiagMatr(5, env.isDistributed, env.isGpuAccelerated, env.isMultithreaded); |
| 378 | |
| 379 | // inline literal (C++ only) |
| 380 | setFullStateDiagMatr(matr, 0, {1,2,3,4}); |
| 381 | setFullStateDiagMatr(matr, 4, {5,6,7,8}); |
| 382 | |
| 383 | // vector (C++ only) |
| 384 | vector<qcomp> vec {11, 22, 33, 44}; |
| 385 | setFullStateDiagMatr(matr, 7, vec); |
| 386 | |
| 387 | // compile-time array must pass size |
| 388 | qcomp arr[4] = {7_i, 8_i, 8, 7}; |
| 389 | setFullStateDiagMatr(matr, 15, arr, 4); |
| 390 | |
| 391 | // heap pointer |
| 392 | int dim = 6; |
| 393 | qcomp* ptr = (qcomp*) malloc(dim * sizeof *ptr); |
| 394 | for (int i=0; i<dim; i++) |
| 395 | ptr[i] = -i*.5_i; |
| 396 | setFullStateDiagMatr(matr, 25, ptr, 6); |
| 397 | |
| 398 | reportFullStateDiagMatr(matr); |
| 399 | destroyFullStateDiagMatr(matr); |
| 400 | } |
| 401 | |
| 402 | |
| 403 | void demo_syncFullStateDiagMatr() { |
no test coverage detected