Divi
Divi: High-Level Quantum Program Development
Divi is Qoro’s open-source Python library for building, executing, and managing quantum programs. It provides high-level abstractions for variational quantum algorithms, combinatorial optimization, quantum chemistry, and Hamiltonian simulation — with built-in support for parallel execution, error mitigation, checkpointing, and multi-backend deployment.
Divi handles the complexity of quantum-classical hybrid workflows so you can focus on the problem, not the plumbing.
Core Concepts
Quantum Programs
Every quantum workload in Divi is a QuantumProgram — a composable unit that encapsulates circuit generation, parameter management, execution, and result processing. Higher-level constructs like VQE, QAOA, and PCE all extend this base.
Parallel Execution
Divi’s execution model is inherently parallel. Whether running locally on ParallelSimulator or remotely via QoroService, circuits are dispatched in batches and results are aggregated automatically.
Backends
| Backend | Description |
|---|---|
ParallelSimulator |
Local multi-threaded simulation using Qiskit Aer or Maestro |
QoroService |
Cloud execution through Composer, with access to Maestro and QPU hardware |
Built-In Algorithms
| Algorithm | Use Case |
|---|---|
| VQE | Ground-state energy estimation for quantum chemistry |
| QAOA | Combinatorial optimization (MaxCut, Max-Clique, QUBO, etc.) |
| PCE | Pauli Correlation Encoding — logarithmic qubit reduction for QUBO problems |
| TimeEvolution | Hamiltonian time evolution via Trotter-Suzuki decomposition |
| CustomVQA | Optimize any parameterized PennyLane or Qiskit circuit |
Workflows
| Workflow | Description |
|---|---|
| GraphPartitioningQAOA | Divide-and-conquer QAOA on large graphs via partitioning |
| QUBOPartitioningQAOA | Partitioned QAOA for large QUBO problems |
| VQEHyperparameterSweep | Sweep bond lengths and ansatze for molecular energy surfaces |
Ansatze
Divi provides a library of parameterized circuit templates:
| Ansatz | Description |
|---|---|
HartreeFockAnsatz |
Chemistry-inspired initial state |
UCCSDAnsatz |
Unitary Coupled Cluster Singles and Doubles |
QAOAAnsatz |
Standard QAOA mixer/cost layers |
HardwareEfficientAnsatz |
Hardware-native entangling layers |
GenericLayerAnsatz |
Custom gate sequences repeated in layers |
All ansatze extend the Ansatz abstract base class. Custom ansatze can be created by subclassing it.
Optimizers
Divi offers classical optimizers as composable objects:
| Optimizer | Type | Method |
|---|---|---|
ScipyOptimizer |
Gradient-based & gradient-free | L-BFGS-B, Nelder-Mead, COBYLA, and all SciPy methods |
MonteCarloOptimizer |
Stochastic global search | Random parameter sampling |
PymooOptimizer |
Evolutionary | CMA-ES, Differential Evolution |
See the Optimizers page for details.
Circuit Transformations
- Observable Grouping — Reduces measurement overhead by grouping commuting observables
- Zero-Noise Extrapolation (ZNE) — Error mitigation via Mitiq integration
See Circuit Transformations for examples.
Additional Features
Checkpointing
Save and resume optimization state at any iteration. Useful for long-running VQE/QAOA jobs on cloud backends. See Checkpointing for details.
Top-N Solutions API
Access the best solutions found during optimization via get_top_solutions(), with probability-ranked results and decoded variable assignments (for PCE).
Circuit Depth Tracking
All backends automatically track circuit depths during execution, enabling performance analysis and depth-reduction strategies.
BinaryQuadraticModel Support
QAOA and PCE accept D-Wave’s BinaryQuadraticModel as input, in addition to NumPy arrays and sparse matrices.
Quick Start
from divi import ParallelSimulator
from divi.qprog import QAOA, GraphProblem
from divi.qprog.optimizers import ScipyOptimizer, ScipyMethod
import networkx as nx
G = nx.random_regular_graph(3, 10, seed=42)
qaoa = QAOA(
problem=G,
graph_problem=GraphProblem.MAXCUT,
n_layers=2,
optimizer=ScipyOptimizer(ScipyMethod.COBYLA),
max_iterations=20,
backend=ParallelSimulator(),
)
qaoa.run()
qaoa.compute_final_solution()
print(f"Solution: {qaoa.solution}")Installation
pip install qoro-diviFor cloud execution, set your API key:
from divi import QoroService, JobConfig
backend = QoroService("your-api-key", config=JobConfig(shots=5000))