qml.devices.qutrit_mixed.simulate

simulate(circuit, rng=None, prng_key=None, debugger=None, interface=None)[source]

Simulate a single quantum script.

This is an internal function that will be called by default.qutrit.mixed.

Parameters
  • circuit (QuantumTape) – The single circuit to simulate

  • rng (Union[None, int, array_like[int], SeedSequence, BitGenerator, Generator]) – A seed-like parameter matching that of seed for numpy.random.default_rng. If no value is provided, a default RNG will be used.

  • prng_key (Optional[jax.random.PRNGKey]) – An optional jax.random.PRNGKey. This is the key to the JAX pseudo random number generator. If None, a random key will be generated. Only for simulation using JAX.

  • debugger (_Debugger) – The debugger to use

  • interface (str) – The machine learning interface to create the initial state with

Returns

The results of the simulation

Return type

tuple(TensorLike)

Note that this function can return measurements for non-commuting observables simultaneously.

This function assumes that all operations provide matrices.

>>> qs = qml.tape.QuantumScript([qml.TRX(1.2, wires=0)], [qml.expval(qml.GellMann(0, 3)), qml.probs(wires=(0,1))])
>>> simulate(qs)
(0.36235775447667357,
tensor([0.68117888, 0.        , 0.        , 0.31882112, 0.        , 0.        ], requires_grad=True))