bloqade.qasm3.loads
← Module overview
function
source
functionloads¶source
bloqade.qasm3.loads
Signature
def loads(qasm: str, *, kernel_name: str = 'main', dialects: ir.DialectGroup | None = None, file: str | None = None, lineno_offset: int = 0, col_offset: int = 0, compactify: bool = True) -> ir.MethodParse a QASM3 string and return an ir.Method.
Example:
from bloqade import qasm3method = qasm3.loads('''OPENQASM 3.0;qubit[2] q;bit[2] c;h q[0];cx q[0], q[1];c[0] = measure q[0];c[1] = measure q[1];''')Parameters
| Name | Type | Default | Description |
|---|---|---|---|
qasm | str | required | The OpenQASM 3.0 string to parse. |
kernel_name | str | 'main' | |
dialects | ir.DialectGroup | None | None | |
file | str | None | None | |
lineno_offset | int | 0 | |
col_offset | int | 0 | |
compactify | bool | True |
Other Parameters
| Name | Type | Description |
|---|---|---|
kernel_name | str | The name of the kernel. Defaults to "main". |
dialects | ir.DialectGroup | None | The dialect group to use. Defaults to `qasm3.main`. |
file | str | None | The file name for error reporting. Defaults to None. |
lineno_offset | int | The line number offset for error reporting. Defaults to 0. |
col_offset | int | The column number offset for error reporting. Defaults to 0. |
compactify | bool | Whether to compactify the output. Defaults to True. |
Returns
ir.Method