q

package module
v0.0.0-...-c1fb209 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2019 License: GPL-3.0 Imports: 4 Imported by: 0

README

q

Build Status GoDoc codecov

  • quantum computation simulator
  • pure golang implementation
  • no external library used

example

in the example folder

  • bell state
  • quantum teleportation
  • fatoring 15
  • Grover's search algorithm
  • error correction

Reference

  1. Michael A. Nielsen, Issac L. Chuang, Quantum Computation and Quantum Information
  2. C. Figgatt, D. Maslov, K. A. Landsman, N. M. Linke, S. Debnath, and C. Monroe, Complete 3-Qubit Grover Search on a Programmable Quantum Computer

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Q

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

Q type implements qubit pointer.

func New

func New() *Q

New creates a new qbit.

func (*Q) Apply

func (q *Q) Apply(mat matrix.Matrix, input ...*Qubit) *Q

func (*Q) CNOT

func (q *Q) CNOT(control *Qubit, target *Qubit) *Q

func (*Q) CR

func (q *Q) CR(control *Qubit, target *Qubit, k int) *Q

func (*Q) CZ

func (q *Q) CZ(control *Qubit, target *Qubit) *Q

func (*Q) ConditionX

func (q *Q) ConditionX(condition bool, input ...*Qubit) *Q

func (*Q) ConditionZ

func (q *Q) ConditionZ(condition bool, input ...*Qubit) *Q

func (*Q) ControlledNot

func (q *Q) ControlledNot(control []*Qubit, target *Qubit) *Q

func (*Q) ControlledR

func (q *Q) ControlledR(control []*Qubit, target *Qubit, k int) *Q

func (*Q) ControlledZ

func (q *Q) ControlledZ(control []*Qubit, target *Qubit) *Q

func (*Q) Estimate

func (q *Q) Estimate(input *Qubit, loop ...int) *qubit.Qubit

func (*Q) H

func (q *Q) H(input ...*Qubit) *Q

H applies the Hadamard gate to the qbit.

func (*Q) InverseQFT

func (q *Q) InverseQFT() *Q

func (*Q) Measure

func (q *Q) Measure(input ...*Qubit) *qubit.Qubit

Measure measures the qbit level.

func (*Q) New

func (q *Q) New(z ...complex128) *Qubit

New returns the pointer to the qbit.

func (*Q) One

func (q *Q) One() *Qubit

One assigns 1 to the qbit.

func (*Q) Probability

func (q *Q) Probability() []float64

func (*Q) QFT

func (q *Q) QFT() *Q

func (*Q) S

func (q *Q) S(input ...*Qubit) *Q

func (*Q) Swap

func (q *Q) Swap(q0, q1 *Qubit) *Q

func (*Q) T

func (q *Q) T(input ...*Qubit) *Q

func (*Q) X

func (q *Q) X(input ...*Qubit) *Q

func (*Q) Y

func (q *Q) Y(input ...*Qubit) *Q

func (*Q) Z

func (q *Q) Z(input ...*Qubit) *Q

func (*Q) Zero

func (q *Q) Zero() *Qubit

Zero assigns 0 to the qbit.

type Qubit

type Qubit struct {
	Index int
}

Qubit implements qubit reppresentation.

Jump to

Keyboard shortcuts

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