0.2.1
New Features
-
Measurement samples can be returned as bitstrings instead of integers in nested lists.
-
A density matrix representation of the state can be accessed via the
Circuit.density_matrix
property, for both pure and mixed states (with the former being lazily calculated from the state
vector).
Upgrade Notes
-
Adds support for multi-qubit sampling in measurements.
Measurement.sample()
and
Measurement.expval()
are updated to accept a sequence of qubit indices to sample, sampling
all measured qubits if none are given.circuit = Circuit(2, 2) with circuit.context as (q, c): ops.X(q[0]) m = ops.Measurement(q) | c simulate(circuit) m.sample(num_samples=3, as_bitstring=True) # ['10', '10', '10']
-
The state is now stored in the
Circuit
object (same as the bits/measurement results) instead
of being returned by thesimulate()
function. It can now be accessed via the
Circuit.state
property.