paulie.application.pauli_compiler.OptimalPauliCompiler#

class paulie.application.pauli_compiler.OptimalPauliCompiler(cfg)#

Bases: object

Compiler implementing the construction from arXiv:2408.03294.

Compiles a target Pauli string into an O(N) length sequence of generators that produces the target via nested commutators.

Parameters:

cfg – Compiler configuration specifying the left-right partition and fallback search limits.

compile(v_left, w_right)#

Compile a target specified by its left and right factors.

Parameters:
  • v_left – Left factor of the target (length k_left).

  • w_right – Right factor of the target (length n_total - k_left).

Returns:

[Am, ..., A1, base].

Return type:

Sequence in PauLie’s nested_adjoint orientation

Raises:
  • ValueError – If the lengths of v_left and w_right do not match the configured partition.

  • RuntimeError – If no valid sequence is found.

extend_left(a_left)#

Extend a left Pauli string to the full system.

static nested_eval(seq)#

ad_{seq[0]} … ad_{seq[-2]}(seq[-1]), or None if any step gives 0.

reorder_to_nested(L_seq, R_seq)#

Given two sequences L, R interpreted as nested commutators, return a permutation S of L+R such that nested_eval(S) ∝ [nested_eval(L), nested_eval(R)]. Applies Lemma G.2 of arXiv:2408.03294 iteratively.