1
$\begingroup$

I have a code that essentially looks like this

# Density matrix simulator
    sim = cirq.DensityMatrixSimulator(
    split_untangled_states=True
)

# Simulate
result = sim.simulate(
    circuit,
    resolver,
    initial_state=rho,
    qubit_order=cirq.LineQubit.range(num_q)
)

My initial state rho is a density matrix. However, cirq.validate_density_matrix(rho) raises value error "The density matrix is not positive semidefinite.", but changing the default value of atol from 1e-7 to 1e-6 removes this value error. Therefore I would like to tell DensityMatrixSimulator to use atol of 1e-6 when simulating the circuit. How can I do that?

$\endgroup$
2
  • 2
    $\begingroup$ A quick glance indicates there's no way to do it at the moment. I'd recommend opening an issue to get it fixed github.com/quantumlib/Cirq/issues . As a workaround in the meantime you could write a method to numerically project your density matrix closer to the valid subspace. $\endgroup$ Feb 7 at 10:59
  • $\begingroup$ Thanks! I will follow your advice. $\endgroup$ Feb 7 at 11:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.