cirq.QasmOutput
Representation of a circuit in QASM (quantum assembly) format.
cirq.QasmOutput(
operations: 'cirq.OP_TREE',
qubits: Tuple['cirq.Qid', ...],
header: str = '',
precision: int = 10,
version: str = '2.0'
) -> None
Please note that the QASM importer is in an experimental state and
currently only supports a subset of the full OpenQASM spec.
Amongst others, classical control, arbitrary gate definitions,
and even some of the gates that don't have a one-to-one representation
in Cirq, are not yet supported.
QASM output can be saved to a file using the save method.
Args |
operations
|
Tree of operations to insert.
|
qubits
|
The qubits used in the operations.
|
header
|
A multi-line string that is placed in a comment at the top
of the QASM.
|
precision
|
The number of digits after the decimal to show for
numbers in the QASM code.
|
version
|
The QASM version to target. Objects may return different
QASM depending on version.
|
Methods
is_valid_qasm_id
View source
is_valid_qasm_id(
id_str: str
) -> bool
Test if id_str is a valid id in QASM grammar.
save
View source
save(
path: Union[str, bytes, int]
) -> None
Write QASM output to a file specified by path.
Class Variables |
valid_id_re
|
Instance of re.Pattern
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-27 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-27 UTC."],[],[]]