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

Method processQuantumOperation

python/cudaq/kernel/ast_bridge.py:2652–2677  ·  view source on GitHub ↗
(opName,
                                    controls,
                                    targets,
                                    *args,
                                    broadcast=lambda q: [q],
                                    **kwargs)

Source from the content-addressed store, hash-verified

2650 node)
2651
2652 def processQuantumOperation(opName,
2653 controls,
2654 targets,
2655 *args,
2656 broadcast=lambda q: [q],
2657 **kwargs):
2658 opCtor = getattr(quake, f'{opName}Op')
2659 checkControlAndTargetTypes(controls, targets)
2660 if not broadcast:
2661 return opCtor(*args, controls, targets, **kwargs)
2662 elif quake.VeqType.isinstance(targets[0].type):
2663 assert len(targets) == 1
2664
2665 def bodyBuilder(iterVal):
2666 q = quake.ExtractRefOp(self.getRefType(),
2667 targets[0],
2668 -1,
2669 index=iterVal).result
2670 opCtor(*args, controls, broadcast(q), **kwargs)
2671
2672 veqSize = quake.VeqSizeOp(self.getIntegerType(),
2673 targets[0]).result
2674 self.createInvariantForLoop(bodyBuilder, veqSize)
2675 else:
2676 for target in targets:
2677 opCtor(*args, controls, broadcast(target), **kwargs)
2678
2679 def processQuakeCtor(opName,
2680 pyArgs,

Callers

nothing calls this directly

Calls 3

getIntegerTypeMethod · 0.95
broadcastFunction · 0.85

Tested by

no test coverage detected