# amin-qvm Library Documentation
## Overview
The **amin-qvm** library has good tools for simulating quantum algorithms and neural networks. It has classes for quantum state manipulation, representation of quantum gates, and implementations of algorithms like Grover and Deutsch-Jozsa.
## Modules in the Library
### novum
#### Class: Novum
This is the primary class representing a quantum system.
- **Initialization:** `Novum(num_qubits: int)`
Initiates a quantum system with a specified number of qubits.
- **Methods:**
- `execute_qasm(qasm_code: str):` Executes QASM code on the quantum system.
- `convert_to_binary(input_data: str, num_bits: int):` Converts CSV data into binary representation.
- `prepare_classical_state(input_data):` Prepares the quantum state based on classical binary input data.
- `apply_gate(gate_matrix: np.ndarray, qubit_indices: List[int]):` Applies a specified gate to the qubits of the quantum system.
- `apply_oracle(b1, b2, entanglements):` Applies an oracle gate to the qubits using the specified entanglements.
- `measure_qubits():` Measures the qubits and returns the outcome.
- `plot_results(title="Measurement Results"):` Plots the measurement outcomes of the qubits.
### gates
Defines an assortment of quantum gates represented as NumPy arrays.
- **Gate Variables:**
PauliX, PauliY, PauliZ, Hadamard, Identity, S, T, CNOT, SWAP, etc.
- **Functions:**
PhaseShift(theta): Returns a phase shift gate for a given angle.
Rx(theta), Ry(theta), Rz(theta): Rotation gates around the x, y, and z-axis.
### qasm_processing
Provides functions for converting QASM code into executable Python code using the Novum library.
- **Functions:**
`qasm_to_python(qasm_code: str):` Converts QASM code into Python code commands for the Novum system.
### tools
Functions supporting quantum neural network operations.
- **Functions:**
`update_weights(...), compute_gradients(...), initialize_weights(...), apply_layer(...), forward_pass(...), calculate_loss(...), train_qnn(...)`
### equations
Basic mathematical functions used in quantum computing.
- **Functions:**
`inner_product(...), eigen(...), dot_product(...), normalize_state(...), tensor_product(...), is_unitary(...)`
### grover
Implements Grover's search algorithm as a class.
- **Class: Grover**
- **Initialization:** `Grover(data: list[str], target: str, iterations: int = 1)`
- **Methods:**
- `run():` Executes the Grover search algorithm.
- `prepare_superposition_state():` Sets up the initial superposition across all qubits.
- `apply_oracle():` Applies the oracle function.
- `apply_diffusion_operator():` Applies the diffusion (inversion about the mean) operator.
### deutschjozsa
Implementation of the Deutsch-Jozsa algorithm as a class.
- **Class: DeutschJozsa**
- Inherits from Novum.
- **Initialization:** `DeutschJozsa(num_qubits: int, f)`
- **Methods:**
- `oracle():` Encodes the provided function f into the quantum oracle.
- `run():` Executes the Deutsch-Jozsa algorithm to determine if the function f is constant or balanced.
## Usage
### Installation
```pip install amin-qvm```
### Setting Up the Environment
Make sure you have Python installed on your system, because like, how else are you going to use the library :)
### Creating a Novum Instance
To create a Novum system and run QASM:
```python
from amin_qvm.system.novum import Novum
# Create an instance with 2 qubits
novum = Novum(2)
# Run QASM code
qasm_code = """
qreg[2];
cx 0,1;
h 0;
measure;
"""
novum.execute_qasm(qasm_code)
```
### Applying Gates and Running Algorithms
```python
from amin_qvm.system.gates import Hadamard
from amin_qvm.algorithms.grover import Grover
# Initialize Grover's algorithm with data and target
grover = Grover(data=["00", "01", "10", "11"], target="10")
grover.run()
```
Raw data
{
"_id": null,
"home_page": "https://pypi.org/project/amin-qvm/",
"name": "amin-qvm",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "quantum computing library simulation amin alogaili QVM aminalogaili novum",
"author": "Amin Alogaili",
"author_email": "aminalogai@aol.com",
"download_url": "",
"platform": null,
"description": "# amin-qvm Library Documentation\r\n\r\n## Overview\r\n\r\nThe **amin-qvm** library has good tools for simulating quantum algorithms and neural networks. It has classes for quantum state manipulation, representation of quantum gates, and implementations of algorithms like Grover and Deutsch-Jozsa.\r\n\r\n## Modules in the Library\r\n\r\n### novum\r\n\r\n#### Class: Novum\r\n\r\nThis is the primary class representing a quantum system.\r\n\r\n- **Initialization:** `Novum(num_qubits: int)`\r\n Initiates a quantum system with a specified number of qubits.\r\n\r\n- **Methods:**\r\n - `execute_qasm(qasm_code: str):` Executes QASM code on the quantum system.\r\n - `convert_to_binary(input_data: str, num_bits: int):` Converts CSV data into binary representation.\r\n - `prepare_classical_state(input_data):` Prepares the quantum state based on classical binary input data.\r\n - `apply_gate(gate_matrix: np.ndarray, qubit_indices: List[int]):` Applies a specified gate to the qubits of the quantum system.\r\n - `apply_oracle(b1, b2, entanglements):` Applies an oracle gate to the qubits using the specified entanglements.\r\n - `measure_qubits():` Measures the qubits and returns the outcome.\r\n - `plot_results(title=\"Measurement Results\"):` Plots the measurement outcomes of the qubits.\r\n\r\n### gates\r\n\r\nDefines an assortment of quantum gates represented as NumPy arrays.\r\n\r\n- **Gate Variables:**\r\n PauliX, PauliY, PauliZ, Hadamard, Identity, S, T, CNOT, SWAP, etc.\r\n\r\n- **Functions:**\r\n PhaseShift(theta): Returns a phase shift gate for a given angle.\r\n Rx(theta), Ry(theta), Rz(theta): Rotation gates around the x, y, and z-axis.\r\n\r\n### qasm_processing\r\n\r\nProvides functions for converting QASM code into executable Python code using the Novum library.\r\n\r\n- **Functions:**\r\n `qasm_to_python(qasm_code: str):` Converts QASM code into Python code commands for the Novum system.\r\n\r\n### tools\r\n\r\nFunctions supporting quantum neural network operations.\r\n\r\n- **Functions:**\r\n `update_weights(...), compute_gradients(...), initialize_weights(...), apply_layer(...), forward_pass(...), calculate_loss(...), train_qnn(...)`\r\n\r\n### equations\r\n\r\nBasic mathematical functions used in quantum computing.\r\n\r\n- **Functions:**\r\n `inner_product(...), eigen(...), dot_product(...), normalize_state(...), tensor_product(...), is_unitary(...)`\r\n\r\n### grover\r\n\r\nImplements Grover's search algorithm as a class.\r\n\r\n- **Class: Grover**\r\n - **Initialization:** `Grover(data: list[str], target: str, iterations: int = 1)`\r\n - **Methods:**\r\n - `run():` Executes the Grover search algorithm.\r\n - `prepare_superposition_state():` Sets up the initial superposition across all qubits.\r\n - `apply_oracle():` Applies the oracle function.\r\n - `apply_diffusion_operator():` Applies the diffusion (inversion about the mean) operator.\r\n\r\n### deutschjozsa\r\n\r\nImplementation of the Deutsch-Jozsa algorithm as a class.\r\n\r\n- **Class: DeutschJozsa**\r\n - Inherits from Novum.\r\n - **Initialization:** `DeutschJozsa(num_qubits: int, f)`\r\n - **Methods:**\r\n - `oracle():` Encodes the provided function f into the quantum oracle.\r\n - `run():` Executes the Deutsch-Jozsa algorithm to determine if the function f is constant or balanced.\r\n\r\n## Usage\r\n\r\n### Installation\r\n\r\n```pip install amin-qvm```\r\n\r\n### Setting Up the Environment\r\n\r\nMake sure you have Python installed on your system, because like, how else are you going to use the library :)\r\n\r\n### Creating a Novum Instance\r\n\r\nTo create a Novum system and run QASM:\r\n\r\n```python\r\nfrom amin_qvm.system.novum import Novum\r\n\r\n# Create an instance with 2 qubits\r\nnovum = Novum(2)\r\n\r\n# Run QASM code\r\nqasm_code = \"\"\"\r\nqreg[2];\r\ncx 0,1;\r\nh 0;\r\nmeasure;\r\n\"\"\"\r\nnovum.execute_qasm(qasm_code)\r\n```\r\n\r\n### Applying Gates and Running Algorithms\r\n\r\n```python\r\nfrom amin_qvm.system.gates import Hadamard\r\nfrom amin_qvm.algorithms.grover import Grover\r\n\r\n# Initialize Grover's algorithm with data and target\r\ngrover = Grover(data=[\"00\", \"01\", \"10\", \"11\"], target=\"10\")\r\ngrover.run()\r\n```\r\n",
"bugtrack_url": null,
"license": "",
"summary": "Amin-QVM: Quantum Computing Library With Built In Novum QVM",
"version": "2.0.0",
"project_urls": {
"Homepage": "https://pypi.org/project/amin-qvm/"
},
"split_keywords": [
"quantum",
"computing",
"library",
"simulation",
"amin",
"alogaili",
"qvm",
"aminalogaili",
"novum"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "61b852d07081848e53d331f13be0ed1cb1912c5f473a5bb01ced20c653777370",
"md5": "29b21fdde8e51604fc11852d39bf56b6",
"sha256": "7cddcc49ce2c7a312b9ff8aee02959e6cf0e6acc4096e8ad2d934105475b5896"
},
"downloads": -1,
"filename": "amin_qvm-2.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "29b21fdde8e51604fc11852d39bf56b6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 3334,
"upload_time": "2024-01-01T19:22:20",
"upload_time_iso_8601": "2024-01-01T19:22:20.661845Z",
"url": "https://files.pythonhosted.org/packages/61/b8/52d07081848e53d331f13be0ed1cb1912c5f473a5bb01ced20c653777370/amin_qvm-2.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-01 19:22:20",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "amin-qvm"
}