GithubHelp home page GithubHelp logo

quantumcomputing's Introduction

QuantumComputing

Wrapper for the Java Strange Quantum Computing API to allow larger scale programs to be developed Working on allowing integregation with the IBM Qisket so one can execute the Quantum program's developed in Java on a real quantum computer. Also working on being able to create Qisket python scripts from the Strange Quantum Circuit and vice versa.

HOW TO USE: You can extend the class QuantumEnvironment to allow methods to be called easily from it

Examples:

public class Example extends QuantumEnvironment {

//Limited documentation available in the QuantumEnvironment class file about the different operations that can
//be performed.

public static void main(String[] args) throws Exception {

    for(int i = 0; i < 4; ++i){
        //Basic Quantum Circuit
        System.out.println("Basic Quantum Circuit #" + i + " Result:" + myBasicCircuit(.3d));
    }

    //Stored Quantum Circuit example
    QBit b = new QBit();
    for(int i = 2; i < 5; ++i){
        Circuit c = myCircuitExample(PI / i);
        //Apply the circuit to a qubit
        b.applyCircuit(c);
    }
    //Alternate way to measure
    System.out.println("Stored Quantum Circuit Example Result:" + b.measure() + " Circuit Size:" + steps(b));

    /*
    //Keeps the quantum sim initialized so that it may execute a lot faster for certain problems
    //Note that the randomness might not occur depending on the problem
   // QuantumExecutor executor = myStoredCircuitExample(new QBit());
    for(int i = 0; i < 3; ++i){
        //System.out.println(executor.measure()[0]);
    }*/
}

public static QuantumExecutor myStoredCircuitExample(QBit b) throws Exception{
    for(int i = 2; i < 5; ++i){
        Circuit c = myCircuitExample(PI / i);
        //Apply the circuit to a qubit
        //All operations return an operation object which can do further operations such as repeat n times
        b.applyCircuit(c).repeat(2);
    }
    return store(b);
}

public static Circuit myCircuitExample(double theta) throws Exception {
    QBit parameterQBit = new QBit();
    h(parameterQBit);
    ry(theta, parameterQBit);
    return build("My Simple Circuit", parameterQBit);
}

public static boolean myBasicCircuit(double d) throws Exception {
    QBit bit = new QBit();
    QBit bit2 = new QBit(d);
    x(bit);
    h(bit);
    y(bit);
    cx(bit, bit2);
    return measure(bit2);
}

}

quantumcomputing's People

Contributors

hyperspherestudio avatar

Stargazers

 avatar

Watchers

 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.