Coder Social home page Coder Social logo

hdwquantum's Introduction

HDWQuantum

Very basic quantum computer simulation in Ruby, can be used for arbitrary complex quantum computation simulations. Not very fast, however.

Instructions and informations

See 'HDWQuantumTest.rb' for a simple example. Initialize a quantum register with the 'Quantum_Register' class by using:

  • qreg = Quantum_Register.new(size, state)

Here, size is the number of qubits in the register and state the initial state as a binary number. You can apply quantum operations using:

  • qreg.apply_one_qubit_gate(gate, bit)
  • qreq.apply_two_qubit_gate(gate, first bit, second bit)
  • ...

The gate can be any fitting gate (see 'HDWQuantum.rb' for a list), and the bits are the qubit positions (highest binary bit is defined as 1). A measurement can be done with:

  • qreq.measure

And you can cheat by yielding the state vector by:

  • qreg.output_state_vector

However, this would not be possible on a real quantum computer and is only helpful for debugging or obtaining a probability table.

What can be done?

Anything you want! Implement own gates by extending the 'Quantum_Gate' module, play around with them, or try to implement special algorithms! Technically, this simulation should be quantum Turing complete ;-). This project was done by me some time ago as a base for a quantum poker game, which I eventually abandoned. Maybe you want to do something like that? It's Ruby code, but porting it to C or any other programming language should not prove too difficult.

hdwquantum's People

Contributors

hadeweka avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.