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

Function assertNumQubitsFlagsValid

tests/unit/operations.cpp:254–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252}
253
254void assertNumQubitsFlagsValid(
255 NumQubitsFlag ctrlsFlag, NumQubitsFlag targsFlag,
256 vector<int> ctrls, vector<int> states, vector<int> targs
257) {
258 assertNumQubitsFlagsAreValid(ctrlsFlag, targsFlag);
259
260 // we explicitly permit targsFlag=zero while
261 // targs.size() != 0, which occurs when targs
262 // are supplied to the API through an alternate
263 // argument (e.g. a PauliStr)
264
265 if (targsFlag == one)
266 DEMAND( targs.size() == 1 );
267
268 if (targsFlag == two)
269 DEMAND( targs.size() == 2 );
270
271 if (ctrlsFlag == zero)
272 DEMAND( ctrls.size() == 0 );
273
274 if (ctrlsFlag == one)
275 DEMAND( ctrls.size() == 1 );
276
277 if (ctrlsFlag == anystates)
278 DEMAND( states.size() == ctrls.size() );
279 else
280 DEMAND( states.size() == 0 );
281}
282
283
284/*

Callers 1

invokeApiOperationFunction · 0.85

Calls 1

Tested by

no test coverage detected