1
$\begingroup$

I am performing state tomography after a computation cycle in order to store information about the state before measurement and use that information to re-initialise the state for the new cycle of computation. I came across the following problem: while trying to re-initialize the state to the pre-measurement one for the next computation round python flags an error 'Sum of amplitudes-squared not equal to one'. I understand this is due to the degree of approximation included in reconstructing the density matrix through tomography and if I go checking, $tr(\rho^{2})=1.00000000000000009$ or something like that, although it seems qiskit will only accept 1.0 precisely. I'm trying to find ways to work around this problem, does anybody have an idea? I'm attaching a pictorial representation of the cycle.

enter image description here

$\endgroup$

1 Answer 1

2
$\begingroup$

You can convert the density matrix to a StateVector using to_statevector() method and set a suitable value for atol (absolute tolerance) parameter. Then pass this statevector to initialize()

from qiskit.quantum_info import Statevector, DensityMatrix

rho = DensityMatrix([
    [0.36, 0.480006],
    [0.480006, 0.640016]
])

sv = rho.to_statevector(atol=1E-5)
circuit.initialize(sv)
$\endgroup$
1
  • $\begingroup$ Thanks for the answer, this actually works. Unfortunately my simulation is aimed to be actually an executable on real quantum hardware so all things related to the Statevector module are not fitting for my situation, as far as I understand. $\endgroup$ Jan 27 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.