PrepareSlaterDeterminant¶
- class PrepareSlaterDeterminant(occupation, rotation_unitary, *, synthesis=None)¶
Bases:
FermionicGatePrepares a Slater determinant from an occupation and an orbital rotation.
This gate is the composition of an
InitializeModesreference occupation followed by anOrbitalRotation: it declares that the modes it acts on start in the determinant defined byoccupationand are then rotated byrotation_unitary. Because the initial occupation is known, decomposing this gate can use the rectangulargivens_decomposition_slater()for a reduced-gate-count synthesis (seeFermionicSlaterGivensDecomposition) rather than the full square decomposition anOrbitalRotationalone would require.Following the
OrbitalRotationconvention \(a^\dagger_i \mapsto \sum_j U_{ji} a^\dagger_j\), rotating the occupied modes maps them onto the corresponding columns ofrotation_unitary; those columns span the occupied space of the prepared Slater determinant.Simulation semantics
Under simulation this gate is validate-then-rotate, not a state producer: given an incoming state vector it validates that the vector is confined to the subspace
occupationdefines (viaInitializeModes) and then appliesrotation_unitary(viaOrbitalRotation). It therefore requires a real reference state vector, prepared externally (e.g. viaffsim.slater_determinant()). The producer behavior (emitting the gates that set the reference occupation) lives in thesynthesis, not the simulation path.Applying (rather than dropping) the rotation is what guarantees that merging an
InitializeModesand anOrbitalRotationinto this single gate leaves the simulated final state unchanged.Decomposition semantics
Breaking this gate down in fermionic space is optional, and it is what the
synthesisattribute governs. It defaults toFermionicSlaterGivensDecomposition. The two ways of breaking the gate down differ, and deliberately so:the definition of the gate (what
decompose()expands it into) is theInitializeModesofoccupationfollowed by anOrbitalRotation. It is equivalent to the gate as an operator;synthesisproduces a circuit that prepares the same Slater determinant from the vacuum, up to a global phase. It is cheaper because it exploits the known reference, and equivalent to the gate as a state preparation only.
Note
No fermion-to-qubit plugin maps this gate directly. Break it down in fermionic space first, with the
F2FSynthesistranspiler pass, so that the fermion-to-qubit stage only sees the gates it produces.Caution
This is an early development prototype. Beware of changes to its interface without warning during the pre-release development of this package.
See also
InitializeModes,OrbitalRotation, andgivens_decomposition_slater().Initializing an instance of this gate can be done with the arguments listed below.
- Parameters:
occupation (Sequence[bool]) – a sequence of booleans indicating the reference occupation for each mode this gate acts on.
rotation_unitary (np.ndarray) – the \(n \times n\) unitary matrix \(U\) defining the orbital rotation via \(a^\dagger_i \mapsto \sum_j U_{ji} a^\dagger_j\), where \(n\) is the number of modes (
len(occupation)). It must be square and unitary; this is the caller’s responsibility and is not verified.synthesis (F2FSynthesisPlugin | None) – the fermion-to-fermion synthesis method with which to decompose this gate into a state preparation, when it gets decomposed at all. If
None(the default), aFermionicSlaterGivensDecompositioninstance is used. This does not affect the definition of the gate, see the class documentation.
- Raises:
ValueError – if
rotation_unitaryis not a square matrix whose dimension matches the length ofoccupation.
Attributes
- occupation¶
The reference occupation (one boolean per mode) the rotation is applied to.
- rotation_unitary¶
The unitary matrix representing the orbital rotation coefficients.
Protocol Methods
- _apply_unitary_placed_(vec, norb, nelec, copy, freg_indices)¶
Validates the reference occupation and applies the rotation, placing modes onto
vec.Delegates to the gate’s definition (
_build_definition()): the leadingInitializeModesvalidates thatvecis confined to the subspaceoccupationdefines and the followingOrbitalRotationrotates it. See those gates’_apply_unitary_placed_for the full semantics (subspace confinement and the rejection of spin-mixing rotations).- Parameters:
vec (ndarray) – the reference state vector to validate and rotate.
norb (int) – the number of spatial orbitals of the global state vector.
nelec (int | tuple[int, int]) – either a single integer 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 gate’s local modes map onto.
- Returns:
The transformed vector.
- Return type: