4
$\begingroup$

The documentation for Cirq mentions the possibility to step through a circuit's moments, and access the exact wavefunction via step.state_vector(), and edit set it via step.set_state(). In the API documentation, neither function is documented. While the former seems to work anyway, the latter (setting the state) gives an AttributeError. I am using Cirq 0.9.1.

How can I change the wavefunction used for the next moment simulation?

$\endgroup$

1 Answer 1

1
$\begingroup$

You found a bug in the docs, the method is set_state_vector() - I opened https://github.com/quantumlib/Cirq/issues/3623.

The methods are only available on the SparseSimulatorStep which is the default simulator in Cirq.

They are available in the API docs though set_state_vector has no docstring:

$\endgroup$

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.