1

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?

Turbotanten
  • 566
  • 2
  • 14
  • 2
    A quick glance indicates there's no way to do it at the moment. I'd recommend opening an issue to get it fixed https://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. – Craig Gidney Feb 07 '22 at 10:59
  • Thanks! I will follow your advice. – Turbotanten Feb 07 '22 at 11:00

0 Answers0