apply_unitary

apply_unitary(vec, operator, norb, nelec, copy=True)

Applies a unitary transformation to a state vector.

This is a thin, type-agnostic wrapper around the SupportsApplyUnitary protocol method, mirroring the free-function style of ffsim.apply_unitary().

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

  • operator (SupportsApplyUnitary) – the object with a unitary effect, implementing SupportsApplyUnitary.

  • norb (int) – the number of spatial orbitals.

  • nelec (int | tuple[int, int]) – the electron count – an integer for a spinless sector, or an (n_alpha, n_beta) pair for a spinful one.

  • copy (bool) – whether to copy the vector before operating on it.

Returns:

The transformed vector.

Return type:

ndarray