SeedLayerGenerator

class SeedLayerGenerator(seed, forward_generator=<bqskit.passes.search.generators.simple.SimpleLayerGenerator object>, num_removed=1, hash_on_1q_gate=False)[source]

Bases: LayerGenerator

Layer Generator for search that starts from a seed.

__init__(seed, forward_generator=<bqskit.passes.search.generators.simple.SimpleLayerGenerator object>, num_removed=1, hash_on_1q_gate=False)[source]

Construct a SeedLayerGenerator.

Parameters:
  • seed (Circuit | Sequence[Circuit]) – The seed or seeds to start synthesis from.

  • forward_generator (LayerGenerator) – A generator used to grow the circuit. (Default: SimpleLayerGenerator)

  • num_removed (int) – The number of atomic gate units removed from the circuit in each backwards branch. If 0, no backwards traversal of the synthesis tree will be done. (Default: 1)

  • hash_on_1q_gate (bool) – If True, 1 qubit gates that appear in circuit templates will be used in circuit hash calculations. Otherwise only multi-qubit gates will be used. Setting this value to False can help stability when using more complex LayerGenerators for the forward_generator. (Default: False)

Raises:

ValueError – If ‘num_removed’ is negative.

Methods

gen_initial_layer(target, data)

Generate the initial layer, see LayerGenerator for more.

gen_successors(circuit, data)

Generate the successors of a circuit node.

hash_structure(circuit[, hash_on_1q_gate])

Compute a hash of the Circuit's structure.

remove_atomic_units(circuit)

Return circuits after removing upto self.num_removed atomic units.