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

Function validate_matrixNumNewElems

quest/src/core/validation.cpp:2149–2169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2147 */
2148
2149void validate_matrixNumNewElems(int numQubits, vector<vector<qcomp>> elems, const char* caller) {
2150
2151 // CompMatr accept 2D elems
2152 qindex dim = powerOf2(numQubits);
2153 tokenSubs vars = {
2154 {"${NUM_QUBITS}", numQubits},
2155 {"${NUM_EXPECTED_ROWS}", dim},
2156 {"${NUM_GIVEN_ROWS}", elems.size()}};
2157
2158 assertThat(dim == (qindex) elems.size(), report::COMP_MATR_NEW_ELEMS_WRONG_NUM_ROWS, vars, caller);
2159
2160 for(auto & row : elems) {
2161
2162 vars = {
2163 {"${NUM_QUBITS}", numQubits},
2164 {"${EXPECTED_DIM}", dim},
2165 {"${NUM_GIVEN_ELEMS}", row.size()}};
2166
2167 assertThat(dim == (qindex) row.size(), report::COMP_MATR_NEW_ELEMS_WRONG_ROW_DIM, vars, caller);
2168 }
2169}
2170void validate_matrixNumNewElems(int numQubits, vector<qcomp> elems, const char* caller) {
2171
2172 // DiagMatr accept 1D elems

Callers 10

getCompMatr1Function · 0.85
getCompMatr2Function · 0.85
getDiagMatr1Function · 0.85
getDiagMatr2Function · 0.85
setCompMatrFunction · 0.85
setDiagMatrFunction · 0.85
setInlineCompMatrFunction · 0.85
setInlineDiagMatrFunction · 0.85
createInlineCompMatrFunction · 0.85
createInlineDiagMatrFunction · 0.85

Calls 2

powerOf2Function · 0.85
assertThatFunction · 0.85

Tested by

no test coverage detected