{"id":13536049,"url":"https://github.com/ProjectQ-Framework/ProjectQ","last_synced_at":"2025-04-02T02:32:13.216Z","repository":{"id":37580015,"uuid":"77520796","full_name":"ProjectQ-Framework/ProjectQ","owner":"ProjectQ-Framework","description":"ProjectQ: An open source software framework for quantum computing","archived":false,"fork":false,"pushed_at":"2024-10-28T20:07:54.000Z","size":1797,"stargazers_count":888,"open_issues_count":37,"forks_count":274,"subscribers_count":70,"default_branch":"develop","last_synced_at":"2024-10-28T21:21:31.729Z","etag":null,"topics":["quantum-computing","quantum-programming-language"],"latest_commit_sha":null,"homepage":"https://projectq.ch","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ProjectQ-Framework.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-28T09:31:53.000Z","updated_at":"2024-10-27T18:23:25.000Z","dependencies_parsed_at":"2023-02-16T12:15:46.293Z","dependency_job_id":"96e27add-defe-421f-b03f-0373704e1cf8","html_url":"https://github.com/ProjectQ-Framework/ProjectQ","commit_stats":{"total_commits":235,"total_committers":38,"mean_commits":6.184210526315789,"dds":0.7446808510638299,"last_synced_commit":"67c660ca18725d23ab0b261a45e34873b6a58d03"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProjectQ-Framework%2FProjectQ","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProjectQ-Framework%2FProjectQ/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProjectQ-Framework%2FProjectQ/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProjectQ-Framework%2FProjectQ/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ProjectQ-Framework","download_url":"https://codeload.github.com/ProjectQ-Framework/ProjectQ/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222795273,"owners_count":17038797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["quantum-computing","quantum-programming-language"],"created_at":"2024-08-01T09:00:34.138Z","updated_at":"2024-11-03T01:30:17.576Z","avatar_url":"https://github.com/ProjectQ-Framework.png","language":"Python","readme":"ProjectQ - An open source software framework for quantum computing\n==================================================================\n\n.. image:: https://img.shields.io/pypi/pyversions/projectq?label=Python\n   :alt: PyPI - Python Version\n\n.. image:: https://badge.fury.io/py/projectq.svg\n   :target: https://badge.fury.io/py/projectq\n\n.. image:: https://github.com/ProjectQ-Framework/ProjectQ/actions/workflows/ci.yml/badge.svg\n   :alt: CI Status\n   :target: https://github.com/ProjectQ-Framework/ProjectQ/actions/workflows/ci.yml\n\n.. image:: https://coveralls.io/repos/github/ProjectQ-Framework/ProjectQ/badge.svg\n   :alt: Coverage Status\n   :target: https://coveralls.io/github/ProjectQ-Framework/ProjectQ\n\n.. image:: https://readthedocs.org/projects/projectq/badge/?version=latest\n   :target: http://projectq.readthedocs.io/en/latest/?badge=latest\n   :alt: Documentation Status\n\n\nProjectQ is an open source effort for quantum computing.\n\nIt features a compilation framework capable of\ntargeting various types of hardware, a high-performance quantum computer\nsimulator with emulation capabilities, and various compiler plug-ins.\nThis allows users to\n\n-  run quantum programs on the IBM Quantum Experience chip, AQT devices, AWS Braket, Azure Quantum, or IonQ service\n   provided devices\n-  simulate quantum programs on classical computers\n-  emulate quantum programs at a higher level of abstraction (e.g.,\n   mimicking the action of large oracles instead of compiling them to\n   low-level gates)\n-  export quantum programs as circuits (using TikZ)\n-  get resource estimates\n\nExamples\n--------\n\n**First quantum program**\n\n.. code-block:: python\n\n    from projectq import MainEngine  # import the main compiler engine\n    from projectq.ops import (\n        H,\n        Measure,\n    )  # import the operations we want to perform (Hadamard and measurement)\n\n    eng = MainEngine()  # create a default compiler (the back-end is a simulator)\n    qubit = eng.allocate_qubit()  # allocate a quantum register with 1 qubit\n\n    H | qubit  # apply a Hadamard gate\n    Measure | qubit  # measure the qubit\n\n    eng.flush()  # flush all gates (and execute measurements)\n    print(f\"Measured {int(qubit)}\")  # converting a qubit to int or bool gives access to the measurement result\n\n\nProjectQ features a lean syntax which is close to the mathematical notation used in quantum physics. For example, a\nrotation of a qubit around the x-axis is usually specified as:\n\n.. image:: docs/images/braket_notation.svg\n    :alt: Rx(theta)|qubit\u003e\n    :width: 100px\n\nThe same statement in ProjectQ's syntax is:\n\n.. code-block:: python\n\n    Rx(theta) | qubit\n\nThe **|**-operator separates the specification of the gate operation (left-hand side) from the quantum bits to which the\noperation is applied (right-hand side).\n\n**Changing the compiler and using a resource counter as a back-end**\n\nInstead of simulating a quantum program, one can use our resource counter (as a back-end) to determine how many\noperations it would take on a future quantum computer with a given architecture. Suppose the qubits are arranged on a\nlinear chain and the architecture supports any single-qubit gate as well as the two-qubit CNOT and Swap operations:\n\n.. code-block:: python\n\n    from projectq import MainEngine\n    from projectq.backends import ResourceCounter\n    from projectq.ops import QFT, CNOT, Swap\n    from projectq.setups import linear\n\n    compiler_engines = linear.get_engine_list(num_qubits=16, one_qubit_gates='any', two_qubit_gates=(CNOT, Swap))\n    resource_counter = ResourceCounter()\n    eng = MainEngine(backend=resource_counter, engine_list=compiler_engines)\n    qureg = eng.allocate_qureg(16)\n    QFT | qureg\n    eng.flush()\n\n    print(resource_counter)\n\n    # This will output, among other information,\n    # how many operations are needed to perform\n    # this quantum fourier transform (QFT), i.e.,\n    #   Gate class counts:\n    #       AllocateQubitGate : 16\n    #       CXGate : 240\n    #       HGate : 16\n    #       R : 120\n    #       Rz : 240\n    #       SwapGate : 262\n\n\n**Running a quantum program on IBM's QE chips**\n\nTo run a program on the IBM Quantum Experience chips, all one has to do is choose the `IBMBackend` and the corresponding\nsetup:\n\n.. code-block:: python\n\n    import projectq.setups.ibm\n    from projectq.backends import IBMBackend\n\n    token = 'MY_TOKEN'\n    device = 'ibmq_16_melbourne'\n    compiler_engines = projectq.setups.ibm.get_engine_list(token=token, device=device)\n    eng = MainEngine(\n        IBMBackend(token=token, use_hardware=True, num_runs=1024, verbose=False, device=device),\n        engine_list=compiler_engines,\n    )\n\n\n**Running a quantum program on AQT devices**\n\nTo run a program on the AQT trapped ion quantum computer, choose the `AQTBackend` and the corresponding setup:\n\n.. code-block:: python\n\n    import projectq.setups.aqt\n    from projectq.backends import AQTBackend\n\n    token = 'MY_TOKEN'\n    device = 'aqt_device'\n    compiler_engines = projectq.setups.aqt.get_engine_list(token=token, device=device)\n    eng = MainEngine(\n        AQTBackend(token=token, use_hardware=True, num_runs=1024, verbose=False, device=device),\n        engine_list=compiler_engines,\n    )\n\n\n**Running a quantum program on a AWS Braket provided device**\n\nTo run a program on some of the devices provided by the AWS Braket service, choose the `AWSBraketBackend`. The currend\ndevices supported are Aspen-8 from Rigetti, IonQ from IonQ and the state vector simulator SV1:\n\n.. code-block:: python\n\n    from projectq.backends import AWSBraketBackend\n\n    creds = {\n        'AWS_ACCESS_KEY_ID': 'your_aws_access_key_id',\n        'AWS_SECRET_KEY': 'your_aws_secret_key',\n    }\n\n    s3_folder = ['S3Bucket', 'S3Directory']\n    device = 'IonQ'\n    eng = MainEngine(\n        AWSBraketBackend(\n            use_hardware=True,\n            credentials=creds,\n            s3_folder=s3_folder,\n            num_runs=1024,\n            verbose=False,\n            device=device,\n        ),\n        engine_list=[],\n    )\n\n\n.. note::\n\n   In order to use the AWSBraketBackend, you need to install ProjectQ with the 'braket' extra requirement:\n\n   .. code-block:: bash\n\n       python3 -m pip install projectq[braket]\n\n   or\n\n   .. code-block:: bash\n\n       cd /path/to/projectq/source/code\n       python3 -m pip install -ve .[braket]\n\n\n**Running a quantum program on a Azure Quantum provided device**\n\nTo run a program on devices provided by the `Azure Quantum \u003chttps://azure.microsoft.com/en-us/services/quantum/\u003e`_.\n\nUse `AzureQuantumBackend` to run ProjectQ circuits on hardware devices and simulator devices from providers `IonQ` and\n`Quantinuum`.\n\n.. code-block:: python\n\n    from projectq.backends import AzureQuantumBackend\n\n    azure_quantum_backend = AzureQuantumBackend(\n        use_hardware=False, target_name='ionq.simulator', resource_id='\u003cresource-id\u003e', location='\u003clocation\u003e', verbose=True\n    )\n\n.. note::\n\n   In order to use the AzureQuantumBackend, you need to install ProjectQ with the 'azure-quantum' extra requirement:\n\n   .. code-block:: bash\n\n       python3 -m pip install projectq[azure-quantum]\n\n   or\n\n   .. code-block:: bash\n\n       cd /path/to/projectq/source/code\n       python3 -m pip install -ve .[azure-quantum]\n\n**Running a quantum program on IonQ devices**\n\nTo run a program on the IonQ trapped ion hardware, use the `IonQBackend` and its corresponding setup.\n\nCurrently available devices are:\n\n* `ionq_simulator`: A 29-qubit simulator.\n* `ionq_qpu`: A 11-qubit trapped ion system.\n\n.. code-block:: python\n\n    import projectq.setups.ionq\n    from projectq import MainEngine\n    from projectq.backends import IonQBackend\n\n    token = 'MY_TOKEN'\n    device = 'ionq_qpu'\n    backend = IonQBackend(\n        token=token,\n        use_hardware=True,\n        num_runs=1024,\n        verbose=False,\n        device=device,\n    )\n    compiler_engines = projectq.setups.ionq.get_engine_list(\n        token=token,\n        device=device,\n    )\n    eng = MainEngine(backend, engine_list=compiler_engines)\n\n\n**Classically simulate a quantum program**\n\nProjectQ has a high-performance simulator which allows simulating up to about 30 qubits on a regular laptop. See the\n`simulator tutorial\n\u003chttps://github.com/ProjectQ-Framework/ProjectQ/blob/feature/update-readme/examples/simulator_tutorial.ipynb\u003e`__ for\nmore information. Using the emulation features of our simulator (fast classical shortcuts), one can easily emulate\nShor's algorithm for problem sizes for which a quantum computer would require above 50 qubits, see our `example codes\n\u003chttp://projectq.readthedocs.io/en/latest/examples.html#shor-s-algorithm-for-factoring\u003e`__.\n\n\nThe advanced features of the simulator are also particularly useful to investigate algorithms for the simulation of\nquantum systems. For example, the simulator can evolve a quantum system in time (without Trotter errors) and it gives\ndirect access to expectation values of Hamiltonians leading to extremely fast simulations of VQE type algorithms:\n\n.. code-block:: python\n\n    from projectq import MainEngine\n    from projectq.ops import All, Measure, QubitOperator, TimeEvolution\n\n    eng = MainEngine()\n    wavefunction = eng.allocate_qureg(2)\n    # Specify a Hamiltonian in terms of Pauli operators:\n    hamiltonian = QubitOperator(\"X0 X1\") + 0.5 * QubitOperator(\"Y0 Y1\")\n    # Apply exp(-i * Hamiltonian * time) (without Trotter error)\n    TimeEvolution(time=1, hamiltonian=hamiltonian) | wavefunction\n    # Measure the expectation value using the simulator shortcut:\n    eng.flush()\n    value = eng.backend.get_expectation_value(hamiltonian, wavefunction)\n\n    # Last operation in any program should be measuring all qubits\n    All(Measure) | qureg\n    eng.flush()\n\n\n\nGetting started\n---------------\n\nTo start using ProjectQ, simply follow the installation instructions in the `tutorials\n\u003chttp://projectq.readthedocs.io/en/latest/tutorials.html\u003e`__. There, you will also find OS-specific hints, a small\nintroduction to the ProjectQ syntax, and a few `code examples\n\u003chttp://projectq.readthedocs.io/en/latest/examples.html\u003e`__. More example codes and tutorials can be found in the\nexamples folder `here \u003chttps://github.com/ProjectQ-Framework/ProjectQ/tree/develop/examples\u003e`__ on GitHub.\n\nAlso, make sure to check out the `ProjectQ website \u003chttp://www.projectq.ch\u003e`__ and the detailed `code documentation\n\u003chttp://projectq.readthedocs.io/en/latest/\u003e`__.\n\nHow to contribute\n-----------------\n\nFor information on how to contribute, please visit the `ProjectQ website \u003chttp://www.projectq.ch\u003e`__ or send an e-mail\nto info@projectq.ch.\n\nPlease cite\n-----------\n\nWhen using ProjectQ for research projects, please cite\n\n-  Damian S. Steiger, Thomas Haener, and Matthias Troyer \"ProjectQ: An\n   Open Source Software Framework for Quantum Computing\"\n   `Quantum 2, 49 (2018) \u003chttps://doi.org/10.22331/q-2018-01-31-49\u003e`__\n   (published on `arXiv \u003chttps://arxiv.org/abs/1612.08091\u003e`__ on 23 Dec 2016)\n-  Thomas Haener, Damian S. Steiger, Krysta M. Svore, and Matthias Troyer\n   \"A Software Methodology for Compiling Quantum Programs\" `Quantum Sci. Technol. 3 (2018) 020501\n   \u003chttps://doi.org/10.1088/2058-9565/aaa5cc\u003e`__ (published on `arXiv \u003chttp://arxiv.org/abs/1604.01401\u003e`__ on 5\n   Apr 2016)\n\nAuthors\n-------\n\nThe first release of ProjectQ (v0.1) was developed by `Thomas\nHaener \u003chttp://www.comp.phys.ethz.ch/people/person-detail.html?persid=179208\u003e`__\nand `Damian S.\nSteiger \u003chttp://www.comp.phys.ethz.ch/people/person-detail.html?persid=165677\u003e`__\nin the group of `Prof. Dr. Matthias\nTroyer \u003chttp://www.comp.phys.ethz.ch/people/troyer.html\u003e`__ at ETH\nZurich.\n\nProjectQ is constantly growing and `many other people\n\u003chttps://github.com/ProjectQ-Framework/ProjectQ/graphs/contributors\u003e`__ have already contributed to it in the meantime.\n\nLicense\n-------\n\nProjectQ is released under the Apache 2 license.\n","funding_links":[],"categories":["Quantum SDKs","Quantum full-stack libraries","Programming language","Development","Python","Quantum with AI","Tools"],"sub_categories":["Python","Frameworks and Libraries","Philosophy","Mesh networks"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FProjectQ-Framework%2FProjectQ","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FProjectQ-Framework%2FProjectQ","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FProjectQ-Framework%2FProjectQ/lists"}