# Qubits
## Overview
The **Qubits** is a Python-based library for simulating quantum circuits. It leverages PyTorch to efficiently represent and manipulate quantum states and gates. This library is designed for developers and researchers who want to prototype and experiment with quantum algorithms without needing access to actual quantum hardware.
## Features
- **Quantum Gates**: Includes common gates like Pauli-X, Pauli-Y, Pauli-Z, Hadamard, CNOT, and parameterized rotation gates (Rx, Ry, Rz).
- **Quantum and Classical Registers**: Simulate quantum states and classical measurement storage.
- **Gate Application**: Apply single- and multi-qubit gates on quantum circuits.
- **Measurement**: Measure qubits and collapse the quantum state.
- **Lightweight**: Minimal dependencies with a PyTorch backend.
## Installation
You can install the library using `pip` after cloning the repository:
```bash
pip install Kala_Qubits
```
## Usage
### Import the Library
```python
from Qubits import Gate, QuantumCircuit
```
### Create a Quantum Circuit
```python
# Create a 2-qubit circuit with 2 classical bits
qc = QuantumCircuit(2, 2)
# Add gates
qc.apply(Gate.hadamard(), [0]) # Apply Hadamard to qubit 0
qc.apply(Gate.cnot(), [0, 1]) # Apply CNOT with qubit 0 as control and qubit 1 as target
# Execute the circuit
qc.execute()
# Measure all qubits
result = qc.measure_all()
print(f"Measurement outcome: {result}")
```
### Add Custom Gates
```python
import numpy as np
# Define a custom gate matrix
custom_matrix = np.array([[1, 0], [0, -1]])
custom_gate = Gate.custom(custom_matrix)
# Apply the custom gate
qc.apply(custom_gate, [0])
```
## API Reference
### `Gate`
#### Methods
- `Gate.pauli_x()`
- `Gate.pauli_y()`
- `Gate.pauli_z()`
- `Gate.hadamard()`
- `Gate.cnot()`
- `Gate.rotation_x(theta)`
- `Gate.rotation_y(theta)`
- `Gate.rotation_z(theta)`
- `Gate.custom(matrix)`
### `QuantumCircuit`
#### Methods
- `apply(gate, qubits)`
- `measure(qubit, cbit)`
- `measure_all()`
- `execute()`
### `QuantumRegister` and `ClassicalRegister`
Used internally to manage quantum states and classical bits.
## Contributing
1. Fork the repository.
2. Create a new branch for your feature or bugfix.
3. Submit a pull request with a detailed explanation of your changes.
## License
This project is licensed under the MIT License. See the `LICENSE` file for details.
## Acknowledgments
- Inspired by Qiskit and PyTorch.
- Designed for educational and research purposes.
Raw data
{
"_id": null,
"home_page": "https://github.com/Kalasaikamesh944/Qubits",
"name": "Kala-Qubits",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "N V R K SAI KAMESH YADAVALLI",
"author_email": "saikamesh.y@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/fb/a7/acd70c8726d1c0ca24215e4d54ea6c1905ae5558b17a35d98bcd6f297855/kala_qubits-0.1.0.tar.gz",
"platform": null,
"description": "# Qubits\n\n## Overview\nThe **Qubits** is a Python-based library for simulating quantum circuits. It leverages PyTorch to efficiently represent and manipulate quantum states and gates. This library is designed for developers and researchers who want to prototype and experiment with quantum algorithms without needing access to actual quantum hardware.\n\n## Features\n- **Quantum Gates**: Includes common gates like Pauli-X, Pauli-Y, Pauli-Z, Hadamard, CNOT, and parameterized rotation gates (Rx, Ry, Rz).\n- **Quantum and Classical Registers**: Simulate quantum states and classical measurement storage.\n- **Gate Application**: Apply single- and multi-qubit gates on quantum circuits.\n- **Measurement**: Measure qubits and collapse the quantum state.\n- **Lightweight**: Minimal dependencies with a PyTorch backend.\n\n## Installation\n\nYou can install the library using `pip` after cloning the repository:\n\n```bash\npip install Kala_Qubits\n```\n\n## Usage\n\n### Import the Library\n```python\nfrom Qubits import Gate, QuantumCircuit\n```\n\n### Create a Quantum Circuit\n```python\n# Create a 2-qubit circuit with 2 classical bits\nqc = QuantumCircuit(2, 2)\n\n# Add gates\nqc.apply(Gate.hadamard(), [0]) # Apply Hadamard to qubit 0\nqc.apply(Gate.cnot(), [0, 1]) # Apply CNOT with qubit 0 as control and qubit 1 as target\n\n# Execute the circuit\nqc.execute()\n\n# Measure all qubits\nresult = qc.measure_all()\nprint(f\"Measurement outcome: {result}\")\n```\n\n### Add Custom Gates\n```python\nimport numpy as np\n\n# Define a custom gate matrix\ncustom_matrix = np.array([[1, 0], [0, -1]])\ncustom_gate = Gate.custom(custom_matrix)\n\n# Apply the custom gate\nqc.apply(custom_gate, [0])\n```\n\n## API Reference\n\n### `Gate`\n\n#### Methods\n- `Gate.pauli_x()`\n- `Gate.pauli_y()`\n- `Gate.pauli_z()`\n- `Gate.hadamard()`\n- `Gate.cnot()`\n- `Gate.rotation_x(theta)`\n- `Gate.rotation_y(theta)`\n- `Gate.rotation_z(theta)`\n- `Gate.custom(matrix)`\n\n### `QuantumCircuit`\n\n#### Methods\n- `apply(gate, qubits)`\n- `measure(qubit, cbit)`\n- `measure_all()`\n- `execute()`\n\n### `QuantumRegister` and `ClassicalRegister`\nUsed internally to manage quantum states and classical bits.\n\n## Contributing\n\n1. Fork the repository.\n2. Create a new branch for your feature or bugfix.\n3. Submit a pull request with a detailed explanation of your changes.\n\n## License\n\nThis project is licensed under the MIT License. See the `LICENSE` file for details.\n\n## Acknowledgments\n- Inspired by Qiskit and PyTorch.\n- Designed for educational and research purposes.\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A lightweight quantum circuit simulator with PyTorch backend",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/Kalasaikamesh944/Qubits"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "29295e1ad8742bc860d684c76aff1fd09ed9c529ddd5ecdb9bb5660cbf5dbb0c",
"md5": "d2eaca446bbba8640fc7332c748b7c5d",
"sha256": "1fbf51accf586e376a0f0f72656a527b4e97e72cb8fba4165a8ff3a5476a15fb"
},
"downloads": -1,
"filename": "Kala_Qubits-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d2eaca446bbba8640fc7332c748b7c5d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 4437,
"upload_time": "2024-12-15T12:28:59",
"upload_time_iso_8601": "2024-12-15T12:28:59.786382Z",
"url": "https://files.pythonhosted.org/packages/29/29/5e1ad8742bc860d684c76aff1fd09ed9c529ddd5ecdb9bb5660cbf5dbb0c/Kala_Qubits-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fba7acd70c8726d1c0ca24215e4d54ea6c1905ae5558b17a35d98bcd6f297855",
"md5": "ce39a23727e4d2e13553f2f4a4002d7c",
"sha256": "cd307a69d5724f8e90571ed82846ad920836cba1cb1bfc45f57cad6fa6ea08c4"
},
"downloads": -1,
"filename": "kala_qubits-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "ce39a23727e4d2e13553f2f4a4002d7c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 4108,
"upload_time": "2024-12-15T12:29:01",
"upload_time_iso_8601": "2024-12-15T12:29:01.415590Z",
"url": "https://files.pythonhosted.org/packages/fb/a7/acd70c8726d1c0ca24215e4d54ea6c1905ae5558b17a35d98bcd6f297855/kala_qubits-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-15 12:29:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Kalasaikamesh944",
"github_project": "Qubits",
"github_not_found": true,
"lcname": "kala-qubits"
}