Skip to content

Commit

Permalink
enable cuda quantum integration
Browse files Browse the repository at this point in the history
Signed-off-by: Alex McCaskey <[email protected]>
  • Loading branch information
amccaskey authored and Pooja Rao committed Nov 29, 2023
1 parent a36e55a commit 2b200e9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions qswift/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def __init__(self, operator_pool: OperatorPool, obs_map, initializer: CircuitIni
self._nshot = nshot
self._tool = tool

def compute(self, code):
def compute(self, code, **kwargs):
ancilla_index = self._nqubit - 1
qc = self._initializer.init_circuit(self._nqubit, {ancilla_index}, self._tool)
operators = []
Expand All @@ -147,7 +147,11 @@ def compute(self, code):
for operator in operators:
self.add_gate(qc, operator, self._tau, ancilla_index, targets)
if isinstance(operator, MeasurementOperator):
value = coeff * self._observables[operator.j].get_value(qc, self._nshot)
tmp = self._observables[operator.j].get_value(qc, self._nshot, **kwargs)
if isinstance(tmp, float):
value = coeff * tmp
else:
value = (coeff, tmp)
return value
raise AttributeError("measurement is not set")

Expand Down Expand Up @@ -184,5 +188,5 @@ def __init__(self, *, operator_pool: OperatorPool, observables, initializer, tau
def to_string(self, swift_channel: SwiftChannel):
return self.string_encoder.encode(swift_channel)

def evaluate(self, code):
return self.circuit_encoder.compute(code)
def evaluate(self, code, **kwargs):
return self.circuit_encoder.compute(code, **kwargs)

0 comments on commit 2b200e9

Please sign in to comment.