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

Function getRandomDiagonalUnitary

tests/utils/random.cpp:379–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377
378
379qmatrix getRandomDiagonalUnitary(int numQb) {
380 DEMAND( numQb >= 1 );
381
382 qmatrix matr = getZeroMatrix(getPow2(numQb));
383
384 // unitary diagonals have unit complex scalars
385 for (size_t i=0; i<matr.size(); i++)
386 matr[i][i] = getRandomUnitComplex();
387
388 return matr;
389}
390
391
392qmatrix getRandomDiagonalHermitian(int numQb) {

Callers 3

SECTIONFunction · 0.50

Calls 3

getPow2Function · 0.85
getRandomUnitComplexFunction · 0.85
getZeroMatrixFunction · 0.70

Tested by

no test coverage detected