# Quantum Computer Simulator
This is a simple project to simulate quantum behaviour on your local machine. One of the benefit of running this locally is there is essentially no limit on how many qubits can scale too, it comes down to your PC's specs and how many qubits you as a person handle.
# How to use
1. Create a simple python file, say `main.py`, with the following content.
```
import simple_qsim
# Register number of qubits you want to use.
s = [
simple_qsim.q() for _ in range(3)
]
# Sample Circuit
c = [
["H", s[0]],
["H", s[1]],
["H", s[2]],
["Z", s[2]],
["CZ", s[0], s[1]],
["H", s[0]],
["H", s[1]],
["H", s[2]],
]
# Run the circuit
simple_qsim.run(s, shots=10000, circuit=c)
```
2. Then run it using python
`python3 main.py`
3. You should see something like:
```
8 Possible States
[25.85, [0, 1, 1]]
[25.07, [1, 0, 1]]
[24.77, [1, 1, 1]]
[24.31, [0, 0, 1]]
```
You can verify or use the GUI on IBM's platform here: [IBM Quantum Composer](https://quantum.ibm.com/composer/)
# Available Gates
You can learn more about quantum gates at [Wikipeida](https://en.wikipedia.org/wiki/Quantum_logic_gate)
1. Single Qubit Gates
````
a. Hadamard Gate (H)
Puts the qubit in super position
Use - ```["H", q[n]]```
b. Pauli Gates (X,Y,Z)
Spins the qubit 90deg in that axis
Use - ["X", q[n]]
["Y", q[n]]
["Z", q[n]]
````
2. Controlled Gates
```
a. Controlled-NOT (CNOT)
Performs a not operation on targed when the control bit is |1⟩
Use - ["CNOT", <target>, <control>]
b. Controlled-Z (CZ)
Performs a Pauli Z operation on targed when the control bit is |1⟩
Use - ["CZ", <target>, <control>]
```
# Contribution
I might or might not update this repo myself, however I am open to contribution!
# License
All the code available in this repo is under apache 2.0 license.
Raw data
{
"_id": null,
"home_page": null,
"name": "simple-qsim",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Prince Rawat <prince@princerawat.com>",
"keywords": "circuit, quantum, quantum-computing, simulator",
"author": null,
"author_email": "Prince Rawat <prince@princerawat.com>",
"download_url": "https://files.pythonhosted.org/packages/46/c3/f43bc89fc1d76b40d8345fab7db089302f74e742a98e7c81d0e0fdeb5dc4/simple_qsim-0.0.3.tar.gz",
"platform": null,
"description": "# Quantum Computer Simulator\n\nThis is a simple project to simulate quantum behaviour on your local machine. One of the benefit of running this locally is there is essentially no limit on how many qubits can scale too, it comes down to your PC's specs and how many qubits you as a person handle.\n\n# How to use\n\n1. Create a simple python file, say `main.py`, with the following content.\n\n```\nimport simple_qsim\n\n# Register number of qubits you want to use.\ns = [\n\tsimple_qsim.q() for _ in range(3)\n]\n\n# Sample Circuit\nc = [\n[\"H\", s[0]],\n[\"H\", s[1]],\n[\"H\", s[2]],\n[\"Z\", s[2]],\n[\"CZ\", s[0], s[1]],\n[\"H\", s[0]],\n[\"H\", s[1]],\n[\"H\", s[2]],\n]\n\n# Run the circuit\nsimple_qsim.run(s, shots=10000, circuit=c)\n```\n\n2. Then run it using python\n `python3 main.py`\n3. You should see something like:\n\n```\n8 Possible States\n\n\n[25.85, [0, 1, 1]]\n[25.07, [1, 0, 1]]\n[24.77, [1, 1, 1]]\n[24.31, [0, 0, 1]]\n```\n\nYou can verify or use the GUI on IBM's platform here: [IBM Quantum Composer](https://quantum.ibm.com/composer/)\n\n# Available Gates\n\nYou can learn more about quantum gates at [Wikipeida](https://en.wikipedia.org/wiki/Quantum_logic_gate)\n\n1. Single Qubit Gates\n\n````\n\ta. Hadamard Gate (H)\n\t\tPuts the qubit in super position\n\t\tUse - ```[\"H\", q[n]]```\n\tb. Pauli Gates (X,Y,Z)\n\t\tSpins the qubit 90deg in that axis\n\t\tUse - [\"X\", q[n]]\n\t\t\t [\"Y\", q[n]]\n\t\t\t [\"Z\", q[n]]\n````\n\n2. Controlled Gates\n\n```\n\ta. Controlled-NOT (CNOT)\n\t\tPerforms a not operation on targed when the control bit is |1\u27e9\n\t\tUse - [\"CNOT\", <target>, <control>]\n\tb. Controlled-Z (CZ)\n\t\tPerforms a Pauli Z operation on targed when the control bit is |1\u27e9\n\t\tUse - [\"CZ\", <target>, <control>]\n```\n\n# Contribution\n\nI might or might not update this repo myself, however I am open to contribution!\n\n# License\n\nAll the code available in this repo is under apache 2.0 license.\n",
"bugtrack_url": null,
"license": null,
"summary": "A simple Quantum Simulator",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/MrPrinceRawat/Quantum-Computering-Simulator",
"Issues": "https://github.com/MrPrinceRawat/Quantum-Computering-Simulator/issues"
},
"split_keywords": [
"circuit",
" quantum",
" quantum-computing",
" simulator"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "eda46ce3946671e3762631369d7a04545999fe2cabab2fed8f1f9ec400dce416",
"md5": "6545d0c82cdd126c1a07ac9141fa0c71",
"sha256": "d5a902017e3761401870fd5e2f212845381afc44dc396849ca49e160952f83fc"
},
"downloads": -1,
"filename": "simple_qsim-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6545d0c82cdd126c1a07ac9141fa0c71",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 16373,
"upload_time": "2024-07-07T11:50:14",
"upload_time_iso_8601": "2024-07-07T11:50:14.339255Z",
"url": "https://files.pythonhosted.org/packages/ed/a4/6ce3946671e3762631369d7a04545999fe2cabab2fed8f1f9ec400dce416/simple_qsim-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "46c3f43bc89fc1d76b40d8345fab7db089302f74e742a98e7c81d0e0fdeb5dc4",
"md5": "9b0c7677e5f25728af42a08e6d2a11c4",
"sha256": "42965894b2fc1c1a83d6540f554fc1303bc76730aef2c004d61c42a649b26232"
},
"downloads": -1,
"filename": "simple_qsim-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "9b0c7677e5f25728af42a08e6d2a11c4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 2885144,
"upload_time": "2024-07-07T11:50:17",
"upload_time_iso_8601": "2024-07-07T11:50:17.887833Z",
"url": "https://files.pythonhosted.org/packages/46/c3/f43bc89fc1d76b40d8345fab7db089302f74e742a98e7c81d0e0fdeb5dc4/simple_qsim-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-07 11:50:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MrPrinceRawat",
"github_project": "Quantum-Computering-Simulator",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "simple-qsim"
}