qubit

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2025 License: 0BSD Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Qubit

type Qubit struct {
	Zero complex128
	One  complex128
}

func New

func New(zero complex128, one complex128) Qubit

Creates a new qubit with the coefficients of |0> and |1> as inputs. If it is not normalised, an error will be returned.

func (*Qubit) IsNormalised added in v0.1.1

func (q *Qubit) IsNormalised() bool

func (*Qubit) ProbabilityZero

func (q *Qubit) ProbabilityZero() float64

Returns the probability of the qubit returning zero when measured. This should be used with a random number generator between 0.0 and 1.0 to set the threshold. Below that threshold, 0 is returned, and above it, 1.

func (Qubit) String added in v0.1.1

func (q Qubit) String() string

Jump to

Keyboard shortcuts

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