Errors – Quantum errors in channels

class squanch.errors.QError(qchannel)[source]

Bases: object

A generalized quantum error model

__init__(qchannel)[source]

Base initialization class; extend in child methods by overwriting along with QError.__init__(self, qchannel)

Parameters:qchannel – the quantum channel this error model is being used on
__weakref__

list of weak references to the object (if defined)

apply(qubit)[source]

Applies the error to the transmitted qubit. Overwrite this method in child classes while maintaining the Qubit->(Qubit | None) signature

Parameters:qubit (Qubit) – the qubit being withdrawn from the quantum channel with channel.get(); possibly None
Returns:the modified qubit
class squanch.errors.AttenuationError(qchannel, attenuation_coefficient=-0.16)[source]

Bases: squanch.errors.QError

Simulate the possible loss of a qubit in a fiber optic channel due to attenuation effects

__init__(qchannel, attenuation_coefficient=-0.16)[source]

Instatiate the error class

Parameters:
  • qchannel (QChannel) – parent quantum channel
  • attenuation_coefficient (float) – attenuation of fiber in dB/km; default: -.16 dB/km, from Yin, et al
apply(qubit)[source]

Simulates possible loss + measurement of qubit

Parameters:qubit (Qubit) – qubit from quantum channel
Returns:either unchanged qubit or None
class squanch.errors.RandomUnitaryError(qchannel, variance)[source]

Bases: squanch.errors.QError

Simualates a random rotation along X and Z with a Gaussian distribution of rotation angles

__init__(qchannel, variance)[source]

Instatiate the error class

Parameters:
  • qchannel (QChannel) – parent quantum channel
  • variance (float) – variance to use in the Gaussian sampling of X and Z rotation angles
apply(qubit)[source]

Simulates random rotations on X and Z of a qubit

Parameters:qubit (Qubit) – qubit from quantum channel
Returns:rotated qubit
class squanch.errors.SystematicUnitaryError(qchannel, operator=None, variance=None)[source]

Bases: squanch.errors.QError

Simulates a random unitary error that is the same for each qubit

__init__(qchannel, operator=None, variance=None)[source]

Instantiate the systematic unitary error class

Parameters:
  • qchannel (QChannel) – parent quantum channel
  • operator (np.array) –
  • variance (float) –
apply(qubit)[source]

Simulates the application of the unitary error

Parameters:qubit (Qubit) – qubit from quantum channel
Returns:rotated qubit