qutip_qip.qir
Functions
|
Specifies the format used to serialize QIR. |
Converts a qubit circuit to its representation in QIR. |
- class qutip_qip.qir.QirFormat(value)[source]
Bases:
Enum
Specifies the format used to serialize QIR.
- BITCODE = 1
Specifies that QIR should be encoded as LLVM bitcode (typically, files ending in .bc).
- MODULE = 3
Specifies that QIR should be encoded as a PyQIR module object.
- TEXT = 2
Specifies that QIR should be encoded as plain text (typicaly, files ending in .ll).
- qutip_qip.qir.circuit_to_qir(circuit: QubitCircuit, format: Union[Literal[QirFormat.BITCODE], Literal['bitcode']], module_name: str) bytes [source]
- qutip_qip.qir.circuit_to_qir(circuit: QubitCircuit, format: Union[Literal[QirFormat.TEXT], Literal['text']], module_name: str) str
- qutip_qip.qir.circuit_to_qir(circuit: QubitCircuit, format: Union[Literal[QirFormat.MODULE], Literal['module']], module_name: str) QirModule
Converts a qubit circuit to its representation in QIR.
Given a circuit acting on qubits, generates a representation of that circuit using Quantum Intermediate Representation (QIR).
- Parameters
- circuit
The circuit to be translated to QIR.
- format
The QIR serialization to be used. If “text”, returns a plain-text representation using LLVM IR. If “bitcode”, returns a dense binary representation ideal for use with other compilation tools. If “module”, returns a PyQIR module object that can be manipulated further before generating QIR.
- module_name
The name of the module to be emitted.
- Returns
- A QIR representation of circuit, encoded using the format specified by
- format.