qns.models.epr package

Submodules

qns.models.epr.bell module

class qns.models.epr.bell.BellStateEntanglement(fidelity: float = 1, name: str | None = None, p_swap: float = 1)[source]

Bases: BaseEntanglement, QuantumModel

BellStateEntanglement is the ideal max entangled qubits. Its fidelity is always 1.

distillation(epr: BellStateEntanglement)[source]

Use self and epr to perfrom distillation and distribute a new entanglement

Parameters:

epr (BaseEntanglement) – another entanglement

Returns:

the new distributed entanglement

store_error_model(t: float | None = 0, decoherence_rate: float | None = 0, **kwargs)[source]

The default error model for storing this entangled pair in a quantum memory. The default behavior is doing nothing

Parameters:
  • t – the time stored in a quantum memory. The unit it second.

  • decoherence_rate (float) – the decoherence_rate

  • kwargs – other parameters

swapping(epr: BellStateEntanglement)[source]

Use self and epr to perfrom swapping and distribute a new entanglement

Parameters:

epr (BaseEntanglement) – another entanglement

Returns:

the new distributed entanglement

transfer_error_model(length: float, decoherence_rate: float | None = 0, **kwargs)[source]

The default error model for transmitting this entanglement. The default behavior is doing nothing

Parameters:
  • length (float) – the length of the channel

  • decoherence_rate (float) – the decoherency rate

  • kwargs – other parameters

qns.models.epr.entanglement module

class qns.models.epr.entanglement.BaseEntanglement(fidelity: float = 1, name: str | None = None)[source]

Bases: object

This is the base entanglement model

distillation(epr: BaseEntanglement) BaseEntanglement[source]

Use self and epr to perfrom distillation and distribute a new entanglement

Parameters:

epr (BaseEntanglement) – another entanglement

Returns:

the new distributed entanglement

swapping(epr: BaseEntanglement) BaseEntanglement[source]

Use self and epr to perfrom swapping and distribute a new entanglement

Parameters:

epr (BaseEntanglement) – another entanglement

Returns:

the new distributed entanglement

teleportion(qubit: Qubit) Qubit[source]

Use self and epr to perfrom distillation and distribute a new entanglement

Parameters:

epr (BaseEntanglement) – another entanglement

Returns:

the new distributed entanglement

to_qubits() List[Qubit][source]

Transport the entanglement into a pair of qubits based on the fidelity. Suppose the first qubit is [1/sqrt(2), 1/sqrt(2)].H

Returns:

A list of two qubits

qns.models.epr.mixed module

class qns.models.epr.mixed.MixedStateEntanglement(fidelity: float = 1, b: float | None = None, c: float | None = None, d: float | None = None, name: str | None = None)[source]

Bases: BaseEntanglement, QuantumModel

MixedStateEntanglement is a pair of entangled qubits in mixed State with a hidden-variable. rho = A * Phi^+ + B * Psi^+ + C * Psi^- + D * Phi^-

property a: float

a equals to the fidelity

distillation(epr: MixedStateEntanglement, name: str | None = None)[source]

Use self and epr to perfrom distillation and distribute a new entanglement. Using BBPSSW protocol.

Parameters:
  • epr (BaseEntanglement) – another entanglement

  • name (str) – the name of the new entanglement

Returns:

the new distributed entanglement

normalized()[source]
store_error_model(t: float | None = 0, decoherence_rate: float | None = 0, **kwargs)[source]

The default error model for storing this entangled pair in a quantum memory. The default behavior is:

a = 0.25 + (a-0.25)*e^{decoherence_rate*t} b = 0.25 + (b-0.25)*e^{decoherence_rate*t} c = 0.25 + (c-0.25)*e^{decoherence_rate*t} d = 0.25 + (d-0.25)*e^{decoherence_rate*t}

Parameters:
  • t – the time stored in a quantum memory. The unit it second.

  • decoherence_rate – the decoherence rate, equals to 1/T_coh, where T_coh is the coherence time.

  • kwargs – other parameters

swapping(epr: MixedStateEntanglement, name: str | None = None)[source]

Use self and epr to perfrom swapping and distribute a new entanglement

Parameters:
  • epr (MixedEntanglement) – another entanglement

  • name (str) – the name of the new entanglement

Returns:

the new distributed entanglement

to_qubits() List[Qubit][source]

Transport the entanglement into a pair of qubits based on the fidelity. Suppose the first qubit is [1/sqrt(2), 1/sqrt(2)].H

Returns:

A list of two qubits

transfer_error_model(length: float, decoherence_rate: float | None = 0, **kwargs)[source]

The default error model for transmitting this entanglement. The success possibility of transmitting is:

a = 0.25 + (a-0.25)*e^{decoherence_rate*length} b = 0.25 + (b-0.25)*e^{decoherence_rate*length} c = 0.25 + (c-0.25)*e^{decoherence_rate*length} d = 0.25 + (d-0.25)*e^{decoherence_rate*length}

Parameters:
  • length (float) – the length of the channel

  • decoherence_rate (float) – the decoherency rate

  • kwargs – other parameters

qns.models.epr.werner module

class qns.models.epr.werner.WernerStateEntanglement(fidelity: float = 1, name: str | None = None)[source]

Bases: BaseEntanglement, QuantumModel

WernerStateEntanglement is a pair of entangled qubits in Werner State with a hidden-variable.

distillation(epr: WernerStateEntanglement, name: str | None = None)[source]

Use self and epr to perfrom distillation and distribute a new entanglement. Using Bennett 96 protocol and estimate lower bound.

Parameters:
  • epr (WernerEntanglement) – another entanglement

  • name (str) – the name of the new entanglement

Returns:

the new distributed entanglement

property fidelity: float
store_error_model(t: float, decoherence_rate: float | None = 0, **kwargs)[source]

The default error model for storing this entangled pair in a quantum memory. The default behavior is: w = w*e^{-decoherence_rate*t}, default a = 0

Parameters:
  • t – the time stored in a quantum memory. The unit it second.

  • decoherence_rate – the decoherence rate, equals to 1/T_coh, where T_coh is the coherence time.

  • kwargs – other parameters

swapping(epr: WernerStateEntanglement, name: str | None = None)[source]

Use self and epr to perfrom swapping and distribute a new entanglement

Parameters:
  • epr (WernerEntanglement) – another entanglement

  • name (str) – the name of the new entanglement

Returns:

the new distributed entanglement

to_qubits() List[Qubit][source]

Transport the entanglement into a pair of qubits based on the fidelity. Suppose the first qubit is [1/sqrt(2), 1/sqrt(2)].H

Returns:

A list of two qubits

transfer_error_model(length: float, decoherence_rate: float | None = 0, **kwargs)[source]

The default error model for transmitting this entanglement. The success possibility of transmitting is: w = w* e^{decoherence_rate * length}

Parameters:
  • length (float) – the length of the channel

  • kwargs – other parameters

Module contents

class qns.models.epr.BaseEntanglement(fidelity: float = 1, name: str | None = None)[source]

Bases: object

This is the base entanglement model

distillation(epr: BaseEntanglement) BaseEntanglement[source]

Use self and epr to perfrom distillation and distribute a new entanglement

Parameters:

epr (BaseEntanglement) – another entanglement

Returns:

the new distributed entanglement

swapping(epr: BaseEntanglement) BaseEntanglement[source]

Use self and epr to perfrom swapping and distribute a new entanglement

Parameters:

epr (BaseEntanglement) – another entanglement

Returns:

the new distributed entanglement

teleportion(qubit: Qubit) Qubit[source]

Use self and epr to perfrom distillation and distribute a new entanglement

Parameters:

epr (BaseEntanglement) – another entanglement

Returns:

the new distributed entanglement

to_qubits() List[Qubit][source]

Transport the entanglement into a pair of qubits based on the fidelity. Suppose the first qubit is [1/sqrt(2), 1/sqrt(2)].H

Returns:

A list of two qubits

class qns.models.epr.BellStateEntanglement(fidelity: float = 1, name: str | None = None, p_swap: float = 1)[source]

Bases: BaseEntanglement, QuantumModel

BellStateEntanglement is the ideal max entangled qubits. Its fidelity is always 1.

distillation(epr: BellStateEntanglement)[source]

Use self and epr to perfrom distillation and distribute a new entanglement

Parameters:

epr (BaseEntanglement) – another entanglement

Returns:

the new distributed entanglement

store_error_model(t: float | None = 0, decoherence_rate: float | None = 0, **kwargs)[source]

The default error model for storing this entangled pair in a quantum memory. The default behavior is doing nothing

Parameters:
  • t – the time stored in a quantum memory. The unit it second.

  • decoherence_rate (float) – the decoherence_rate

  • kwargs – other parameters

swapping(epr: BellStateEntanglement)[source]

Use self and epr to perfrom swapping and distribute a new entanglement

Parameters:

epr (BaseEntanglement) – another entanglement

Returns:

the new distributed entanglement

transfer_error_model(length: float, decoherence_rate: float | None = 0, **kwargs)[source]

The default error model for transmitting this entanglement. The default behavior is doing nothing

Parameters:
  • length (float) – the length of the channel

  • decoherence_rate (float) – the decoherency rate

  • kwargs – other parameters

class qns.models.epr.MixedStateEntanglement(fidelity: float = 1, b: float | None = None, c: float | None = None, d: float | None = None, name: str | None = None)[source]

Bases: BaseEntanglement, QuantumModel

MixedStateEntanglement is a pair of entangled qubits in mixed State with a hidden-variable. rho = A * Phi^+ + B * Psi^+ + C * Psi^- + D * Phi^-

property a: float

a equals to the fidelity

distillation(epr: MixedStateEntanglement, name: str | None = None)[source]

Use self and epr to perfrom distillation and distribute a new entanglement. Using BBPSSW protocol.

Parameters:
  • epr (BaseEntanglement) – another entanglement

  • name (str) – the name of the new entanglement

Returns:

the new distributed entanglement

normalized()[source]
store_error_model(t: float | None = 0, decoherence_rate: float | None = 0, **kwargs)[source]

The default error model for storing this entangled pair in a quantum memory. The default behavior is:

a = 0.25 + (a-0.25)*e^{decoherence_rate*t} b = 0.25 + (b-0.25)*e^{decoherence_rate*t} c = 0.25 + (c-0.25)*e^{decoherence_rate*t} d = 0.25 + (d-0.25)*e^{decoherence_rate*t}

Parameters:
  • t – the time stored in a quantum memory. The unit it second.

  • decoherence_rate – the decoherence rate, equals to 1/T_coh, where T_coh is the coherence time.

  • kwargs – other parameters

swapping(epr: MixedStateEntanglement, name: str | None = None)[source]

Use self and epr to perfrom swapping and distribute a new entanglement

Parameters:
  • epr (MixedEntanglement) – another entanglement

  • name (str) – the name of the new entanglement

Returns:

the new distributed entanglement

to_qubits() List[Qubit][source]

Transport the entanglement into a pair of qubits based on the fidelity. Suppose the first qubit is [1/sqrt(2), 1/sqrt(2)].H

Returns:

A list of two qubits

transfer_error_model(length: float, decoherence_rate: float | None = 0, **kwargs)[source]

The default error model for transmitting this entanglement. The success possibility of transmitting is:

a = 0.25 + (a-0.25)*e^{decoherence_rate*length} b = 0.25 + (b-0.25)*e^{decoherence_rate*length} c = 0.25 + (c-0.25)*e^{decoherence_rate*length} d = 0.25 + (d-0.25)*e^{decoherence_rate*length}

Parameters:
  • length (float) – the length of the channel

  • decoherence_rate (float) – the decoherency rate

  • kwargs – other parameters

class qns.models.epr.WernerStateEntanglement(fidelity: float = 1, name: str | None = None)[source]

Bases: BaseEntanglement, QuantumModel

WernerStateEntanglement is a pair of entangled qubits in Werner State with a hidden-variable.

distillation(epr: WernerStateEntanglement, name: str | None = None)[source]

Use self and epr to perfrom distillation and distribute a new entanglement. Using Bennett 96 protocol and estimate lower bound.

Parameters:
  • epr (WernerEntanglement) – another entanglement

  • name (str) – the name of the new entanglement

Returns:

the new distributed entanglement

property fidelity: float
store_error_model(t: float, decoherence_rate: float | None = 0, **kwargs)[source]

The default error model for storing this entangled pair in a quantum memory. The default behavior is: w = w*e^{-decoherence_rate*t}, default a = 0

Parameters:
  • t – the time stored in a quantum memory. The unit it second.

  • decoherence_rate – the decoherence rate, equals to 1/T_coh, where T_coh is the coherence time.

  • kwargs – other parameters

swapping(epr: WernerStateEntanglement, name: str | None = None)[source]

Use self and epr to perfrom swapping and distribute a new entanglement

Parameters:
  • epr (WernerEntanglement) – another entanglement

  • name (str) – the name of the new entanglement

Returns:

the new distributed entanglement

to_qubits() List[Qubit][source]

Transport the entanglement into a pair of qubits based on the fidelity. Suppose the first qubit is [1/sqrt(2), 1/sqrt(2)].H

Returns:

A list of two qubits

transfer_error_model(length: float, decoherence_rate: float | None = 0, **kwargs)[source]

The default error model for transmitting this entanglement. The success possibility of transmitting is: w = w* e^{decoherence_rate * length}

Parameters:
  • length (float) – the length of the channel

  • kwargs – other parameters