State Generator
- class perceval.utils.stategenerator.StateGenerator(encoding, polarization_base=(|{P:H}>, |{P:V}>))
StateGenerator class for conveniently generating common complex StateVectors
- Parameters:
encoding – for specifying the output format of the StateVector supported are Encoding.RAW, Encoding.DUAL_RAIL, Encoding.POLARIZATION
polarization_base – (optional) you can provide your own polarization basis as a tuple of BasicStates. default=(BasicState(”|{P:H}>”), BasicState(”|{P:V}>”)
- bell_state(state)
Generate a StateVector representing a Bell state
- Parameters:
state (
str
) –name of the bell state you want to generate:
”phi+” = (|0,0>+|1,1>)/sqrt(2)
”phi-” = (|0,0>-|1,1>)/sqrt(2)
”psi+” = (|0,1>+|1,0>)/sqrt(2)
”psi-” = (|0,1>-|1,0>)/sqrt(2)
- Returns:
StateVector for a bell state
- dicke_state(n, k=None)
Get the Dicke state |D(n,k)> which is the equal superposition state of all C(n,k) basis states of weight k
- Mode number:
For RAW and Polarization: n
For Dual rail encoding: 2*n
- Photon number:
For Raw encoding: k
For Dual rail and Polarization encoding: n
- Parameters:
n (
int
) – Number of qubits equal to |1>_L or photonsk (
Optional
[int
]) – Weight (Number of qubits or modes)
- Return type:
StateVector
- Returns:
Dicke state vector
- ghz_state(n)
Generate a StateVector representing a (generalized) Greenberger-Horne-Zeilinger state
- Parameters:
n (
int
) – order of the GHZ state- Returns:
StateVector representing the GHZ state
- graph_state(graph)
Generate a StateVector representing a graph state.
- Parameters:
graph (
Graph
) – networkx.Graph object. Edge weights are ignored.- Returns:
StateVector representing the graph state
- logical_state(state)
Generate a StateVector from a list of logical state
- Parameters:
state (
List
[int
]) – list of bits- Returns:
StateVector representing the logical state