State and StateVector

class perceval.utils.statevector.AnnotatedBasicState(bs, photon_annotations=None)

Extends BasicState with annotations

clear()

Clear all annotations on current Basic States

Return type

AnnotatedBasicState

Returns

returns the current cleared object

get_mode_annotations(k)

Retrieve annotations of the photons in the given mode

Parameters

k (int) – the mode

Return type

Tuple[Annotations]

Returns

tuple annotation list

get_photon_annotations(pk)

Retrieve annotations of the k-th photon

Parameters

pk (int) – the photon 1-based index

Return type

Annotations

Returns

tuple annotation list

property has_annotations: bool

True is the BasicState uses annotations

Return type

bool

partition(distribution_photons)

Given a distribution of photon, find all possible partition of the state

Parameters

distribution_photons (List[int]) –

Returns

separate_state()

Separate an AnnotatedBasicState on states with indistinguishable photons

Return type

List[AnnotatedBasicState]

Returns

list of AnnotatedBasicState - might be the current state.

set_photon_annotations(pk, annots)

Set annotations of the k-th photon (1-based index)

Parameters
  • pk (int) – the photon 1-based index

  • annots (Union[Dict, Annotations]) – the annotations

Return type

None

class perceval.utils.statevector.Annotations(annots)

Photon annotations

class perceval.utils.statevector.BasicState(*args, **kwargs)

Basic states

class perceval.utils.statevector.SVDistribution(sv=None)

Time-Independent Probabilistic distribution of StateVectors

sample(k=1, non_null=True)

Generate a sample StateVector from the SVDistribution

Parameters
  • non_null (bool) – excludes null states from the sample generation

  • k (int) – number of samples to draw

Return type

List[StateVector]

Returns

if \(k=1\) a single sample, if \(k>1\) a list of \(k\) samples

class perceval.utils.statevector.SVTimeSequence

Sequence in time of state-vector

class perceval.utils.statevector.StateVector(bs=None, photon_annotations=None)

A StateVector is a (complex) linear combination of annotated Basic States

property n

list the possible values of n in the different states

perceval.utils.statevector.convert_polarized_state(state, use_symbolic=False, inverse=False)

Convert a polarized basic state into an expanded state vector

Parameters
Return type

Tuple[BasicState, Matrix]

Returns