# flamingpy.noise.CVLayer¶

class flamingpy.noise.CVLayer(code, *, delta, **kwargs)[source]

Bases: object

A class for applying to a code (or a graph state) a physical layer of continuous-variable noise.

Associates the nodes of an EGraph with continuous-variable quantum states, and its edges with continuous-variable CZ gates.

Currently, a hybrid lattice of p-squeezed and GKP+ states is considered.

Parameters
• code (SurfaceCode or EGraph) – the code object (so that code.graph is an EGraph), or an EGraph directly, to which the noise is applied.

• delta (float) – the quadrature blurring parameter, related to the squeezing of the GKP states and the momentum-quadrature variance of the p-squeezed states.

• states (dict, optional) – the dictionary of all non-GKP states and their indices, of the form {‘state’: []}. By default, all states are treated as GKP states.

• p_swap (float, optional) – if supplied, the probability of a node being a p-squeezed state. Overrides the indices given in state.

• sampling_order (str, optional) – the scheme for conducting sampling for the homodyne measurements. Options are “initial” and “two-step”

• translator (func) – the choice of binning function for converting homodyne outcomes to bit values; by default, the standard GKP binner that snaps to the closest integer multiple of sqrt(pi).

• rng (numpy.random.Generator, optional) – a random number generator following the NumPy API. It can be seeded for reproducibility. By default, numpy.random.default_rng is used without a fixed seed.

egraph

the underlying graph representation.

Type

EGraph

delta

the delta from the Args above.

Type

float

p_swap

the swap-out probability from the Args above.

Type

float

states

states along with their indices.

Type

dict

_N

the number of qubits in the lattice.

Type

int

_to_points

the index-to-coordinate dictionary, taken from egraph.

Type

dict

the adjacency matrix of egraph

Type

sp.sparse.csr_matrix

_sampling_order

sampling order from above.

Type

str

_translator

the translator from above.

Type

func

_perfect_inds

the indices of qubits to treat as ideal.

Type

list or NoneType

 gkp_inds the indices of the GKP states. p_inds the indices of the p-squeezed states.
gkp_inds

the indices of the GKP states.

Type

array

p_inds

the indices of the p-squeezed states.

Type

array

 SCZ([sparse]) Return the symplectic matrix associated with CZ application. apply_noise([rng]) Apply cv-level noise to the graph state. bit_values([inds]) array: bit values associated with the p measurement. draw(**kwargs) Draw the CV graph state with matplotlib. draw_SCZ(**kwargs) Draw the adjacency matrix of a CV graph state with matplotlib. hom_outcomes([inds, quad]) array: quad-homodyne measurement outcomes for modes inds. Convert homodyne outcomes to bit values according to translator. measure_hom([quad, inds, updated_means, ...]) Conduct a homodyne measurement of states in the lattice. measure_syndrome([rng]) Measure the syndrome for memory-mode error correction of the grpah states. populate_states([rng]) Populate the graph state with state labels.
SCZ(sparse=True)[source]

Return the symplectic matrix associated with CZ application.

apply_noise(rng=Generator(PCG64) at 0x7F02B7235E40)[source]

Apply cv-level noise to the graph state.

Identify the nodes of the EGraph with CV states, measure the syndrome assuming the specified noise model, and convert the simulated homodyne outcomes to bit values.

This method modifies the attributes of self.egraph.

bit_values(inds=None)[source]

array: bit values associated with the p measurement.

draw(**kwargs)[source]

Draw the CV graph state with matplotlib.

Use the default colours: gold for GKP states and blue for p-squeezed states.

See flamingpy.utils.viz.draw_EGraph for more details.

draw_SCZ(**kwargs)[source]

Draw the adjacency matrix of a CV graph state with matplotlib.

See flamingpy.utils.viz.plot_mat_heat_map for more details.

array: quad-homodyne measurement outcomes for modes inds.

inner_decoder()[source]

Convert homodyne outcomes to bit values according to translator.

This is the inner (CV) decoder, a.k.a. translator, a.k.a binning function. Set converted values to the bit_val attribute for nodes in self.egraph.

This method modifies self.egraph.

measure_hom(quad='p', inds=None, updated_means=None, updated_covs=None, propagate=True, rng=Generator(PCG64) at 0x7F02B72504A0)[source]

Conduct a homodyne measurement of states in the lattice.

Simulate a homodyne measurement of quadrature quad of states at indices inds according to sampling order specified by self._sampling_order. If updated_means or updated_covs is supplied, use those instead of the outputs of self._means_sampler and self._covs_sampler, respectively. The ‘propagate’ option is fed into _means_sampler, if desired.

Parameters

rng (numpy.random.Generator, optional) – a random number generator following NumPy API. It can be seeded for reproducibility. By default, numpy.random.default_rng is used without a fixed seed.

measure_syndrome(rng=Generator(PCG64) at 0x7F02B7250660)[source]

Measure the syndrome for memory-mode error correction of the grpah states.

populate_states(rng=Generator(PCG64) at 0x7F02B7250900)[source]

Populate the graph state with state labels.

Assume the graph states consists of a combination of squeezed states and GKP+ states. A non-zero self.p_swap overrides indices specified in self.states and uses a binomial distribution to identify some indices as p-squeezed states.

This method modifies self.egraph.

Home

Background

Using FlamingPy

Development

Getting Help

Python API