correct circuit for tomography
@@ -216,13 +216,10 @@ class HHL(QuantumAlgorithm):
# Preparing the state tomography circuits
c = ClassicalRegister(self._num_q)
self._circuit.add_register(c)
- qc = QuantumCircuit(c, name="master")
- qc = self._circuit
- qc.name = "master"
tomo_set = tomo.state_tomography_set(list(range(self._num_q)))
tomo_circuits = \
- tomo.create_tomography_circuits(qc, self._io_register, c, tomo_set)
-
+ tomo.create_tomography_circuits(self._circuit, self._io_register,
+ c, tomo_set)
# Handling the results
result = self._quantum_instance.execute(tomo_circuits)
probs = []
@@ -237,18 +234,9 @@ class HHL(QuantumAlgorithm):
probs.append(s/(f+s))
self._ret["probability_result"] = probs
# Fitting the tomography data
- tomo_data = tomo.tomography_data(result, "master", tomo_set)
tomo_data = tomo.tomography_data(result, self._circuit.name, tomo_set)
rho_fit = tomo.fit_tomography_data(tomo_data)
- we, stateall = np.linalg.eigh(rho_fit)
- probmix = we.max()
- prob_location = we.argmax()
- if probmix > 0.001:
- sv = stateall[:, prob_location]
-
vec = rho_fit[:, 0]/np.sqrt(rho_fit[0, 0])
- vec = np.array([0.+0.j, 1.+0.j])
- vec = sv
self._ret["output_hhl"] = vec
# Calculating the fidelity with the classical solution
