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

Function getIdentityMatrix

tests/utils/qmatrix.cpp:30–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30qmatrix getIdentityMatrix(size_t dim) {
31 DEMAND( dim >= 1 );
32
33 qmatrix out = getZeroMatrix(dim);
34
35 for (size_t i=0; i<dim; i++)
36 out[i][i] = 1;
37
38 return out;
39}
40
41qmatrix getDiagonalMatrix(qvector v) {
42 DEMAND( v.size() >= 1 );

Callers 14

getMatrixFunction · 0.70
getSwapMatrixFunction · 0.70
getSwapAndUnswapMatricesFunction · 0.70
getFullStateOperatorFunction · 0.70
isApproxUnitaryFunction · 0.70
getProjectorFunction · 0.70
getPartialTraceFunction · 0.70
getControlledMatrixFunction · 0.70
getKroneckerProductFunction · 0.70
isApproxCPTPFunction · 0.70

Calls 1

getZeroMatrixFunction · 0.70

Tested by

no test coverage detected