Compilation and Synthesis Algorithms (bqskit.passes)

Partitioning Passes

These passes will group together gates in the circuit. It is recommended to use the QuickPartitioner currently.

ClusteringPartitioner([block_size, num_points])

The ClusteringPartitioner Pass.

GreedyPartitioner([block_size])

The GreedyPartitioner Pass.

ScanPartitioner(block_size[, scoring_fn])

The ScanPartitioner Pass.

QuickPartitioner([block_size])

A partitioner that iterates over circuit gates only once.

GroupSingleQuditGatePass()

The GroupSingleQuditGatePass Pass.

Synthesis Passes

These passes perform synthesis. Decomposition passes break down unitaries into smaller ones and will need to be followed up by another synthesis pass to convert the circuit to native gates.

LEAPSynthesisPass([heuristic_function, ...])

A pass implementing the LEAP search synthesis algorithm.

QSearchSynthesisPass([heuristic_function, ...])

A pass implementing the QSearch A* synthesis algorithm.

QFASTDecompositionPass([gate, ...])

A pass performing one round of decomposition from the QFAST algorithm.

QPredictDecompositionPass([...])

The QPredictDecompositionPass class.

SynthesisPass()

SynthesisPass abstract class.

Processing Passes

ExhaustiveGateRemovalPass([...])

The ExhaustiveGateRemovalPass class.

IterativeScanningGateRemovalPass([...])

The IterativeScanningGateRemovalPass class.

ScanningGateRemovalPass([start_from_left, ...])

The ScanningGateRemovalPass class.

SubstitutePass(collection_filter, gate[, ...])

The SubstitutePass class.

Retargeting Passes

AutoRebase2QuditGatePass([max_depth, ...])

The AutoRebase2QuditGatePass class.

GeneralSQDecomposition()

Convert to a general single-qudit gate from the model's gate set.

Rebase2QuditGatePass(gate_in_circuit, new_gate)

The Rebase2QuditGatePass class.

Control Passes

This are passes that are used to manage control flow inside of a workflow.

DoWhileLoopPass(condition, loop_body)

The DoWhileLoopPass class.

ForEachBlockPass(loop_body[, ...])

A pass that executes other passes on each block in the circuit.

IfThenElsePass(condition, on_true[, on_false])

The IfThenElsePass class.

WhileLoopPass(condition, loop_body)

The WhileLoopPass class.

DoThenDecide(condition, workflow)

The DoThenDecide class.

ParallelDo(pass_sequences, less_than[, ...])

The ParallelDo class.

Predicates

This objects are designed as conditions for use with control passes.

PassPredicate()

The PassPredicate abstract base class.

ChangePredicate()

The ChangePredicate class.

GateCountPredicate(gate)

The GateCountPredicate class.

ManyQuditGatesPredicate([check_circuit, ...])

Check if many-qudit gates are in the circuit and/or model.

NotPredicate(predicate)

The NotPredicate class.

WidthPredicate(width)

The WidthPredicate class.

PhysicalPredicate()

The PhysicalPredicate class.

SinglePhysicalPredicate()

The SinglePhysicalPredicate class.

MultiPhysicalPredicate()

The MultiPhysicalPredicate class.

NoSingleQuditGatesInModel()

A predicate that checks if the model has single qudit gates.

HasGeneralSingleQuditGate()

A predicate that checks if the model has a general single qudit gate.

ZXGatePredicate()

A predicate that checks if the model has a RZ or U1 and SX or RX gate.

AllConstantSingleQuditGates()

A predicate that checks if all single qudit gates are constant.

Rule-based Passes

These passes apply fixed rules to a circuit to transform it.

CHToCNOTPass()

The CHToCNOTPass class.

CNOTToCZPass()

The CNOTToCZPass class.

CNOTToCHPass()

The CNOTToCHPass class.

CNOTToCYPass()

The CNOTToCYPass class.

CYToCNOTPass()

The CYToCNOTPass class.

SwapToCNOTPass()

The SwapToCNOTPass class.

U3Decomposition()

The U3Decomposition class.

ZXZXZDecomposition([always_use_rx, ...])

The ZXZXZDecomposition class.

Mapping Passes

These passes either perform qubit placement, layout, routing or otherwise are involved the qubit mapping process.

GeneralizedSabreLayoutPass([total_passes, ...])

Uses the Sabre algorithm to layout the circuit.

GreedyPlacementPass()

Find a placement by starting with the most connected qudit.

TrivialPlacementPass()

Place the logical qubits on the first n physical qubits.

GeneralizedSabreRoutingPass([decay_delta, ...])

Uses the Sabre algorithm to route the circuit.

SetModelPass(model)

Sets a target machine model for future passes to target.

ApplyPlacement()

Place the circuit on the machine model.

SubtopologySelectionPass(block_size)

Pass that selects necessary subtopologies from the model.

PAMLayoutPass([total_passes, ...])

Layout algorithm using permutation-aware mapping.

PAMRoutingPass([gate_count_weight, ...])

EmbedAllPermutationsPass([input_perm, ...])

Embed permutation aware synthesis results into a flow for future use.

ExtractModelConnectivityPass()

Extracts and saves the current target machine model's connectivity.

RestoreModelConnevtivityPass()

Restores the connectivity of the target machine model.

PAM Verification Passes

These passes either perform upper-bound error analysis of the PAM process.

TagPAMBlockDataPass CalculatePAMErrorsPass UnTagPAMBlockDataPass PAMVerificationSequence

Utility Passes

CompressPass()

The CompressPass class.

RecordStatsPass()

The RecordStatsPass class.

SetRandomSeedPass([seed])

The SetRandomSeedPass class.

UnfoldPass()

The UnfoldPass class.

UpdateDataPass(key, val)

The UpdateDataPass class.

ToU3Pass([convert_all_single_qubit_gates])

Converts single-qubit general unitary gates to U3 Gates.

ToVariablePass([convert_all_single_qudit_gates])

Converts single-qudit general unitary gates to Variable Unitary Gates.

BlockConversionPass(convert_target[, ...])

Converts blocks of one type to another type.

LogPass(msg[, level])

A pass that logs a message to the BQSKit log.

ExtendBlockSizePass([minimum_size])

Ensure all blocks are at least a given size.

LogErrorPass([error_threshold])

A pass that logs the current error to the BQSKit log.

FillSingleQuditGatesPass()

A pass that inserts single-qudit gates around multi-qudit gates.

StructureAnalysisPass()

A pass that catalogs circuit structures used in a partitioned circuit.

ClearAllBlockData()

Clear all block data and passed down data from the pass data.

IO Passes

LoadCheckpointPass(checkpoint_filename)

The LoadCheckpointPass class.

SaveCheckpointPass(checkpoint_filename)

The SaveCheckpointPass class.

SaveIntermediatePass(path_to_save_dir[, ...])

The SaveIntermediate class.

RestoreIntermediatePass(project_directory[, ...])

Search Heuristics

HeuristicFunction()

The HeuristicFunction base class.

AStarHeuristic([heuristic_factor, ...])

The AStarHeuristic HeuristicFunction class.

GreedyHeuristic([cost_gen])

The GreedyHeuristic HeuristicFunction class.

DijkstraHeuristic()

The DijkstraHeuristic HeuristicFunction class.

Search Layer Generators

Layer generators can be used to modify how search based synthesis algorithms extend circuit templates.

FourParamGenerator()

The FourParamGenerator class.

MiddleOutLayerGenerator()

Layer Generator for search that adds gates at each time step.

SeedLayerGenerator(seed[, ...])

Layer Generator for search that starts from a seed.

SimpleLayerGenerator([two_qudit_gate, ...])

The SimpleLayerGenerator class.

SingleQuditLayerGenerator(gates[, allow_repeats])

The SingleQuditLayerGenerator class.

StairLayerGenerator(gate)

Layer Generator for search that builds circuits from a single gate.

WideLayerGenerator([multi_qudit_gates, ...])

A layer generator for use with wide gates like an iToffoli.