QECCode¶
Bases: Displayable
A set of Instruction objects that implement a QEC code.
All qubit-specific quantities are defined with respect to a set of template qubits that can then be replaced with real qubit labels at runtime.
Examples:
>>> from loqs.core import QECCode
>>> code = QECCode(instructions={}, template_qubits=["q0", "q1"], template_data_qubits=["q0"])
>>> code.name
'(Unnamed QEC code)'
QECCode ¶
QECCode(instructions: Mapping[str, Instruction], template_qubits: Sequence[str | int], template_data_qubits: Sequence[str | int], name: str = '(Unnamed QEC code)')
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instructions
|
Mapping[str, Instruction]
|
See |
required |
template_qubits
|
Sequence[str | int]
|
See |
required |
template_data_qubits
|
Sequence[str | int]
|
|
required |
See
|
|
required | |
name
|
str
|
See |
'(Unnamed QEC code)'
|
Attributes¶
| Name | Type | Value | Doc |
|---|---|---|---|
instructions |
dict[str, Instruction] |
unset | A mapping from name keys to Instruction values. |
name |
str |
'(Unnamed QEC code)' |
Name for logging |
template_data_qubits |
list[str | int] |
unset | The entries of template_qubits corresponding to data qubits. |
template_qubits |
list[str | int] |
unset | All template qubits used in instructions. |
create_patch ¶
create_patch(qubits: Sequence[str | int], pauli_frame: PauliFrameLike | None = None) -> QECCodePatch
Create a QECCodePatch based on this QECCode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qubits
|
Sequence[str | int]
|
Qubit labels to replace |
required |
pauli_frame
|
PauliFrameLike | None
|
An initial |
None
|
Returns:
| Type | Description |
|---|---|
QECCodePatch
|
The constructed |
decode¶
Inherited static method from Serializable.decode().
display¶
Inherited method from Displayable.display().
dump¶
Inherited method from Serializable.dump().
encode¶
Inherited static method from Serializable.encode().
load¶
Inherited class method from Serializable.load().
read¶
Inherited class method from Serializable.read().
serialize_function¶
Inherited static method from Serializable.serialize_function().
write¶
Inherited method from Serializable.write().