ffsim.GivensAnsatzOp¶
- class ffsim.GivensAnsatzOp(norb, interaction_pairs, thetas, phis, phase_angles)[source]¶
Bases:
SupportsApplyUnitary,SupportsApproximateEqualityA Givens rotation ansatz operator.
The Givens rotation ansatz consists of a sequence of Givens rotations followed by a layer of single-orbital phase gates.
Note that this ansatz does not implement any interactions between spin alpha and spin beta orbitals.
Attributes
The number of spatial orbitals.
The orbital pairs to apply the Givens rotations to.
The angles for the Givens rotations.
The optional phase angles for the Givens rotations.
The optional phase angles for the layer of single-orbital phase gates.
-
phase_angles:
ndarray|None¶ The optional phase angles for the layer of single-orbital phase gates.
Methods
from_orbital_rotation(orbital_rotation)Initialize the operator from an orbital rotation.
from_parameters(params, norb, interaction_pairs)Initialize the operator from a real-valued parameter vector.
n_params(norb, interaction_pairs[, ...])Return the number of parameters of an ansatz with given settings.
Convert the Givens ansatz operator to an orbital rotation.
Convert the operator to a real-valued parameter vector.
- static from_orbital_rotation(orbital_rotation)[source]¶
Initialize the operator from an orbital rotation.
- Parameters:
orbital_rotation (
ndarray) – The orbital rotation.- Return type:
- static from_parameters(params, norb, interaction_pairs, with_phis=True, with_phase_angles=True)[source]¶
Initialize the operator from a real-valued parameter vector.
- Parameters:
params (
ndarray) – The real-valued parameter vector.norb (
int) – The number of spatial orbitals.interaction_pairs (
list[tuple[int,int]]) – The orbital pairs to apply the Givens rotation gates to.with_phis (
bool) – Whether to include complex phases for the Givens rotations.with_phase_angles (
bool) – Whether to include a layer of single-orbital phase gates.
- Return type:
- static n_params(norb, interaction_pairs, with_phis=True, with_phase_angles=True)[source]¶
Return the number of parameters of an ansatz with given settings.
- Parameters:
norb (
int) – The number of spatial orbitals.interaction_pairs (
list[tuple[int,int]]) – The orbital pairs to apply the Givens rotation gates to.with_phis (
bool) – Whether to include complex phases for the Givens rotations.with_phase_angles (
bool) – Whether to include a layer of single-orbital phase gates.
- Return type:
-
phase_angles: