uniqc.pytorch.batch_executor module#
Batch execution utilities for quantum circuits.
Provides parallel execution of multiple circuits using ThreadPoolExecutor or multiprocessing for performance optimization.
- uniqc.pytorch.batch_executor.batch_execute(circuits, executor, n_workers=4)[source]#
Execute multiple circuits in parallel.
- Parameters:
- Returns:
List of results from each circuit execution
- Return type:
list[np.ndarray]
Example
>>> def simulate(c): ... sim = OriginIR_Simulator() ... return sim.simulate(c.originir) >>> results = batch_execute([c1, c2, c3], simulate, n_workers=4)
- uniqc.pytorch.batch_executor.batch_execute_with_params(circuit_template, param_values, executor, n_workers=4)[source]#
Execute a circuit template with different parameter bindings.
Creates multiple bound circuits from a template and executes them in parallel.
- Parameters:
- Returns:
List of results from each parameter binding
- Return type:
list[np.ndarray]
Example
>>> params = [{'theta': 0.1}, {'theta': 0.2}, {'theta': 0.3}] >>> results = batch_execute_with_params(circuit, params, simulate)