{"id":13803490,"url":"https://github.com/mapmeld/quantum-peep","last_synced_at":"2025-04-12T18:55:43.585Z","repository":{"id":33274899,"uuid":"157369351","full_name":"mapmeld/quantum-peep","owner":"mapmeld","description":"Multi-platform quantum programming library, written in TypeScript, good for JS/NodeJS","archived":false,"fork":false,"pushed_at":"2023-01-03T15:19:15.000Z","size":635,"stargazers_count":34,"open_issues_count":11,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-26T13:12:16.263Z","etag":null,"topics":["quantum","quantum-computing","quantum-programming-language"],"latest_commit_sha":null,"homepage":"https://mapmeld.com/quantum-peep/","language":"TypeScript","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/mapmeld.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}},"created_at":"2018-11-13T11:26:57.000Z","updated_at":"2022-10-12T04:18:13.000Z","dependencies_parsed_at":"2023-01-15T00:30:53.803Z","dependency_job_id":null,"html_url":"https://github.com/mapmeld/quantum-peep","commit_stats":null,"previous_names":["mapmeld/quantum-quail"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapmeld%2Fquantum-peep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapmeld%2Fquantum-peep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapmeld%2Fquantum-peep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapmeld%2Fquantum-peep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapmeld","download_url":"https://codeload.github.com/mapmeld/quantum-peep/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248618273,"owners_count":21134200,"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","quantum-computing","quantum-programming-language"],"created_at":"2024-08-04T01:00:33.725Z","updated_at":"2025-04-12T18:55:43.560Z","avatar_url":"https://github.com/mapmeld.png","language":"TypeScript","funding_links":[],"categories":["Demos, Samples, and Additional Libraries"],"sub_categories":["Participants' solutions"],"readme":"# Quantum-Peep\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/mapmeld/quantum-peep.svg)](https://greenkeeper.io/)\n\nWork in progress - build quantum programs that are platform-agnostic -\ncompile for IBM's Qobj and QASM, Rigetti's Quil, Microsoft's Q#, or Google's Cirq.\n\n## Example code\n\n```javascript\nimport { Gates, Program, RigettiProcessor, IBMProcessor } from 'quantum-peep';\n\n// write your quantum gates and measurements into a program\nlet p = new Program();\np.add(Gates.X(1));\np.measure(1, 2);\n\n// get Microsoft's Q# code\np.code('q#');\n\n// get Python code for Google Cirq\np.code('cirq');\n\n// run on Rigetti QVM Docker container\n// For actual QPUs, register for Rigetti Forest and use their endpoint, api_key, and user_id\nlet q = new RigettiProcessor({\n  endpoint: URL_of_Rigetti_qvm_docker,\n  api_key: 'aaa',\n  user_id: 'uuu'\n});\nlet runTimes = 10;\nq.run(p, runTimes, (body) =\u003e {\n  console.log(JSON.parse(body));\n});\n\n// fetch device options + status from https://forest-server.qcs.rigetti.com/devices\nq.devices((deviceInfo) =\u003e {\n  // { \"Aspen-4\": { \"is_online\": false, ... }, \"Aspen-3\": { ... } }\n});\n\n// run on IBM quantum chip\n// setting backend: in node_modules/@qiskit/cloud/cfg.json, set URI to https://api.quantum-computing.ibm.com/api\n// getting the login: go to https://quantum-computing.ibm.com\n// -- go to your profile\n// getting the token: inspect your browser's requests to headers on Backends\nlet q2 = new IBMProcessor({\n  login: secrets.ibm.login,\n  token: secrets.ibm.token,\n  processor: 'ibmq_qobj_simulator'\n});\n// fetch device options + status from https://api.quantum-computing.ibm.com/api/Backends\n// uses given processor type\nq2.devices((deviceInfo) =\u003e {\n  // [\n  //   { \"name\": \"ibmq_ourense\", \"status\": \"on\", \"specificConfiguration\": { ... }, ... }\n  // ]\n});\nq2.run(p, runTimes, (body) =\u003e {\n  console.log(JSON.parse(body));\n});\n```\n\n### More complex gates\n\n```javascript\n// gate names from different platforms are equivalent\nGates.CNOT(control, target);\nGates.CX(control, target);\n\n// swap operations\nGates.SWAP(qubit1, qubit2);\nGates.CSWAP(conditional, qubit1, qubit2);\n// ISWAP and PSWAP are only one-step operations in Quil? Advice welcome\n\n// phase gates: phase is a radian value\n// use this shorthand to express on several different platforms\n\nimport { pi_multipled_by, pi_divided_by } from 'quantum-peep';\nGates.RX(pi_multiplied_by(0.45), qubit1);\nGates.RY(pi_divided_by(2), qubit2);\n```\n\n### Bonus features\n\nOutput a circuit diagram with this library ported from QISKit Python: https://github.com/mapmeld/quantum-circuit-viz\n\n```javascript\nimport { textViz } from 'quantum-circuit-viz';\n...\nprogram.add(Gates.X(1));\nprogram.measure(1, 2);\ntextViz(program);\n```\n\n```\n        ┌───┐┌─┐\nq_1: |0\u003e┤ X ├┤M├\n        └───┘└╥┘\n c_2: 0 ══════╩═\n```\n\n## Goals\n\n- work with experimental results from APIs\n- more complex conditional / GOTO output in assembly languages\n- async/queue support: for newer APIs which put programs in a queue\n- browser JS distribution: easier use in web apps\n\n## Language references\n\nIBM's QISkit (for Python and JS) compile to Qobj and OpenQASM:\nhttps://github.com/Qiskit/openqasm\n\nRigetti's pyQuil (and the previous jsQuil project) compile to Quil:\nhttp://docs.rigetti.com/en/stable/compiler.html\n\nMicrosoft Q#\nhttps://docs.microsoft.com/en-us/quantum/language/?view=qsharp-preview\n\nGoogle Cirq\nhttps://github.com/quantumlib/Cirq\n\n## License\n\nOpen source, MIT license\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapmeld%2Fquantum-peep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapmeld%2Fquantum-peep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapmeld%2Fquantum-peep/lists"}