/classiq-models

Jupyter notebooks, qmods and applications

Primary LanguageJupyter Notebook

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]
    AWS[AWS Braket]
    Azure[Azure Quantum]
    Nvidia[Nvidia]


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




Loading


⚛️ 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,
    QInt,
    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[QInt]) -> None:
    a = QInt("a")
    b = QInt("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