{"id":25933566,"url":"https://github.com/simplygreatwork/obvious","last_synced_at":"2025-03-04T00:54:20.714Z","repository":{"id":193175490,"uuid":"267367386","full_name":"simplygreatwork/obvious","owner":"simplygreatwork","description":"A small, hackable, optimized framework for learning quantum computing with examples.","archived":false,"fork":false,"pushed_at":"2020-07-08T16:06:56.000Z","size":440,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2023-09-07T04:27:46.907Z","etag":null,"topics":["circuit","examples","gate","gates","quantum","quantum-circuit","quantum-circuits","quantum-computing","quantum-examples","quantum-gate","quantum-simulator","qubit","simulator"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simplygreatwork.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}},"created_at":"2020-05-27T16:13:08.000Z","updated_at":"2023-09-07T04:28:14.385Z","dependencies_parsed_at":"2023-09-07T04:47:19.929Z","dependency_job_id":null,"html_url":"https://github.com/simplygreatwork/obvious","commit_stats":null,"previous_names":["simplygreatwork/obvious"],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplygreatwork%2Fobvious","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplygreatwork%2Fobvious/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplygreatwork%2Fobvious/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplygreatwork%2Fobvious/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simplygreatwork","download_url":"https://codeload.github.com/simplygreatwork/obvious/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241763706,"owners_count":20016162,"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":["circuit","examples","gate","gates","quantum","quantum-circuit","quantum-circuits","quantum-computing","quantum-examples","quantum-gate","quantum-simulator","qubit","simulator"],"created_at":"2025-03-04T00:54:20.258Z","updated_at":"2025-03-04T00:54:20.698Z","avatar_url":"https://github.com/simplygreatwork.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n## A small, hackable, optimized simulation framework for learning quantum computing with examples.\n\n## Features\n\n- A small, hackable, optimized simulation framework for learning quantum computing with examples.\n- Trace gate operations to display state changes as gates are applied.\n- Prints amplitude, probability, and phase.\n- Reasonably performant for 10 - 20 qubits using the quantastica engine.\n- The primary focus is to create a breadth of easy to follow quantum computing examples.\n- Compare and contrast desired outcomes and non-desired outcomes.\n- Wherever possible, display input state alone first and then output state.\n\n## Caution\n\n- This project is a work in progress.\n- None of this material has been peer reviewed. It could be you!\n- One potential effort is to convert these examples into unit tests.\n\n## Examples\n\n- [encode two classical bits inside a single qubit](/examples/superdense.js)\n- [amplify a probability amplitude](/examples/amplify.js)\n- [teleport the state of one qubit to another qubit](/examples/teleportation.js)\n- [find the frequency of a period of phases](/examples/frequency.js)\n- [increment integers in superposition](/examples/logic-increment-superposition.js)\n- [add two integers in superposition](/examples/logic-addition-superposition.js)\n- [add two integers but not in super position](/examples/logic-addition.js)\n- [create a bell state](/examples/bell-state.js)\n- [create a GHZ state](/examples/ghz-state.js)\n- [rotate phase](/examples/phase-rotation.js)\n- [illustrate phase kickback](/examples/phase-kickback.js)\n- [estimate phase](/examples/phase-estimation.js)\n- [implement a two condition not operator](/examples/not-conditionally-toffoli-constructed.js)\n- [the Deutsch-Jozsa algorithm: a classical illustration](/examples/algorithm-constant-or-balanced-classical.js)\n- [the Deutsch-Jozsa algorithm: a quantum implementation](/examples/algorithm-constant-or-balanced-quantum.js)\n- [the Bernstein-Vazirani algorithm: a classical illustration](/examples/algorithm-bitstring-query-classical.js)\n- [the Bernstein-Vazirani algorithm: a quantum implementation](/examples/algorithm-bitstring-query-quantum.js)\n- [Simon's algorithm: a classical illustration](/examples/algorithm-exclusive-or-pairs-classical.js)\n- [Simon's algorithm: a quantum implementation](/examples/algorithm-exclusive-or-pairs-quantum.js)\n- [Shor's algorithm: semiprime factoring: a naive illustration](/examples/algorithm-semiprime-factoring-naive.js)\n- [Shor's algorithm: semiprime factoring: a classical illustration](/examples/algorithm-semiprime-factoring-classical.js)\n- [Shor's algorithm: semiprime factoring: a quantum implementation: incomplete](/examples/algorithm-semiprime-factoring-quantum.js)\n- [more examples](/examples/)\n\n## Install\n\n```\ngit clone https://github.com/simplygreatwork/obvious.git\nnpm install\ncd examples\nnode amplify.js\n```\n\n## Simulation\n\n- Currently based on a condensed implementation of Quantastica's Quantum Circuit.\n\t- https://github.com/quantastica/quantum-circuit\n- Previous engines have been or are based on:\n\t- https://github.com/adamisntdead/qics\n\t- https://github.com/qcsimulator/qcsimulator.github.io\n\n## Special thanks (acknowledgements and attribution)\n\n- Thank you to O'Reilly and Eric R. Johnston, Mercedes Gimeno-Segovia, and Nic Harrigan for publishing the book [\"Programming Quantum Computers\"](https://www.oreilly.com/library/view/programming-quantum-computers/9781492039679/). Many of the examples here are reworked from the material in that book.\n- Thank you to [David B. Kemp](http://davidbkemp.github.io/). Occasionally, I ping David with emails about his project jsqubits. He is super helpful.\n- Thank you to Quantastica for publishing the simulator [Quantum Circuit](https://github.com/quantastica/quantum-circuit) using an MIT license. I am currently using a pared down version of Quantum Circuit for these quantum examples.\n\n## Goals\n\n- Create simple examples of basic quantum circuits.\n\t- Even go as far as to illustrate concepts such as:\n\t\t- \thow phase is calculated\n\t\t- \thow magnitude is calculated\n\t\t- \tmatrix multiplication\n\t\t- \tMath.log\n\t\t- \tMath.Pi\n\t\t- \tangles and radian conversion\n\t\t- \tleast common multiple\n\t\t- \tgreatest common denominator\n\t\t- \tcontinued fractions\n\t\t- \tpower mod\n\t\t- \tpower factor\n\t\t- \tbinary bit math\n\t\t- \tcomplex numbers\n\t\n- Keep as much helper code inside each example. Try not to obfuscate with additional separate layers.\n\t- If an example illustrates the quantum fourier transform primarily, implement the QFT as a separate function inside the example.\n\t- If an example entangles two qubits, implement the entanglement as a separate function inside the example.\n\t- If an example uses a qubit or qubit range helper object, implement as a separate function inside the example.\n\t\n- Keep helper modules as composable and as independent as possible:\n\t- For example, converting bit arrays to and from integers and strings is implemented independently from circuits.\n\t- For example, the core circuit implementations are separate from the circuit class used by examples.\n\t\t- Allows for custom displays and custom debugging and tracing.\n\t\t- Keeps the core circuit and gate implementations tight and focused.\n\n## References \u0026 links\n\n- https://github.com/pnnl/QASMBench\n- https://www.oreilly.com/library/view/programming-quantum-computers/978149203967/9\n- https://oreilly-qc.github.io/\n- https://quantum-circuit.com/\n- https://github.com/quantastica/quantum-circuit\n- http://davidbkemp.github.io/\n- http://qcsimulator.github.io/\n- https://github.com/adamisntdead/qics\n- https://www.quantum-inspire.com/\n- https://qiskit.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplygreatwork%2Fobvious","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimplygreatwork%2Fobvious","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplygreatwork%2Fobvious/lists"}