bloqade.qasm2.loads
← Module overview
function
source
functionloads¶source
bloqade.qasm2.loads
Signature
def loads(qasm: str, *, kernel_name: str = 'main', dialects: ir.DialectGroup | None = None, returns: str | None = None, globals: dict[str, Any] | None = None, file: str | None = None, lineno_offset: int = 0, col_offset: int = 0, compactify: bool = True) -> ir.Method[[], None]Loads a QASM2 string and returns the corresponding kernel object.
Example:
from bloqade import qasm2method = qasm2.loads('''OPENQASM 2.0;qreg q[2];creg c[2];h q[0];cx q[0], q[1];measure q[0] -> c[0];''')Parameters
| Name | Type | Default | Description |
|---|---|---|---|
qasm | str | required | The QASM2 string to load. |
kernel_name | str | 'main' | |
dialects | ir.DialectGroup | None | None | |
returns | str | None | None | |
globals | dict[str, Any] | 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 to load. Defaults to "main". |
dialects | ir.DialectGroup | None | The dialects to use. Defaults to `qasm2.main`. |
returns | str | None | The return type of the kernel. Defaults to None. |
globals | dict[str, Any] | None | The global variables to use. Defaults to None. |
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[[], None]