flamingpy.noise.CVMacroLayer¶
- class flamingpy.noise.CVMacroLayer(code, *, delta, bs_network=None, **kwargs)[source]¶
Bases:
flamingpy.noise.cv.CVLayer
A class for reducing a macronode CV graph to a canonical graph.
Applies noise to self.egraph (assumed a macronode graph), entangles the macronodes, measures the syndrome, and populates the canonical graph reduced_graph with the reduced states, bit values, and error probabilities.
In addition to CVLayer args, the following:
- Parameters
bs_network (np.array, optional) – the sympletic matrix corresponding to the beamsplitter network entangling the macronode. By default, the standard four-splitter.
Attributes
the indices of the GKP states.
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
Methods
SCZ
([sparse])Return the symplectic matrix associated with CZ application.
apply_noise
([rng])Reduce the macronode code lattice to the canonical code lattice.
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)¶
Return the symplectic matrix associated with CZ application.
- apply_noise(rng=Generator(PCG64) at 0x7F02CFAECD60)[source]¶
Reduce the macronode code lattice to the canonical code lattice.
Follow the procedure in arXiv:2104.03241. Take the macronode lattice macro_graph, apply noise, designate micronodes as planets and stars, conduct homodyne measurements, process these measurements, and compute conditional phase error probabilities.
This method modifies the node attributes of self.reduced_graph to include effective bit values and phase error probabilities.
- bit_values(inds=None)¶
array: bit values associated with the p measurement.
- draw(**kwargs)¶
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)¶
Draw the adjacency matrix of a CV graph state with matplotlib.
See flamingpy.utils.viz.plot_mat_heat_map for more details.
- hom_outcomes(inds=None, quad='p')¶
array: quad-homodyne measurement outcomes for modes inds.
- inner_decoder()¶
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 0x7F02CFAEC900)¶
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 0x7F02CFAEC4A0)¶
Measure the syndrome for memory-mode error correction of the grpah states.
- populate_states(rng=Generator(PCG64) at 0x7F02CFAEC120)¶
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.