Error Mitigation API Reference
HLQuantum includes a pluggable error-mitigation pipeline. Each technique is a subclass of MitigationMethod and can be composed together via apply_mitigation().
Built-in Methods
| Class | Strategy |
|---|---|
ThresholdMitigation |
Discards bitstrings whose probability falls below a configurable threshold, treating them as noise. |
ReadoutMitigation |
Placeholder for readout-error correction (extensible). |
Usage
import hlquantum as hlq
from hlquantum.mitigation import ThresholdMitigation, apply_mitigation
# Apply during execution
result = hlq.run(circuit, mitigation=ThresholdMitigation(threshold=0.01))
# Or apply after the fact
raw = hlq.run(circuit)
clean = apply_mitigation(raw, [ThresholdMitigation(threshold=0.01)])
Writing a Custom Mitigation Method
Subclass MitigationMethod and implement the apply(result) method:
from hlquantum.mitigation import MitigationMethod
class MyMitigation(MitigationMethod):
def apply(self, result):
# Return a new or modified ExecutionResult
...
Error mitigation hooks and post-processing.
MitigationMethod
Bases: ABC
Base class for error mitigation techniques.
Source code in hlquantum/mitigation.py
12 13 14 15 16 17 18 | |
apply(result)
abstractmethod
Apply mitigation to the result.
Source code in hlquantum/mitigation.py
15 16 17 18 | |
ReadoutMitigation
Bases: MitigationMethod
Readout Error Mitigation placeholder.
Source code in hlquantum/mitigation.py
48 49 50 51 52 | |
ThresholdMitigation
Bases: MitigationMethod
Filters low-probability bitstrings.
Source code in hlquantum/mitigation.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
apply_mitigation(result, methods=None)
Apply a sequence of mitigation methods.
Source code in hlquantum/mitigation.py
55 56 57 58 59 60 61 62 63 64 | |