tensorcircuit.results.qem.qem_methods#
quantum error mitigation functionalities
- tensorcircuit.results.qem.qem_methods.add_dd(c: Any, rule: Callable[[int], Any]) Any [源代码]#
Add DD sequence to A circuit
- 参数
c (Any) -- circuit
rule (Callable[[int], Any]) -- The rule to conduct the DD sequence
- 返回
new circuit
- 返回类型
Any
- tensorcircuit.results.qem.qem_methods.apply_dd(circuit: Any, executor: Callable[[Any], Any], rule: Union[Callable[[int], Any], List[str]], rule_args: Optional[Dict[str, Any]] = None, num_trials: int = 1, full_output: bool = False, ignore_idle_qubit: bool = True, fulldd: bool = False, iscount: bool = False) Union[float, Tuple[float, List[Any]], Dict[str, float], Tuple[Dict[str, float], List[Any]]] [源代码]#
Apply dynamic decoupling (DD) and return the mitigated results.
- 参数
circuit (Any) -- The aim circuit.
executor (Callable[[Any], Any]) -- A executor that executes a circuit and return results.
rule -- The rule to construct DD sequence, can use default rule "dd_option.rules.xx"
or custom rule "['X','X']" :type rule: Union[Callable[[int], Any], List[str]] :param rule_args:An optional dictionary of keyword arguments for
rule
, defaults to {}. :type rule_args: Dict[str, Any], optional :param num_trials: The number of independent experiments to average over, defaults to 1 :type num_trials: int, optional :param full_output: IfFalse
only the mitigated expectation value isreturned. If
True
a dictionary containing all DD data is returned too, defaults to False- 参数
ig_idle_qubit (bool, optional) -- ignore the DD sequences that added to unused qubits, defaults to True
fulldd (bool, optional) -- dd sequence full fill the idle circuits, defaults to False
iscount (bool, optional) -- whether the output is bit string, defaults to False
- 返回
mitigated expectation value or mitigated expectation value and DD circuit information
- 返回类型
Union[float, Tuple[float, Dict[str, Any]]]
- tensorcircuit.results.qem.qem_methods.apply_rc(circuit: Any, executor: Callable[[Any], Any], num_to_average: int = 1, simplify: bool = True, iscount: bool = False, **kws: Any) Tuple[float, List[Any]] [源代码]#
Apply Randomized Compiling or Pauli twirling on two-qubit gates.
- 参数
circuit (Any) -- Input circuit
executor (Callable[[Any], Any]) -- A executor that executes a circuit and return results.
num_to_average (int, optional) -- Number of circuits for RC, defaults to 1
simplify (bool, optional) -- Whether simplify the circuits by merging single qubit gates, defaults to True
iscount (bool, optional) -- whether the output is bit string, defaults to False
- 返回
Mitigated results by RC
- 返回类型
float
- tensorcircuit.results.qem.qem_methods.apply_zne(circuit: Any, executor: Callable[[Union[Any, Sequence[Any]]], Any], factory: Optional[Any], scale_noise: Optional[Callable[[Any, float], Any]] = None, num_to_average: int = 1, **kws: Any) Any [源代码]#
Apply zero-noise extrapolation (ZNE) and return the mitigated results.
- 参数
circuit (Any) -- The aim circuit.
executor (Callable[[Union[Any, Sequence[Any]]], Any]) -- A executor that executes a single circuit or a batch of circuits and return results.
factory (Optional[Factory]) -- Determines the extropolation method.
scale_noise (Callable[[Any, float], Any], optional) -- The scaling function for the aim circuit, defaults to fold_gates_at_random
num_to_average (int, optional) -- Number of times expectation values are computed by the executor, average each point, defaults to 1.
- 返回
Mitigated average value by ZNE.
- 返回类型
float
- tensorcircuit.results.qem.qem_methods.prune_ddcircuit(c: Any, qlist: List[int]) Any [源代码]#
Discard DD sequence on idle qubits and Discard identity gate (no identity/idle gate on device now) filled in DD sequence.
- 参数
c (Any) -- circuit
qlist (list) -- qubit list to apply DD sequence
- 返回
new circuit
- 返回类型
Any
- tensorcircuit.results.qem.qem_methods.rc_candidates(gate: tensorcircuit.gates.Gate) List[Any] [源代码]#