SwapTrackingSort Module
Swap-tracking selection sort for computing fermionic phase factors.
When reordering fermionic operators to normal order (all creation operators left, annihilation right), each swap of adjacent operators introduces a factor of −1. This module implements selection sort that counts swaps, so the total fermionic sign (-1)^(number of swaps) can be computed.
The sort is O(n²) but n is always small (number of operators in a single product term, typically 2-4).
Types
| Type | Description |
|
A selection sort implementation that tracks position changes for computing phase factors. |