Module: cirq.contrib.acquaintance

Tools for creating and using acquaintance strategies.

In quantum circuit compilation, an "acquaintance strategy" refers to a systematic routing or swapping algorithm designed to bring specific logical qubits into close physical proximity on a hardware processor so they can interact.

On near-term physical quantum hardware, qubits have restricted connectivity and can typically only execute gates with their immediate physical neighbors. If a quantum algorithm requires an operation between qubits that are physically far apart on the chip, the compiler must insert a sequence of SWAP gates to move them next to each other.

An "acquaintance opportunity" is defined as the exact moment when the required target logical qubits are successfully brought together on adjacent physical qubits. An acquaintance strategy is the overarching algorithmic plan---often using linear swap networks or permutation logic---that ensures all the required combinations of qubits get "acquainted" over the course of the circuit's execution.

Within the Cirq contrib module for acquaintance, the following are some key elements of the implementation:

  • AcquaintanceOperation: An operation representing an "acquaintance opportunity" between a set of logical qubits on specific physical qubits.

StrategyExecutor and StrategyExecutorTransformer: Classes responsible for executing a defined acquaintance strategy on a given circuit.

• Various strategies: The module provided different strategies for creating the necessary swap networks to bring qubits together, such as cubic_acquaintance_strategy and quartic_paired_acquaintance_strategy.

See https://arxiv.org/abs/1905.05118 for a paper detailing acquaintance strategies.

Modules

bipartite module

devices module

executor module

gates module

inspection_utils module

mutation_utils module

optimizers module

permutation module

shift module

shift_swap_network module

strategies module: Acquaintance strategies.

testing module

topological_sort module

Classes

class AcquaintanceOperation: Represents an a acquaintance opportunity between a particular set of logical indices on a particular set of physical qubits.

class AcquaintanceOpportunityGate: Represents an acquaintance opportunity.

class BipartiteGraphType: Create a collection of name/value pairs.

class BipartiteSwapNetworkGate: A swap network that acquaints qubits in one half with qubits in the other.

class CircularShiftGate: Performs a cyclical permutation of the qubits to the left by a specified amount.

class GreedyExecutionStrategy: A greedy execution strategy.

class LinearPermutationGate: A permutation gate that decomposes a given permutation using a linear sorting network.

class PermutationGate: A permutation gate indicates a change in the mapping from qubits to logical indices.

class ShiftSwapNetworkGate: A swap network that generalizes the circular shift gate.

class StrategyExecutorTransformer: Executes an acquaintance strategy.

class SwapNetworkGate: A single gate representing a generalized swap network.

class SwapPermutationGate: Generic swap gate.

Functions

DECOMPOSE_PERMUTATION_GATES(...)

EXPAND_PERMUTATION_GATES(...)

acquaint(...)

complete_acquaintance_strategy(...): Returns an acquaintance strategy with can handle the given number of qubits.

cubic_acquaintance_strategy(...): Acquaints every triple of qubits.

display_mapping(...): Inserts display gates between moments to indicate the mapping throughout the circuit.

expose_acquaintance_gates(...): Decomposes permutation gates that provide acquaintance opportunities.

get_acquaintance_size(...): The maximum number of qubits to be acquainted with each other.

get_logical_acquaintance_opportunities(...)

get_logical_operations(...): Gets the logical operations specified by the physical operations and initial mapping.

is_topologically_sorted(...): Whether a given order of operations is consistent with the DAG.

quartic_paired_acquaintance_strategy(...): Acquaintance strategy for pairs of pairs.

random_topological_sort(...)

rectify_acquaintance_strategy(...): Splits moments so that they contain either only acquaintance or permutation gates.

remove_redundant_acquaintance_opportunities(...): Removes redundant acquaintance opportunities.

replace_acquaintance_with_swap_network(...): Replace every rectified moment with acquaintance gates with a generalized swap network.

return_to_initial_mapping(...)

update_mapping(...): Updates a mapping (in place) from qubits to logical indices according to a set of permutation gates.

uses_consistent_swap_gate(...)

UnconstrainedAcquaintanceDevice Instance of cirq.contrib.acquaintance.devices._UnconstrainedAcquaintanceDevice