qutip_qip.qasm
Functions
Return QASM output of circuit object as string |
|
|
Print QASM output of circuit object. |
|
Read OpenQASM intermediate representation (https://github.com/Qiskit/openqasm) and return a |
|
Save QASM output of circuit object to file. |
- class qutip_qip.qasm.QasmOutput(version: str = '2.0')[source]
Bases:
objectClass for QASM export.
- Parameters:
- version: str, optional
OpenQASM version, currently must be “2.0” necessarily.
- is_defined(gate_name: str) bool[source]
Check if QASM gate definition exists for QuTiP gate.
- Parameters:
- gate_name: str
QuTiP gate name.
- qutip_qip.qasm.circuit_to_qasm_str(qc: QubitCircuit) str[source]
Return QASM output of circuit object as string
- Parameters:
- qc
QubitCircuit circuit object to produce QASM output for.
- qc
- Returns:
- output: str
string corresponding to QASM output.
- qutip_qip.qasm.print_qasm(qc: QubitCircuit) None[source]
Print QASM output of circuit object.
- Parameters:
- qc
QubitCircuit circuit object to produce QASM output for.
- qc
- qutip_qip.qasm.read_qasm(qasm_input: str, mode: str = 'default', version: str = '2.0', strmode: bool = False) QubitCircuit[source]
Read OpenQASM intermediate representation (https://github.com/Qiskit/openqasm) and return a
QubitCircuitand state inputs as specified in the QASM file.- Parameters:
- qasm_inputstr
File location or String Input for QASM file to be imported. In case of string input, the parameter strmode must be True.
- modestr
Parsing mode for the qasm file. - “default”: For predefined gates in qutip-qip, use the predefined version, otherwise use the custom gate defined in qelib1.inc. The predefined gate can usually be further processed (e.g. decomposed) within qutip-qip. - “predefined_only”: Use only the predefined gates in qutip-qip. - “external_only”: Use only the gate defined in qelib1.inc, except for CX and QASMU gate.
- versionstr
QASM version of the QASM file. Only version 2.0 is currently supported.
- strmodebool
if specified as True, indicates that qasm_input is in string format rather than from file.
- Returns:
- qc
QubitCircuit Returns a
QubitCircuitobject specified in the QASM file.
- qc
- qutip_qip.qasm.save_qasm(qc: QubitCircuit, file_loc: str) None[source]
Save QASM output of circuit object to file.
- Parameters:
- qc
QubitCircuit circuit object to produce QASM output for.
- file_locstr
File path where the qasm output needs to be saved.
- qc