qbraid_qir.cirq.CirqModule

class CirqModule(name, module, num_qubits, elements)[source]

A module representing a quantum circuit in Cirq using QIR.

This class encapsulates a quantum circuit from Cirq and translates it into QIR format, maintaining information about quantum operations, qubits, and classical bits. It provides methods to interact with the underlying QIR module and circuit elements.

Parameters:
  • name (str) – Name of the module.

  • module (Module) – QIR Module instance.

  • num_qubits (int) – Number of qubits in the circuit.

  • elements (list[_CircuitElement]) – list of circuit elements.

Example

>>> circuit = cirq.Circuit()
>>> cirq_module = CirqModule.from_circuit(circuit)
>>> print(cirq_module.num_qubits)
__init__(name, module, num_qubits, elements)[source]

Methods

__init__(name, module, num_qubits, elements)

accept(visitor)

from_circuit(circuit[, module])

Class method.

Attributes

module

Returns the QIR Module instance.

name

Returns the name of the module.

num_clbits

Returns the number of classical bits in the circuit.

num_qubits

Returns the number of qubits in the circuit.