{"id":26145690,"url":"https://github.com/carlowood/quantum","last_synced_at":"2025-07-06T22:08:33.546Z","repository":{"id":139973067,"uuid":"173489820","full_name":"CarloWood/quantum","owner":"CarloWood","description":"Play with quantum gates","archived":false,"fork":false,"pushed_at":"2024-08-11T17:44:39.000Z","size":82,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-14T03:09:35.906Z","etag":null,"topics":["quantum-computer-simulator","quantum-computing"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CarloWood.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2019-03-02T19:25:49.000Z","updated_at":"2025-01-22T06:01:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"bb4f1ca9-5e7d-4d0a-b84a-5443b6304438","html_url":"https://github.com/CarloWood/quantum","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CarloWood/quantum","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CarloWood%2Fquantum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CarloWood%2Fquantum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CarloWood%2Fquantum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CarloWood%2Fquantum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CarloWood","download_url":"https://codeload.github.com/CarloWood/quantum/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CarloWood%2Fquantum/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263980180,"owners_count":23538922,"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-computer-simulator","quantum-computing"],"created_at":"2025-03-11T04:54:42.850Z","updated_at":"2025-07-06T22:08:33.527Z","avatar_url":"https://github.com/CarloWood.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# quantum\nPlay with quantum gates\n\n## Usage\n\nEdit \u003ccode\u003esrc/quantum.cxx\u003c/code\u003e and make a circuit using C++ code, but in a way that looks\nmuch like the normal way quantum circuits are composed. For example,\n\n\u003cpre\u003e\n    q[1] - H - co(0) - H - measure(0);\n    q[0]     - CX(0) - S - H - T_inv - H - measure(1);\n\u003c/pre\u003e\n\nHere each \u003ccode\u003eq[...]\u003c/code\u003e is a qubit, \u003ccode\u003eH\u003c/code\u003e is the Hademar gate, etc\n(see [Gates.h](https://github.com/CarloWood/quantum/blob/master/src/Gates.h) for a list of all\nstandard gates). \u003ccode\u003eco(int)\u003c/code\u003e is the control input of a controlled CNOT while\n\u003ccode\u003eCX(int)\u003c/code\u003e with the same int, is the corresponding controlled input. Finally,\n\u003ccode\u003emeasure(int)\u003c/code\u003e measures the classical bit \u003ccode\u003eint\u003c/code\u003e. You must specify\nthe number of qubits and classical bits at the moment you create \u003ccode\u003eq\u003c/code\u003e.\n\nNote that there can only be a single minus sign between the gates.\n\n## Wave function collapse and shots\n\n\u003cb\u003eTHIS IMPLEMENTATION DOES NOT COLLAPSE THE WAVE FUNCTION\u003c/b\u003e.\n\nThis is important to me, because I don't believe in wave function collapses.\nThat only appears to be the case when you yourself get entangled with the quantum\nsuperposition that you try to measure.\n\nTherefore, you can continue to put more gates after a \u003ccode\u003emeasure(int)\u003c/code\u003e\nas well: the state was not changed (it WAS however entangled with the measured\n\"classical\" bit).\n\nAs a result, you do not need any \"shots\" (run the circuit many times to get approximate\nstatistics). The statistics on chance of the measurements are simply calculated in parallel,\nusing the normal quantum computer power of doing things in parallel.\n\n## Accuracy, round off errors and noise.\n\n\u003cb\u003eTHIS IMPLEMENTATION HAS NO NOISE, AND NO ROUND OFF ERRORS.\u003c/b\u003e\n\nThis implementation uses a field extension to the rationals, for which GMP is used\nfor infinite accuracy. Hence, the results are infinitely precise.\n\nFor example, the above circuit results in the following output:\n\n\u003cpre\u003e\n0₁0₀: (1/4 + 1/4·i - 1/2·i·√½)·|0₁0₀⟩   Chance: 1/4 - 1/4·√½\n1₁0₀: (1/4 + 1/4·i + 1/2·i·√½)·|0₁1₀⟩   Chance: 1/4 + 1/4·√½\n0₁1₀: (1/4 - 1/4·i + 1/2·√½)·|1₁0₀⟩     Chance: 1/4 + 1/4·√½\n1₁1₀: (1/4 - 1/4·i - 1/2·√½)·|1₁1₀⟩     Chance: 1/4 - 1/4·√½\n\u003c/pre\u003e\n\nwhere in the left column, before the colon, you see the possible classical\nmeasurements for classical bits 0 and 1, and on the right the exact chance.\nIn the middle you see the corresponding (collapsed) wave function of\nthe circuit that belongs to that reality.\n\n## Installation\n\nAs usual, I only support linux. If you use something else then you're on your own;\nalthough, I mostly use standard C++ - so porting shouldn't be hard for another\ndeveloper.\n\nTo install this project out-of-the-box you will need to have GNU\n[autotools](https://en.wikipedia.org/wiki/GNU_Build_System_autotools) installed.\nIn order to see debug output, you need to have [libcwd](https://github.com/CarloWood/libcwd)\ncompiled and installed.\n\nThis project uses git submodules. To clone this project, have the above installed and simply run:\n\n\u003cpre\u003e\n\u003cb\u003egit clone --recursive https://github.com/CarloWood/quantum.git\u003c/b\u003e\n\u003cb\u003ecd quantum\u003c/b\u003e\n\u003cb\u003e./autogen.sh\u003c/b\u003e\n\u003c/pre\u003e\n\nAfter that it is the usual,\n\n\u003cpre\u003e\n\u003cb\u003e./configure\u003c/b\u003e\n\u003cb\u003emake\u003c/b\u003e\n\u003c/pre\u003e\n\nassuming you're familiar with GNU autotool projects.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarlowood%2Fquantum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarlowood%2Fquantum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarlowood%2Fquantum/lists"}