GithubHelp home page GithubHelp logo

mistershashanksingh / classiq-library Goto Github PK

View Code? Open in Web Editor NEW

This project forked from classiq/classiq-library

0.0 0.0 0.0 14.8 MB

Jupyter notebooks, qmods and applications

Jupyter Notebook 99.99% OpenQASM 0.01%

classiq-library's Introduction

Create Quantum Programs with Classiq

The Classiq platform is all you need for creating any quantum program. Read more for the details.

flowchart
    IDEInput[<a href='https://platform.classiq.io/'>Classiq IDE</a>]

    SDKInput[<a href='https://docs.classiq.io/latest/getting-started/python-sdk/'>Classiq python SDK</a>]

    Model[<a href='https://docs.classiq.io/latest/user-guide/platform/qmod/'>Quantum Model</a>]

    Synthesis[<a href='https://docs.classiq.io/latest/user-guide/platform/synthesis/'>Synthesis Engine</a>]

    QuantumProgram[Quantum Program]

    Execution[<a href='https://docs.classiq.io/latest/user-guide/platform/executor/'>Execution</a>]

    Analyze[<a href='https://docs.classiq.io/latest/user-guide/platform/analyzer/'>Analyze & Debug</a>]

    ExternalProgram[<a href='https://docs.classiq.io/latest/user-guide/platform/executor/alternative-formats/'>Any Format, e.g QASM</a>]

    IBM[IBM]
    Amazon[Amazon Braket]
    Azure[Azure Quantum]
    Nvidia[Nvidia]


    IDEInput --> Model;
    SDKInput --> Model;
    Model --> Synthesis;
    Synthesis --> QuantumProgram;
    ExternalProgram <--> QuantumProgram;
    QuantumProgram --> Analyze;
    QuantumProgram --> Execution;
    Execution --> IBM
    Execution --> Amazon
    Execution --> Azure
    Execution --> Nvidia






⚛️ Platform  |  👋 Join Slack  |  📖 Documentation   |   Getting Started


Classiq's Github Repository

You can find a wide collection of quantum functions, algorithms, applications and tutorials built with Classiq.

Usage Example - Portfolio Optimization:

Go to the Portfolio optimization directory: applications/finance/portfolio_optimizaition

In the IDE:

  1. Sign up to the classiq platform
  2. Upload the .qmod file to the synthesis tab

In the SDK:

  1. Start with downloading Classiq:
pip install -U classiq
  1. Download the .ipynb file
  2. Run the notebook in your preferred environment

Build Your Own

With Classiq, you can build anything. Classiq provides a powerful modeling language to describe any quantum program, which can then be synthesized and executed on any hardware or simulator. Explore our Documentation to learn everything.

3+5 with Classiq

In the IDE:

  1. Create a model (paste in the model tab)
qfunc get_3(output x: qbit[2]){
allocate<2>(x);
 X(x[0:1]);
 X(x[1:2]);
}

qfunc get_5(output x: qbit[3]){
 allocate<3>(x);
 X(x[0:1]);
 X(x[2:3]);
}

qfunc main(output res: qbit[4]){
 a: qbit[2];
 b: qbit[3];
 get_3(a);
 get_5(b);
 res = a + b;
}
  1. Press Synthesize:

Model_Screenshot_3_plus_5.png

  1. Press Execute:

Program_Screenshot_3_plus_5.png

  1. Press Run:

Execution_Screenshot_3_plus_5.png

  1. View Results:

Jobs_Screenshot_3_plus_5.png

In the SDK:

from classiq import (
    QArray,
    Output,
    allocate,
    QFunc,
    X,
    QNum,
    synthesize,
    create_model,
    show,
    execute,
)


@QFunc
def get_3(x: Output[QArray]) -> None:
    allocate(2, x)
    X(x[0])
    X(x[1])


@QFunc
def get_5(x: Output[QArray]) -> None:
    allocate(3, x)
    X(x[0])
    X(x[2])


@QFunc
def main(res: Output[QNum]) -> None:
    a = QNum("a")
    b = QNum("b")
    get_3(a)
    get_5(b)
    res |= a + b  # should be 8


qprog = synthesize(create_model(main))

show(qprog)
result = execute(qprog).result()
print(result[0].value.parsed_counts)

Have questions? Feedback? Something to share? Welcome to join our open Slack Community

classiq-library's People

Contributors

classiqroi 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.