ffsim.apply_unitary

ffsim.apply_unitary(vec, obj, norb, nelec, copy=True)[source]

Apply a unitary transformation to a vector.

Parameters:
  • vec (ndarray) – The vector to apply the unitary transformation to.

  • obj (Any) – The object with a unitary effect.

  • 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=True then this function always returns a newly allocated vector and the original vector is left untouched.

    • If copy=False then 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:

ndarray

Returns:

The transformed vector.