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

Function getKroneckerProduct

tests/utils/linalg.cpp:523–544  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

521
522
523qmatrix getKroneckerProduct(qmatrix a, qmatrix b) {
524
525 // we permit the matrices to be non-square which is
526 // pretty cheeky (since qmatrix is assumed square with
527 // a 2^N dimension by most other functions), but is
528 // necessary for us to compute partial traces
529
530 size_t aRows = a.size();
531 size_t bRows = b.size();
532 size_t aCols = a[0].size();
533 size_t bCols = b[0].size();
534
535 qmatrix out(aRows * bRows, qvector(aCols * bCols));
536
537 for (size_t r=0; r<bRows; r++)
538 for (size_t c=0; c<bCols; c++)
539 for (size_t i=0; i<aRows; i++)
540 for (size_t j=0; j<aCols; j++)
541 out[r+bRows*i][c+bCols*j] = a[i][j] * b[r][c];
542
543 return out;
544}
545
546
547qmatrix getKroneckerProduct(vector<qmatrix> matrices) {

Callers 8

getMatrixFunction · 0.70
getSwapMatrixFunction · 0.70
getFullStateOperatorFunction · 0.70
getProjectorFunction · 0.70
getPartialTraceFunction · 0.70
getSuperOperatorFunction · 0.70
operations.cppFile · 0.50
SECTIONFunction · 0.50

Calls 1

getIdentityMatrixFunction · 0.70

Tested by

no test coverage detected