PhasedClassicalSimState#

qualtran.simulation.classical_sim.PhasedClassicalSimState

A mutable class for classically simulating composite bloqs with phase tracking.

Inherits From: ClassicalSimState

The convenience function do_phased_classical_simulation will simulate a bloq. Use this class directly for more fine-grained control.

This simulation scheme supports a class of circuits containing only:

  • classical operations corresponding to permutation matrices in the computational basis

  • phase-like operations corresponding to diagonal matrices in the computational basis.

signature

The signature of the composite bloq.

binst_graph

The directed-graph form of the composite bloq. Consider constructing this class with the .from_cbloq constructor method to correctly generate the binst graph.

vals

A mapping of input register name to classical value to serve as inputs to the procedure.

phase

The initial phase. It must be a valid phase: a complex number with unit modulus.

soq_assign

An assignment of soquets to classical values.

last_binst

A record of the last bloq instance we processed during simulation.

phase

The current phase of the simulation state.

random_handler

The classical random number handler to use for use in measurement-based outcomes (e.g. MBUC).

Methods#

from_cbloq

View source

Initiate a classical simulation from a CompositeBloq.

Args

cbloq

The composite bloq

vals

A mapping of input register name to classical value to serve as inputs to the procedure.

rng

A random number generator to use for classical random values, such a np.random.

fixed_random_vals

A dictionary of bloq instances to values to perform fixed calculation for classical values.

Returns