qutip_qip.qasm

Importation and exportation of QASM circuits

Functions

circuit_to_qasm_str(qc)

Return QASM output of circuit object as string

print_qasm(qc)

Print QASM output of circuit object.

qasmu_gate(args[, N, target])

QASM U-gate as defined in the OpenQASM standard.

read_qasm(qasm_input[, mode, version, strmode])

Read OpenQASM intermediate representation (https://github.com/Qiskit/openqasm) and return a QubitCircuit and state inputs as specified in the QASM file.

save_qasm(qc, file_loc)

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
qcQubitCircuit

circuit object to produce QASM output for.

Returns
output: str

string corresponding to QASM output.

qutip_qip.qasm.print_qasm(qc)[source]

Print QASM output of circuit object.

Parameters
qcQubitCircuit

circuit object to produce QASM output for.

qutip_qip.qasm.read_qasm(qasm_input, mode='qiskit', 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

QASM mode to be read in. When mode is “qiskit”, the “qelib1.inc” include is automatically included, without checking externally. Otherwise, each include is processed.

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
qcQubitCircuit

Returns a QubitCircuit object specified in the QASM file.

qutip_qip.qasm.save_qasm(qc, file_loc)[source]

Save QASM output of circuit object to file.

Parameters
qcQubitCircuit

circuit object to produce QASM output for.