{"id":24536057,"url":"https://github.com/daniel-fink-de/qurest","last_synced_at":"2025-03-16T01:11:00.447Z","repository":{"id":89562584,"uuid":"347651455","full_name":"daniel-fink-de/qurest","owner":"daniel-fink-de","description":"A RESTful Approach for Hybrid Quantum-Classical Circuit Modeling","archived":false,"fork":false,"pushed_at":"2022-05-06T06:09:06.000Z","size":617,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-02T21:18:57.471Z","etag":null,"topics":["hybrid-quantum-classical-algorithms","quantum-computing","rest-api"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/daniel-fink-de.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2021-03-14T13:57:34.000Z","updated_at":"2022-05-06T06:04:07.000Z","dependencies_parsed_at":"2023-06-28T19:32:01.911Z","dependency_job_id":null,"html_url":"https://github.com/daniel-fink-de/qurest","commit_stats":null,"previous_names":["stuttgarterdotnet/qurest"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-fink-de%2Fqurest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-fink-de%2Fqurest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-fink-de%2Fqurest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-fink-de%2Fqurest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daniel-fink-de","download_url":"https://codeload.github.com/daniel-fink-de/qurest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243809888,"owners_count":20351407,"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":["hybrid-quantum-classical-algorithms","quantum-computing","rest-api"],"created_at":"2025-01-22T13:52:09.803Z","updated_at":"2025-03-16T01:11:00.441Z","avatar_url":"https://github.com/daniel-fink-de.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QuRest: A RESTful Approach for Hybrid Quantum-Classical Circuit Modeling\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![BuildAndTest](https://github.com/StuttgarterDotNet/qurest/actions/workflows/dotnet.yml/badge.svg?branch=main)](https://github.com/StuttgarterDotNet/qurest/actions/workflows/dotnet.yml)\n![Docker Cloud Automated build](https://img.shields.io/docker/cloud/automated/stuttgarterdotnet/qurest)\n![Nuget](https://img.shields.io/nuget/v/qurest)\n\nQuRest is an academical prototype with the intention to show how **classical control structures** like loops and conditionals can be implemented in a **gate-based quantum circuit model**. \nThis can be achieved by introducing so-called **design variables**, i.e. variables that needs to be mapped to real values at compile-time but can be used freely when modelling a quantum circuit.\n\nThe full paper, which was part of a course assignment, can be found here [PDF](https://github.com/StuttgarterDotNet/qurest/blob/14acb09bd0a197b8c5a97a4835fb4ca49a836f1d/QuRest_Paper.pdf).\n\n\nThe following example shows the preparation of a *GHZ-State* with *n* qubits using a for loop:\n\n```csharp\nvar qc = new QuantumCircuit()\n    .WithName(\"{N}-Qubit-GHZ\")\n    .WithDescription(\"Prepares a {N} qubit GHZ state.\")\n    .WithSize(\"{N}\")\n    .H(\"0\")\n    .For(\"{i}\", \"0\", \"{N}-1\", \"1\")\n        .CX(\"{i}\", \"{i}+1\")\n    .EndFor();\n```\n\nThe output of the compilation with *N=4*:\n\n\u003cdiv style=\"text-align: center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/StuttgarterDotNet/qurest/563592eb1099dba354118040003ed2db8819874b/images/4-Qubit-GHZ.svg\" align=\"center\"\u003e\n\u003c/div\u003e\n\n## Getting Started\n\n### Docker\nThe easiest way of using the prototype is via the [official docker image](https://hub.docker.com/r/stuttgarterdotnet/qurest).\nIf docker is installed, executing\n\n```ps\ndocker run -d -p 88:80 stuttgarterdotnet/qurest\n```\nwill run a container with the QuRest image listening on port 88.\nThe swagger ui can than be accessed via [http://localhost:88/swagger](http://localhost:88/swagger).\n\n### NuGet\nBeside the RestAPI, the underlying quantum compiler and quantum translator can also be used in dotnet using the [QuRest NuGet package](https://www.nuget.org/packages/QuRest/).\nAfter installing the latest package, you can run the following code to compile and translate a parameterized GHZ state to qasm:\n\n```csharp\nusing Microsoft.Extensions.DependencyInjection;\nusing QuRest;\nusing QuRest.Domain;\nusing System;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n    public class Program\n    {\n        public static async Task Main(string[] args)\n        {\n            var serviceProvider = new ServiceCollection()\n                .AddQuRest()\n                .BuildServiceProvider();\n\n            var circuit = new QuantumCircuit()\n                .WithName(\"N-Qubit-GHZ\")\n                .WithDescription(\"Prepares a N qubit GHZ state.\")\n                .WithSize(\"{N}\")\n                .H(\"0\")\n                .For(\"{i}\", \"0\", \"{N}-1\", \"1\")\n                    .CX(\"{i}\", \"{i}+1\")\n                .EndFor();\n\n            var compiler = serviceProvider.GetRequiredService\u003cIQuantumCircuitCompiler\u003e()\n                .AddParameterMapping(\"{N}\", 4);\n\n            var compilation = await compiler.CompileAsync(circuit);\n\n            var translator = serviceProvider.GetRequiredService\u003cIQuantumCircuitTranslator\u003e();\n\n            var qasm = await translator.TranslateToQasmAsync(compilation);\n\n            Console.WriteLine(qasm);\n        }\n    }\n}\n```\n\nYou should see the following output:\n\n```q\n// [NAME]\n// N-Qubit-GHZ_compilation\n//\n// [DESCRIPTION]\n// Prepares a N qubit GHZ state.\n\nOPENQASM 2.0;\ninclude \"qelib1.inc\";\nqreg q[4];\ncreg c[4];\n\nh q[0];\ncx q[0], q[1];\ncx q[1], q[2];\ncx q[2], q[3];\n```\n\n## Disclaimer of Warranty\nUnless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.\nYou are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.\n\n## Haftungsausschluss\nDies ist ein Forschungsprototyp.\nDie Haftung für entgangenen Gewinn, Produktionsausfall, Betriebsunterbrechung, entgangene Nutzungen, Verlust von Daten und Informationen, Finanzierungsaufwendungen sowie sonstige Vermögens- und Folgeschäden ist, außer in Fällen von grober Fahrlässigkeit, Vorsatz und Personenschäden, ausgeschlossen.\n\n## Third Party\nQuRest uses parts of the [Quantum Programming Studio](https://github.com/quantastica/quantum-circuit) and [NCalc2](https://github.com/sklose/NCalc2) which are licensed under MIT:\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel-fink-de%2Fqurest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaniel-fink-de%2Fqurest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel-fink-de%2Fqurest/lists"}