ffsim.SupportsApplyUnitary¶
- class ffsim.SupportsApplyUnitary(*args, **kwargs)[source]¶
Bases:
ProtocolAn object that can apply a unitary transformation to a vector.
Methods
_apply_unitary_(vec, norb, nelec, copy)Apply a unitary transformation to a vector.
- _apply_unitary_(vec, norb, nelec, copy)[source]¶
Apply a unitary transformation to a vector.
- Parameters:
vec (
ndarray) – The vector to apply the unitary transformation to.norb (
int) – The number of spatial orbitals.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.
If
copy=Truethen this function always returns a newly allocated vector and the original vector is left untouched.If
copy=Falsethen this function may still return a newly allocated vector, but the original vector may have its data overwritten. It is also possible that the original vector is returned, modified in-place.
- Return type:
- Returns:
The transformed vector.