Korean
언어
English
Japanese
German
Korean
Shortcuts

qiskit.circuit.EquivalenceLibrary

class EquivalenceLibrary(*, base=None)[소스]

A library providing a one-way mapping of Gates to their equivalent implementations as QuantumCircuits.

Create a new equivalence library.

매개변수

base (Optional[EquivalenceLibrary]) – Base equivalence library to will be referenced if an entry is not found in this library.

__init__(*, base=None)[소스]

Create a new equivalence library.

매개변수

base (Optional[EquivalenceLibrary]) – Base equivalence library to will be referenced if an entry is not found in this library.

Methods

__init__(*[, base])

Create a new equivalence library.

add_equivalence(gate, equivalent_circuit)

Add a new equivalence to the library.

draw([filename])

Draws the equivalence relations available in the library.

get_entry(gate)

Gets the set of QuantumCircuits circuits from the library which equivalently implement the given Gate.

has_entry(gate)

Check if a library contains any decompositions for gate.

set_entry(gate, entry)

Set the equivalence record for a Gate.

add_equivalence(gate, equivalent_circuit)[소스]

Add a new equivalence to the library. Future queries for the Gate will include the given circuit, in addition to all existing equivalences (including those from base).

Parameterized Gates (those including qiskit.circuit.Parameters in their Gate.params) can be marked equivalent to parameterized circuits, provided the parameters match.

매개변수
  • gate (Gate) – A Gate instance.

  • equivalent_circuit (QuantumCircuit) – A circuit equivalently implementing the given Gate.

draw(filename=None)[소스]

Draws the equivalence relations available in the library.

매개변수

filename (str) – An optional path to write the output image to if specified this method will return None.

반환값

Drawn equivalence library.

반환 형식

PIL.Image

예외

ImportError – when pydot or pillow are not installed.

get_entry(gate)[소스]

Gets the set of QuantumCircuits circuits from the library which equivalently implement the given Gate.

Parameterized circuits will have their parameters replaced with the corresponding entries from Gate.params.

매개변수

gate (Gate) – A Gate instance.

반환값

A list of equivalent QuantumCircuits. If empty,

library contains no known decompositions of Gate.

Returned circuits will be ordered according to their insertion in the library, from earliest to latest, from top to base. The ordering of the StandardEquivalenceLibrary will not generally be consistent across Qiskit versions.

반환 형식

List[QuantumCircuit]

has_entry(gate)[소스]

Check if a library contains any decompositions for gate.

매개변수

gate (Gate) – A Gate instance.

반환값

True if gate has a known decomposition in the library.

False otherwise.

반환 형식

Bool

set_entry(gate, entry)[소스]

Set the equivalence record for a Gate. Future queries for the Gate will return only the circuits provided.

Parameterized Gates (those including qiskit.circuit.Parameters in their Gate.params) can be marked equivalent to parameterized circuits, provided the parameters match.

매개변수
  • gate (Gate) – A Gate instance.

  • entry (List['QuantumCircuit']) – A list of QuantumCircuits, each equivalently implementing the given Gate.