{"id":13593295,"url":"https://github.com/Qaqarot/qaqarot","last_synced_at":"2025-04-09T02:33:12.666Z","repository":{"id":32806332,"uuid":"143221277","full_name":"Qaqarot/qaqarot","owner":"Qaqarot","description":"Quantum Computer Library for Everyone","archived":false,"fork":false,"pushed_at":"2023-07-05T13:52:40.000Z","size":1581,"stargazers_count":377,"open_issues_count":12,"forks_count":54,"subscribers_count":48,"default_branch":"master","last_synced_at":"2025-03-31T21:31:48.366Z","etag":null,"topics":["python","quantum","quantum-algorithms","quantum-computer-simulator","quantum-computing","quantum-information","quantum-programming-language"],"latest_commit_sha":null,"homepage":"","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/Qaqarot.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":"2018-08-02T00:18:23.000Z","updated_at":"2025-03-16T13:51:04.000Z","dependencies_parsed_at":"2023-07-27T12:05:57.048Z","dependency_job_id":null,"html_url":"https://github.com/Qaqarot/qaqarot","commit_stats":null,"previous_names":["qaqarot/qaqarot","blueqat/blueqat"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qaqarot%2Fqaqarot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qaqarot%2Fqaqarot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qaqarot%2Fqaqarot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qaqarot%2Fqaqarot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Qaqarot","download_url":"https://codeload.github.com/Qaqarot/qaqarot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247965789,"owners_count":21025438,"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":["python","quantum","quantum-algorithms","quantum-computer-simulator","quantum-computing","quantum-information","quantum-programming-language"],"created_at":"2024-08-01T16:01:18.861Z","updated_at":"2025-04-09T02:33:08.489Z","avatar_url":"https://github.com/Qaqarot.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# qaqarot\nThe blueqat project has been renamed the qaqarot project because of the branding strategy of blueqat inc.\n\n![Logo](https://raw.githubusercontent.com/Blueqat/Blueqat/master/blueqat_logo_blue.png)\n\n# blueqat\nA Quantum Computing SDK\n\n### Version\n[![Version](https://badge.fury.io/py/blueqat.svg)](https://badge.fury.io/py/blueqat)\n\n### Tutorial\nhttps://github.com/Blueqat/Blueqat-tutorials\n\n### Notice\nThe back end has been changed to tensor network. The previous backend environment can still be used with .run(backend=\"numpy\").\n\n### Install\n```\ngit clone https://github.com/Blueqat/Blueqat\ncd Blueqat\npip3 install -e .\n```\n\nor\n\n```\npip3 install blueqat\n```\n\n### Circuit\n```python\nfrom blueqat import Circuit\nimport math\n\n#number of qubit is not specified\nc = Circuit()\n\n#if you want to specified the number of qubit\nc = Circuit(50) #50qubits\n```\n\n### Method Chain\n```python\n# write as chain\nCircuit().h[0].x[0].z[0]\n\n# write in separately\nc = Circuit().h[0]\nc.x[0].z[0]\n```\n\n### Slice\n```python\nCircuit().z[1:3] # Zgate on 1,2\nCircuit().x[:3] # Xgate on (0, 1, 2)\nCircuit().h[:] # Hgate on all qubits\nCircuit().x[1, 2] # 1qubit gate with comma\n```\n\n### Rotation Gate\n```python\nCircuit().rz(math.pi / 4)[0]\n```\n\n### Run\n```python\nfrom blueqat import Circuit\nCircuit(50).h[:].run()\n```\n\n### Run(shots=n)\n```python\nCircuit(100).x[:].run(shots=100)\n# =\u003e Counter({'1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111': 100})\n```\n\n### Single Amplitude\n```python\nCircuit(4).h[:].run(amplitude=\"0101\")\n```\n\n### Expectation value of hamiltonian\n```python\nfrom blueqat.pauli import Z\nhamiltonian = 1*Z[0]+1*Z[1]\nCircuit(4).x[:].run(hamiltonian=hamiltonian)\n# =\u003e -2.0\n```\n\n### Blueqat to QASM\n```python\nCircuit().h[0].to_qasm()\n    \n#OPENQASM 2.0;\n#include \"qelib1.inc\";\n#qreg q[1];\n#creg c[1];\n#h q[0];\n```\n\n### Hamiltonian\n```python\nfrom blueqat.pauli import *\n\nhamiltonian1 = (1.23 * Z[0] + 4.56 * X[1] * Z[2]) ** 2\nhamiltonian2 = (2.46 * Y[0] + 5.55 * Z[1] * X[2] * X[1]) ** 2\nhamiltonian = hamiltonian1 + hamiltonian2\nprint(hamiltonian)\n    \n# =\u003e 7.5645*I + 5.6088*Z[0]*X[1]*Z[2] + 5.6088*X[1]*Z[2]*Z[0] + 20.793599999999998*X[1]*Z[2]*X[1]*Z[2] + 13.652999999999999*Y[0]*Z[1]*X[2]*X[1] + 13.652999999999999*Z[1]*X[2]*X[1]*Y[0] + 30.8025*Z[1]*X[2]*X[1]*Z[1]*X[2]*X[1]\n```\n\n### Simplify the Hamiltonian\n```python\nhamiltonian = hamiltonian.simplify()\nprint(hamiltonian)\n\n#=\u003e-2.4444000000000017*I + 27.305999999999997j*Y[0]*Y[1]*X[2] + 11.2176*Z[0]*X[1]*Z[2]\n```\n\n### QUBO Hamiltonian\n```python\nfrom blueqat.pauli import qubo_bit as q\n\nhamiltonian = -3*q(0)-3*q(1)-3*q(2)-3*q(3)-3*q(4)+2*q(0)*q(1)+2*q(0)*q(2)+2*q(0)*q(3)+2*q(0)*q(4)\nprint(hamiltonian)\n    \n# =\u003e -5.5*I + 1.0*Z[1] + 1.0*Z[2] + 1.0*Z[3] + 1.0*Z[4] + 0.5*Z[0]*Z[1] + 0.5*Z[0]*Z[2] + 0.5*Z[0]*Z[3] - 0.5*Z[0] + 0.5*Z[0]*Z[4]\n```\n\n### Time Evolution\n```python\nhamiltonian = [1.0*Z(0), 1.0*X[0]]\na = [term.get_time_evolution() for term in hamiltonian]\n\ntime_evolution = Circuit().h[0]\nfor evo in a:\n    evo(time_evolution, np.random.rand())\n    \nprint(time_evolution)\n\n# =\u003e Circuit(1).h[0].rz(-1.4543063361067243)[0].h[0].rz(-1.8400416676737137)[0].h[0]\n```\n\n### QAOA\n```python\nfrom blueqat import Circuit\nfrom blueqat.utils import qaoa\nfrom blueqat.pauli import qubo_bit as q\nfrom blueqat.pauli import X,Y,Z,I\n\nhamiltonian = q(0)-q(1)\nstep = 1\n\nresult = qaoa(hamiltonian, step)\nresult.circuit.run(shots=100)\n    \n# =\u003e Counter({'01': 99, '11': 1})\n```\n\n\n### Circuit Drawing Backend\n```python\nfrom blueqat import vqe\nfrom blueqat.pauli import *\nfrom blueqat.pauli import qubo_bit as q\n\n#hamiltonian = q(0)-3*q(1)+2*q(0)*q(1)+3*q(2)*q(3)+q(4)*q(7)\nhamiltonian = Z[0]-3*Z[1]+2*Z[0]*Z[1]+3*Z[2]*Z[3]+Z[4]\nstep = 8\n\nresult = vqe.Vqe(vqe.QaoaAnsatz(hamiltonian, step)).run()\nresult.circuit.run(backend='draw')\n```\n\n![draw](https://raw.githubusercontent.com/Blueqat/Blueqat/master/draw.png)\n\n### Cloud System Connection (API Key is required)\n```python\nfrom bqcloud import register_api\napi = register_api(\"Your API Key\")\n\nfrom bqcloud import load_api\napi = load_api()\n\nfrom blueqat import Circuit\nfrom bqcloud import Device\n\ntask = api.execute(Circuit().h[0].cx[0, 1], Device.IonQDevice, 10)\n#task = api.execute(Circuit().h[0].cx[0, 1], Device.AspenM1, 10)\n\n# Wait 10 sec. If complete, result is returned, otherwise, None is returned.\nresult = task.wait(timeout=10)\n\nif result:\n    print(result.shots())\nelse:\n    print(\"timeout\")\n```\n\n### Document\nhttps://blueqat.readthedocs.io/en/latest/\n\n### Contributors\n[Contributors](https://github.com/Blueqat/Blueqat/graphs/contributors)\n\n### Disclaimer\nCopyright 2022 The Blueqat Developers.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQaqarot%2Fqaqarot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FQaqarot%2Fqaqarot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQaqarot%2Fqaqarot/lists"}