MCPcopy Create free account
hub / github.com/NVIDIA/cuda-quantum / main

Function main

targettests/execution/dem_from_kernel.cpp:262–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260}
261
262int main() {
263 // Trivial: kernel without QEC ops yields an empty DEM.
264 runTrivial();
265
266 // Detector / logical-observable source examples without any noise model.
267 runNoNoiseCase("DEMO_NO_NOISE", demoKernel);
268 runNoNoiseCase("DEMO_ROUNDS_NO_NOISE", demoKernel2, 2);
269 runNoNoiseCase("DEMO_VEC_ROUNDS_NO_NOISE", demoKernel3, 2);
270
271 // Test the builder path
272 {
273 auto kernel = cudaq::make_kernel();
274 auto q = kernel.qalloc();
275 auto m = kernel.mz(q);
276 kernel.detector(m);
277 kernel.logical_observable(m);
278 auto qsA = kernel.qalloc(2);
279 auto qsB = kernel.qalloc(2);
280 auto prev = kernel.mz(qsA);
281 auto curr = kernel.mz(qsB);
282 kernel.detectors(prev, curr);
283 runNoNoiseCase("BUILDER", kernel);
284 }
285
286 // Single noisy qubit, single detector: one X_ERROR mechanism, one
287 // detector reference. No observable.
288 runCase("SINGLE_NOISY", singleNoisyDetector{});
289
290 // Three noisy measurements with multi-handle detector and observable.
291 runCase("THREE_MZ", threeMzMultiDetector{});
292
293 // Memory experiment, two rounds, three cross-round detectors plus one
294 // multi-target observable.
295 runCase("MEM_EXP_2R", memoryExperimentTwoRounds{});
296
297 // Vectorized stdvec form producing the same shape as MEM_EXP_2R.
298 runCase("VECTORIZED", vectorizedDetectors{});
299
300 // Measurement-dependent control flow must be rejected with a clear
301 // diagnostic. The single-trajectory recorded circuit cannot represent
302 // measurement-conditional gates.
303 runNoNoiseCase("CONDITIONAL", conditionalKernel{});
304
305 // Non-Clifford gate must surface as a Stim diagnostic.
306 runNoNoiseCase("NON_CLIFFORD", nonClifford{});
307
308 return 0;
309}
310
311// CHECK: TRIVIAL errors=0 detectors=0 observables=0
312// CHECK: DEMO_NO_NOISE errors=0 detectors=1 observables=1

Callers

nothing calls this directly

Calls 9

runTrivialFunction · 0.85
runNoNoiseCaseFunction · 0.85
runCaseFunction · 0.70
make_kernelFunction · 0.50
qallocMethod · 0.45
mzMethod · 0.45
detectorMethod · 0.45
logical_observableMethod · 0.45
detectorsMethod · 0.45

Tested by

no test coverage detected