qutip_qip.qasm
Importation and exportation of QASM circuits
Functions
Return QASM output of circuit object as string |
|
|
Print QASM output of circuit object. |
|
QASM U-gate as defined in the OpenQASM standard. |
|
Read OpenQASM intermediate representation (https://github.com/Qiskit/openqasm) and return a |
|
Save QASM output of circuit object to file. |
- qutip_qip.qasm.circuit_to_qasm_str(qc)[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)[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, mode='default', version='2.0', strmode=False)[source]
Read OpenQASM intermediate representation (https://github.com/Qiskit/openqasm) and return a
QubitCircuit
and 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
QubitCircuit
object specified in the QASM file.
- qc
- qutip_qip.qasm.save_qasm(qc, file_loc)[source]
Save QASM output of circuit object to file.
- Parameters
- qc
QubitCircuit
circuit object to produce QASM output for.
- qc