SupportsApplyUnitaryPlaced
class SupportsApplyUnitaryPlaced(*args, **kwargs)
Bases: Protocol
A package-specific extension of SupportsApplyUnitary carrying a mode placement.
Unlike SupportsApplyUnitary (mirroring ffsim.SupportsApplyUnitary), this protocol has no ffsim equivalent and no helper function: _apply_unitary_placed_() is the only caller, and it dispatches to it directly via getattr duck-typing rather than through a free function. It exists here purely for typing and documentation purposes, since every concrete FermionicGate (as well as FermionicCircuit itself) implements this method.
See FermionicCircuit._apply_unitary_placed_() for the full semantics, including how a plain SupportsApplyUnitary implementation (with no mode-placement argument) is honored only on the identity placement.
Protocol Methods
_apply_unitary_placed_
_apply_unitary_placed_(vec, norb, nelec, copy, freg_indices)
Applies a unitary transformation to a state vector, after placing local modes onto global ones.
Parameters
- vec (np.ndarray) – the state vector to apply the unitary transformation to.
- norb (int) – the number of spatial orbitals of the global state vector.
- nelec (int |tuple[int, int]) – either a single integer representing the number of fermions for a spinless system, or a pair of integers storing the numbers of spin alpha and spin beta fermions.
- copy (bool) – whether to copy the vector before operating on it.
- freg_indices (list[int]) – the absolute (global) mode indices that this object’s local modes map onto.
Returns
The transformed vector.
Return type
np.ndarray