photon

package
v0.0.0-...-a5cfb8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package photon provides utilities for handling photon-encoded qubits.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSimulatedChannel

func NewSimulatedChannel(pMain, muLo, muMed, muHi, pLo, pMed, pHi float64,
	sendRand, receiveRand *rand.Rand) (*SimulatedSender, *SimulatedReceiver)

NewSimulatedChannel creates a pair of (Sender, Receiver) structs simulating a Quantum channel. It is expected that each call to Send() will be mirrored by a call to Receive(). Expect errors if that is not the case, and for calls to Send() to hang if more than 1 of them are made before a Receive().

Types

type Receiver

type Receiver interface {
	// Next returns the results of sending the next batch of qbits:
	//  - bits contains the logical bit values sent/received
	//  - bases specifies whether the "main" basis was used (0) or the "test"
	//    basis (1), as in basis-biased BB84. For efficient qbit usage, the
	//    ratio of 0s to 1s should be high.
	//  - dropped provides a bitmask indicating which pulses we failed to detect
	//    at all.
	Next(bytes int) (bits, bases, dropped []byte, err error)
}

A Receiver receives linearly-polarized photons and decodes them in a given measurement basis.

type Sender

type Sender interface {
	// Next returns the results of sending the next batch of qbits:
	//  - bits contains the logical bit values sent/received
	//  - bases specifies whether the "main" basis was used (0) or the "test"
	//    basis (1), as in basis-biased BB84. For efficient qbit usage, the
	//    ratio of 0s to 1s should be high.
	//  - lo, med, and hi provide bitmasks which indicate the pulse strength
	//    used to send the corresponding qbit.
	Next(bytes int) (bits, bases, lo, med, hi []byte, err error)
}

A Sender sends qubits encoded as linearly-polarized photons to a Receiver.

type SimulatedReceiver

type SimulatedReceiver struct {
	Errors []byte
	Drops  []byte
	// contains filtered or unexported fields
}

func (*SimulatedReceiver) Next

func (sr *SimulatedReceiver) Next(bytes int) (bits, bases, dropped []byte, err error)

type SimulatedSender

type SimulatedSender struct {
	// contains filtered or unexported fields
}

func (*SimulatedSender) Next

func (ss *SimulatedSender) Next(bytes int) (bits, bases, lo, med, hi []byte, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL