Skip to main content

"Orquestra's library with code related to variational quantum algorithms."

Project description

orquestra-vqa

What is it?

orquestra-vqa is a library with core functionalities for implementing variational quantum algorithms developed by Zapata for our Orquestra platform.

orquestra-vqa provides:

  • interfaces for implementing ansatzes including qaoa and qcbm.
  • optimizers and cost functions tailored to vqa
  • misc functions such as grouping, qaoa interpolation, and estimators

Installation

Even though it's intended to be used with Orquestra, orquestra-quantum can be also used as a Python module. To install it, make to install its dependencies: orquestra-quantum and orquestra-opt. Then you just need to run pip install . from the main directory.

Usage

Here's an example of how to use methods from orquestra-vqa to create a cost function for qcbm and optimize it using scipy optimizer.

from orquestra.vqa.cost_function.qcbm_cost_function import create_QCBM_cost_function
from orquestra.vqa.ansatz.qcbm import QCBMAnsatz
from orquestra.opt.history.recorder import recorder
from orquestra.quantum.symbolic_simulator import SymbolicSimulator


def orquestra_vqa_example_function()
    ansatz = QCBMAnsatz(1, 4, "all")
    backend = SymbolicSimulator()
    distance_measure_kwargs = {
                "distance_measure": compute_mmd,
                "distance_measure_parameters": {"sigma": 1},
            }
    cost_function = create_QCBM_cost_function(
        ansatz,
        backend,
        10,
        **distance_measure_kwargs,
    )

    optimizer = ScipyOptimizer(method="L-BFGS-B")
    initial_params = np.ones(ansatz.number_of_params) / 5
    opt_results = optimizer.minimize(cost_function, initial_params)

    return opt_results

Development and Contribution

You can find the development guidelines in the orquestra-quantum repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

orquestra-vqa-0.2.0.tar.gz (66.8 kB view details)

Uploaded Source

File details

Details for the file orquestra-vqa-0.2.0.tar.gz.

File metadata

  • Download URL: orquestra-vqa-0.2.0.tar.gz
  • Upload date:
  • Size: 66.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.3

File hashes

Hashes for orquestra-vqa-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1fc075906ad14d5e8843f78c8910b448bcc1070fec9ab7c3bf62f2caab974a73
MD5 8926c22ff4969f7bc0a6d685101d7fe7
BLAKE2b-256 4339cf52cd2a32838eab8dd86c425ab1b355ca945ad3863177541cf0f4d57a03

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page