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

Method appendMeasurement

runtime/common/Trace.cpp:54–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54void cudaq::Trace::appendMeasurement(std::string_view name,
55 std::vector<QuditInfo> targets,
56 std::optional<std::string> register_name) {
57 assert(!targets.empty() && "A measurement must have at least one target");
58 auto findMaxID = [](const std::vector<QuditInfo> &qudits) -> std::size_t {
59 return std::max_element(qudits.cbegin(), qudits.cend(),
60 [](auto &a, auto &b) { return a.id < b.id; })
61 ->id;
62 };
63 numQudits = std::max(numQudits, findMaxID(targets) + 1);
64 instructions.emplace_back(name, std::vector<double>{},
65 std::vector<QuditInfo>{}, std::move(targets),
66 std::nullopt, TraceInstructionType::Measurement,
67 std::move(register_name));
68}

Callers 5

createSimpleCircuitFunction · 0.80
TESTFunction · 0.80
CUDAQ_TESTFunction · 0.80
measureMethod · 0.80
mzMethod · 0.80

Calls 4

cbeginMethod · 0.80
cendMethod · 0.80
emplace_backMethod · 0.80
emptyMethod · 0.45

Tested by 3

createSimpleCircuitFunction · 0.64
TESTFunction · 0.64
CUDAQ_TESTFunction · 0.64