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.