The Qibo framework in this repository implements a common system to deal with classical hardware and future quantum hardware.
The code abstraction is located in
qibo/abstractions and the core simulation
engine is located in
qibo/core. This simulation engine uses an abstract
K to perform calculation the structure of which is defined in
qibo.abstractions.circuit.AbstractCircuit: base class with attributes and abstract methods for circuit execution.
qibo.abstractions.states.AbstractState: data structure with tensor representation and state properties.
qibo.abstractions.gates.Gate: implementation of standard gates and respective class attributes, virtual methods for gate matrix construction and operation.
qibo.backends.abstract.AbstractBackend: virtual methods for the most common linear algebra operations.
qibo.abstractions.hamiltonians.AbstractHamiltonian: virtual methods for quantum operators math operations.
Including a new backend
New backends can be implemented by inheriting the
qibo.backends.abstract.AbstractBackend and implementing its abstract
methods. In particular the developer should:
Register the new backend in
src/qibo/backends/profiles.yml, or point to a new profile file with the environment flag
Load your backend with
qibo.set_backend("your_backend_name")or use the environment flag
Here you have an example for the structure of the
backends: # simulation backends - numpy is available by default - name: tensorflow class: TensorflowBackend from: qibo.backends.tensorflow - name: qibotf class: TensorflowCustomBackend from: qibo.backends.tensorflow - name: qibojit class: JITCustomBackend from: qibo.backends.jit # hardware backends - name: qiboicarusq class: IcarusQBackend from: qibo.backends.hardware is_hardware: True # default active backend after importing all modules default: qibojit
When including a new backend, you should include its:
name: The name of the new backend.
class: The class which performs the inheritance from
from: The python module containing the value pointed by the
Finally, the default backend which is loaded when importing Qibo can be updated
by changing the value of the
Examples and tutorials
examples folder contains benchmark code for applications/tutorials
described in Applications while
contains some code for benchmarking only.