Qibo
Qibo is a large open-source quantum ecosystem with many applications and tutorials to explore. It has a decently fast simulator to boot on CPUs and GPUs. It has a full-stack API for quantum simulation and quantum hardware control. The extra learning materials are available through the platforms for Qibo.
The following example implements a basic quantum circuit that performs a Quantum Fourier Transform (QFT) on two qubits.
Getting Started
Below is a base example for creating and running the Qibo
simulator:
import numpy as np
from qibo import models, gates
# Define a quantum circuit with 2 qubits
circuit = models.Circuit(2)
# Apply Hadamard gate on the first qubit
circuit.add(gates.H(0))
# Apply controlled phase rotation gates
circuit.add(gates.CU1(0, 1, theta=np.pi / 2))
# Apply Hadamard gate on the second qubit
circuit.add(gates.H(1))
# Swap qubits 0 and 1 for the final step of QFT
circuit.add(gates.SWAP(0, 1))
# Execute the circuit on the default simulator
result = circuit()
# Print the result (wavefunction)
print("Quantum Fourier Transform Result:", result.state())
Code Insights
- Import the necessary dependencies.
- Define the quantum circuit with two qubits.
- Hints between the lines:
- The
gates.H()
is creating a single qubit Hadamard gate. - The
CU1
is the controlled rotation that creates the phase shift for QFT ,thetheta=
is to apply the phase shift. - The
gates.SWAP()
swaps the qubits to reverse their positions as part of the QFT.
- The
- Print out the circuit.
Follow up on the GWDG Updates:
- Qibo
- The version of GPU supported Qibo provided by GWDG: 0.2.8v
- The version of CPU supported Qibo provided by GWDG: 0.2.13v
Key Features
User-friendly: Qibo is a quantum computing framework that prioritizes user-friendliness and strong performance. Designed for both beginners and experts, Qibo offers a simple interface for building and simulating quantum circuits, as well as support for hybrid classical-quantum algorithms.
Qibo is created with simplicity as a priority, offering a straightforward and user-friendly interface for building and running quantum circuits, thus making it easy for beginners in quantum computing.
Multiple Backend Support: Qibo offers support for various backends such as CPU, GPU, and distributed architectures to enable users to adjust the size of their simulations according to the computational resources at hand.
Variational Algorithms: The framework includes pre-built components for variational quantum algorithms such as VQE and QAOA, which are essential for solving optimization problems on quantum hardware.
Quantum Error Mitigation: With built-in tools for error mitigation, Qibo helps users simulate realistic quantum environments and develop techniques to improve the accuracy of noisy quantum computations.
Supplementary Modules
Command | Description |
---|---|
on_qubits(*qubits) | Generator of gates contained in the circuit acting on specified qubits. |
light_cone(*qubits) | Reduces circuit to the qubits relevant for an observable. |
copy(deep: bool = False) | Creates a copy of the current circuit as a new circuit model. |
dagger() | Returns the dagger (conjugate transpose) of the gate. |
decompose(*free) | Decomposes multi-control gates to gates. |
matrix(backend=None) | Returns the matrix representation of the gate. |
generator_eigenvalue() | This function returns the eigenvalues of the gate’s generator. |
basis_rotation() | Transformation required to rotate the basis for measuring the gate. |
add(error, gate:) | Add a quantum error for a specific gate and qubit to the noise model. |
eigenvalues(k= Number of eigenvalues to calculate) | Computes the eigenvalues for the Hamiltonian. |
eigenvectors(k=Number of eigenvalues to calculate) | Computes a tensor with the eigenvectors for the Hamiltonian. |
ground_state() | Computes the ground state of the Hamiltonian. |
qibo.quantum_info.shannon_entropy(prob_dist, base: float = 2, backend=None) | Calculate the Shannon entropy of a probability array. |
The fundamental explanations behind of these functions,operators and states and more can be found on the official Qibo webpage.