Memory
Models for simulation of quantum memories.
This module defines the Memory class to simulate single atom memories as well as the MemoryArray class to aggregate memories. Memories will attempt to send photons through the send_qubit interface of nodes. Photons should be routed to a BSM device for entanglement generation, or through optical hardware for purification and swapping.
- class sequence.components.memory.AbsorptiveMemory(name: str, timeline: Timeline, frequency: float, absorption_efficiency: float, afc_efficiency: Callable, mode_number: int, wavelength: int, prepare_time: int = 0, afc_lifetime: float = -1, coherence_time: float = -1, fidelity: float = 1, overlap_error: float = 0, is_spinwave=False, is_reversed=False, destination=None, spin_efficiency=<function const>)
Atomic ensemble absorptive memory.
This class models an AFC(-spinwave) absorptive memory, where the quantum state is stored as collective excitation of atomic ensemble. Rephasing time (predetermined storage time for AFC type) is given by temporal mode number and length of each temporal mode bin. This class does not support qubit state manipulation, individual photons should be manipulated instead.
Before invoking methods like “get” and “retrieve”, need to call “prepare” first to prepare the AFC, will take finite simulation time. Retrieved photon sequence might be reversed (only for AFC-spinwave), which is physically determined by RF pulses used during spinwave. Note that for AFC (not spinwave) type, is_reversed must be False.
Note that the memory is reusable (available for other rounds of absorption) as long as AFC structure is still usable. Once AFC structure expires the memory also expires, and the memory needs to be re-prepared so stored photons cannot be retrieved. Spinwave coherence time determines whether a certain cycle of absorption and re-emission will be successful. Eg. If on-demand storage time is longer than spinwave coherence time, the information stored in this cycle will be cleared.
However, if the AFC structure retains usability (in this example AFC_lifetime > coherence_time), the memory itself is not expired.
- name
label for memory instance.
- Type:
str
- fidelity
(current) fidelity of memory’s entanglement.
- Type:
float
- frequency
maximum frequency of absorption for memory (total frequency bandwidth of AFC memory) (in Hz).
- Type:
float
- absorption_efficiency
probability of absorbing a photon when arriving at the memory.
- Type:
float
- afc_efficiency
probability of emitting a photon as a function of AFC re-emission time of optical AFC.
- Type:
Callable
- spin_efficiency
effeciency of spinwave storage as a function of storage time.
- Type:
Callable
- mode_number
number of temporal modes available for storing photons, i.e. number of peaks in Atomic Frequency Comb.
- Type:
int
- mode_bin
- Type:
int
- afc_lifetime
average usable lifetime of AFC structure (in s), 0 means infinite lifetime.
- Type:
float
- coherence_time
average usable lifetime of spinwave storage (spinwave transition coherence time) (in s), 0 means infinite coherence time.
- Type:
float
- wavelength
wavelength (in nm) of absorbed and emitted photons.
- Type:
float
- total_time
AFC re-phasing time (in ps)
- Type:
float
- overlap_error
error due to photon overlap in one temporal mode, will degrade fidelity.
- Type:
float
- prepare_time
time to prepare AFC (in ps).
- Type:
float
- photon_counter
counts number of detection events.
- Type:
int
- absorb_start_time
start time (in ps) of photon absorption.
- Type:
int
- retrieve_start_time
start time (in ps) of photon retrieval.
- Type:
int
- is_spinwave
determines if the memory is AFC or AFC-spinwave, default False.
- Type:
Bool
- is_reversed
determines re-emission sequence, physically determined by RF pulses during spinwave, default False.
- Type:
Bool
- is_prepared
determines if AFC is successfully prepared.
- Type:
Bool
- memory_array
memory array aggregating current memory.
- Type:
- destination
name of predetermined re-emission destination node, default None.
- Type:
str
- entangled_memory
tracks entanglement state of memory with a memory.
- Type:
dict[str, Any]
- stored_photons
photons stored in memory temporal modes.
- Type:
list[dict]
- detach(observer: EntanglementProtocol)
Method to remove an observer.
- expire() None
Method to handle memory expiration due to AFC expiration.
- Side Effects:
Will notify upper entities of expiration via the pop interface. Will modify information stored by the memory.
- get_expire_time() int
Method to get the simulation time when the memory is expired
- init()
Implementation of Entity interface (see base class).
- notify(msg: dict[str, Any])
Method to notify all attached observers of an update.
- prepare()
Method to emulate the effect on timeline by AFC preparation.
Will schedule a preparation event in the future, after which is_prepared is set to true.
- reset() None
Method to clear quantum memory.
Will reset memory state to no photon stored and will clear entanglement information. Will reset AFC to unprepared state.
- Side Effects:
Will modify internal parameters and photon storage information.
- retrieve(dst='')
Method to re-emit all stored photons in normal/reverse sequence on demand.
Efficiency is a function of time.
- set_memory_array(memory_array: MemoryArray)
Method to set the memory array to which the memory belongs
- Parameters:
memory_array (MemoryArray) – memory array to which the memory belongs
- storage_reset() None
Method to clear information stored in one cycle of photon storage.
- update_expire_time(time: int)
Method to change time of expiration.
Should not normally be called by protocols.
- Parameters:
time (int) – new expiration time.
- class sequence.components.memory.Memory(name: str, timeline: Timeline, fidelity: float, frequency: float, efficiency: float, coherence_time: float, wavelength: int, decoherence_errors: list[float] = None, cutoff_ratio: float = 1, cutoff_flag: bool = True)
Individual single-atom memory.
This class models a single-atom memory, where the quantum state is stored as the spin of a single ion. This class will replace the older implementation once completed.
- name
label for memory instance.
- Type:
str
- fidelity
(current) fidelity of memory.
- Type:
float
- raw_fidelity
(initial) fidelity of memory.
- Type:
float
- frequency
maximum frequency at which memory can be excited.
- Type:
float
- efficiency
probability of emitting a photon when excited.
- Type:
float
- coherence_time
average usable lifetime of memory (in seconds). Negative value means infinite coherence time.
- Type:
float
- wavelength
wavelength (in nm) of emitted photons.
- Type:
float
- qstate_key
key for associated quantum state in timeline’s quantum manager.
- Type:
int
- memory_array
memory array aggregating current memory.
- Type:
- entangled_memory
tracks entanglement state of memory.
- Type:
dict[str, Any]
- docoherence_errors
assumeing the memory (qubit) decoherence channel being Pauli channel, Probability distribution of X, Y, Z Pauli errors; (default value is -1, meaning not using BDS or further density matrix representation) Question: is it general enough? Dephasing/damping channel, multipartite entanglement?
- Type:
list[float]
- cutoff_ratio
ratio between cutoff time and memory coherence time (default 1, should be between 0 and 1).
- Type:
float
- generation_time
time when the EPR is first generated (float or int depends on timeing unit) (default -1 before generation or not used). Used only for logging
- Type:
float
- last_update_time
last time when the EPR pair is updated (usually when decoherence channel applied), used to determine decoherence channel (default -1 before generation or not used)
- Type:
float
- is_in_application
whether the quantum memory is involved in application after successful distribution of EPR pair
- Type:
bool
- bds_decohere() None
Method to decohere stored BDS in quantum memory according to the single-qubit Pauli channels.
During entanglement distribution (before application phase), BDS decoherence can be treated analytically (see entanglement purification paper for explicit formulae).
- Side Effects:
Will modify BDS diagonal elements and last_update_time.
- detach(observer: EntanglementProtocol | MemoryArray)
Method to remove an observer.
- excite(dst='', protocol='bk') None
Method to excite memory and potentially emit a photon.
If it is possible to emit a photon, the photon may be marked as null based on the state of the memory.
- Parameters:
dst (str) – name of destination node for emitted photon (default “”).
protocol (str) – Valid values are “bk” (for Barrett-Kok protocol) or “sh” (for single heralded)
- Side Effects:
May modify quantum state of memory. May schedule photon transmission to destination node.
- expire() None
Method to handle memory expiration.
Is scheduled automatically by the set_plus memory operation.
- If the quantum memory has been explicitly involved in application after entanglement distribution, do not expire.
Some simplified applications do not necessarily need to modify the is_in_application attribute. Some more complicated applications, such as probe state preparation for distributed quantum sensing, may change is_in_application attribute to keep memory from expiring during study.
- Side Effects:
Will notify upper entities of expiration via the pop interface. Will modify the quantum state of the memory.
- get_bds_fidelity() float
Will get the fidelity from the BDS state
- Returns:
the fidelity of the BDS state
- Return type:
(float)
- get_bds_state()
Method to get state of memory in BDS formalism.
Will automatically call the bds_decohere method.
- init()
Method to initialize entity (abstract).
Entity init methods are invoked for all timeline entities when the timeline is initialized. This method can be used to perform any necessary functions before simulation.
- notify(msg: dict[str, Any])
Method to notify all attached observers of an update.
- reset() None
Method to clear quantum memory.
Will reset quantum state to |0> and will clear entanglement information.
- Side Effects:
Will modify internal parameters and quantum state.
- update_expire_time(time: int)
Method to change time of expiration.
Should not normally be called by protocols.
- Parameters:
time (int) – new expiration time.
- update_state(state: list[complex]) None
Method to set the memory state to an arbitrary pure state.
- Parameters:
state (list[complex]) – array of amplitudes for pure state in Z-basis.
- Side Effects:
Will modify internal quantum state and parameters. May schedule expiration event.
- class sequence.components.memory.MemoryArray(name: str, timeline: Timeline, num_memories=10, fidelity=0.85, frequency=80000000.0, efficiency=1, coherence_time=-1, wavelength=500, decoherence_errors: list[float] = None, cutoff_ratio: float = 1, cutoff_flag: bool = True)
Aggregator for Memory objects.
Equivalent to an array of single atom memories. The MemoryArray can be accessed as a list to get individual memories.
- name
label for memory array instance.
- Type:
str
- add_receiver(receiver: Entity) None
Add receiver to each memory in the memory array to receive photons.
- Parameters:
receiver (Entity) – receiver of the memory
- get_memory_by_name(name: str) Memory
Given the memory’s name, get the memory object.
- Parameters:
name (str) – name of memory
- Returns:
the memory object
- Return type:
(Memory)
- init()
Implementation of Entity interface (see base class).
Set the owner of memory as the owner of memory array.
- class sequence.components.memory.MemoryWithRandomCoherenceTime(name: str, timeline: Timeline, fidelity: float, frequency: float, efficiency: float, coherence_time: float, coherence_time_stdev: float, wavelength: int)
Individual single-atom memory.
This class inherits Memory class and provides possibility to use stochastic model of coherence time. This means that loss of entanglement of the memory with a photon occurs at random time given by truncated normal distribution with average value set by ‘coherence_time’ input parameter and with standard deviation set by ‘coherence_time_stdev’ input parameter. If coherence_time_stdev <= 0.0 is passed, the class behaves exactly as original Memory class.
- name
label for memory instance.
- Type:
str
- fidelity
(current) fidelity of memory.
- Type:
float
- frequency
maximum frequency at which memory can be excited.
- Type:
float
- efficiency
probability of emitting a photon when excited.
- Type:
float
- coherence_time
average usable lifetime of memory (in seconds).
- Type:
float
- coherence_time_stdev
standard deviation of coherence time
- Type:
float
- wavelength
wavelength (in nm) of emitted photons.
- Type:
float
- qstate_key
key for associated quantum state in timeline’s quantum manager.
- Type:
int
- entangled_memory
tracks entanglement state of memory.
- Type:
dict[str, Any]
- sequence.components.memory.const(t)
Constant function thal always returns 1. For AFC memory default spin efficiency.