utils module

utils.analytical_distilled_fidelity(fidelity, n)[source]

Calculate the upper bound of fidelity after entanglement distillation.

Parameters:
  • fidelity (float) – Initial fidelity of a single qubit.

  • n (int) – Number of qubits used for entanglement distillation.

Returns:

Fidelity after entanglement distillation.

Return type:

float

utils.find_minimum_ebits(fidelity, target_fidelity)[source]

Calculate the minimum number of ebits required to reach the target fidelity.

Parameters:
  • fidelity (float) – Initial fidelity of a single qubit (must be > 0.5).

  • target_fidelity (float) – Target fidelity to achieve (must be > fidelity).

Returns:

Minimum number of ebits required.

Return type:

float

utils.flush_port(port)[source]

Receive and drop all messages in a port’s queue

Parameters:

port (netsquid.components.component.Port) – The port to be flushed

utils.get_fidelities(alice, bob, qid_1=1, qid_2=1)[source]

Calculate the fidelities of entangled qubits for Alice and Bob.

Parameters:
  • alice (QPUNode) – The QPU entity representing Alice.

  • bob (QPUNode) – The QPU entity representing Bob.

Returns:

A tuple containing: - status (bool): True if both Alice and Bob have valid qubits, False otherwise. - fidelity (float): Fidelity of the Bell state |B00>.

Return type:

tuple

utils.loss_prob(decibels)[source]

Convert signal loss in decibels (dB) to a probability.

Parameters:

decibels (float) – Signal loss in decibels.

Returns:

Probability of signal loss (value between 0 and 1).

Return type:

float

utils.time_to_fidelity(success_probability, time_to_ebit, distillation_ebits)[source]

Calculate the time (in nanoseconds) needed to get the distillation ebit fidelity. This is based on analytical estimations of distillation efficiency.

Parameters:
  • success_probability (float) – Probability of distillation success, between 0 and 1.

  • time_to_ebit (float) – Average time (in nanoseconds) needed to establish an entangled bit

  • distillation_ebits (int) – Number of entangled bits used to perform distillation in parallel

Returns:

Time estimation in nanoseconds

Return type:

float