Skip to content

c0nrad/qrad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qrad Quantum Computing Simulator

qrad is a quantum simulator heavily based on Quantum Computing for Computer Scientist, Quantum Computing for the Determined, with inspiration from quirk, qiskit, and cirq.

It doesn't do anything particularly unique/special. It's just a tool for me to learn how quantum algorithms work. Written in Go.

Quantum Fourier Transform

Algorithms

  • Bell: Create the bell states
  • Superdense: Transmit two bits of classical information in one entangled qubit
  • Teleportation: Move the state of a qubit to another qubit (destroying the original qubit in the process)
  • Deutsch-Josza: Determine if a blackbox function is balanced/constant
  • Quantum Fourier Transform: Take the QFT/iQFT of some qubits with a neat interface
  • Shor's Algorithm: A specific case of shor's for factoring 15 with co-prime 2.

Example

c := qrad.NewCircuit([]int{0, 0, 0, 0})
c.Append(qrad.H, []int{0, 1, 2, 3})

v := float64(13)

c.Append(qrad.ROT(v*math.Pi/8, "13PI/8"), []int{0})
c.Append(qrad.ROT(v*math.Pi/4, "13PI/4"), []int{1})
c.Append(qrad.ROT(v*math.Pi/2, "13PI/2"), []int{2})
c.Append(qrad.ROT(v*math.Pi, "13PI"), []int{3})

c.AppendBarrier()

qrad.ApplyInverseQFT(c, 0, 3)
c.Execute()
if c.Measure() != 13 {
    panic("Circuit should have measured 13")
}

Blog Posts

License

Copyright 2020 Stuart Larsen

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Quantum Computation Simulator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published