ScanPartitioner

class ScanPartitioner(block_size, scoring_fn=<function default_scoring_fn>)[source]

Bases: BasePass

The ScanPartitioner Pass.

This pass forms partitions in the circuit by scanning from left to right. This is based on the partitioner from QGo.

References

Wu, Xin-Chuan, et al. “QGo: Scalable Quantum Circuit Optimization Using Automated Synthesis.” arXiv preprint arXiv:2012.09835 (2020).

__init__(block_size, scoring_fn=<function default_scoring_fn>)[source]

Construct a ScanPartitioner.

Parameters:
  • block_size (int) – Maximum size of partitioned blocks. (Default: 3)

  • scoring_fn (Callable[[list[Operation]], float]) – This function is used to score potential blocks. This takes in a list of operations in the potential block and returns a float. (Default: default_scoring_fn)

Raises:

ValueError – If block_size is less than 2.

Attributes

name

The name of the pass.

Methods

calculate_block(qudit_group, circuit, ...)

Calculate the best block for qudit_group right of the divider.

calculate_initial_blocks(qudit_groups, circuit)

Calculate the initial blocks for all qudit groups.

calculate_qudit_group_map(qudit_groups)

Calculate a map from qudits to qudit_groups containing that qudit.

calculate_qudit_groups(circuit)

Calculate the groups of qudits that grouped in a partition.

execute(*args, **kwargs)

Map a function over iterable arguments in parallel.

find_best_block(potential_blocks)

Find and return the current best scoring block.

fold_circuit(circuit, regions)

Partition circuit into blocks described in regions.

get_connectivity(_, data)

Retrieve the current connectivity of the circuit.

get_model(_, data)

Retrieve the machine model from the data dictionary.

get_placement(_, data)

Retrieve the logical to physical qubit map from the data dictionary.

get_target(_, data)

Retrieve the target from the data dictionary.

in_parallel(data)

Return true if pass is being executed in a parallel.

run(circuit, data)

Perform the pass's operation, see BasePass for more.