ffsim.NumNumAnsatzOpSpinBalanced

class ffsim.NumNumAnsatzOpSpinBalanced(norb, interaction_pairs, thetas)[source]

Bases: SupportsApplyUnitary, SupportsApproximateEquality

A number-number interaction ansatz operator.

The number-number interaction ansatz consists of a sequence of number-number interactions.

Attributes

norb

The number of spatial orbitals.

interaction_pairs

The orbital pairs to apply the number-number interactions to.

thetas

The angles for the number-number interactions.

norb: int

The number of spatial orbitals.

interaction_pairs: tuple[list[tuple[int, int]], list[tuple[int, int]]]

The orbital pairs to apply the number-number interactions to.

thetas: tuple[ndarray, ndarray]

The angles for the number-number interactions.

Methods

from_diag_coulomb_mats(diag_coulomb_mats)

Initialize the operator from a diagonal Coulomb matrix.

from_parameters(params, norb, interaction_pairs)

Initialize the operator from a real-valued parameter vector.

n_params(interaction_pairs)

Return the number of parameters of an ansatz with given settings.

to_diag_coulomb_mats()

Convert the operator to diagonal Coulomb matrices.

to_parameters()

Convert the operator to a real-valued parameter vector.

static from_diag_coulomb_mats(diag_coulomb_mats)[source]

Initialize the operator from a diagonal Coulomb matrix.

Parameters:

diag_coulomb_mats (tuple[ndarray, ndarray] | ndarray) – The diagonal Coulomb matrices. Should be a pair of matrices, with the first matrix representing same-spin interactions and the second matrix representing different-spin interactions.

Return type:

NumNumAnsatzOpSpinBalanced

static from_parameters(params, norb, interaction_pairs)[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 (tuple[list[tuple[int, int]], list[tuple[int, int]]]) – The orbital pairs to apply the number-number interactions to.

Return type:

NumNumAnsatzOpSpinBalanced

static n_params(interaction_pairs)[source]

Return the number of parameters of an ansatz with given settings.

Parameters:

interaction_pairs (tuple[list[tuple[int, int]], list[tuple[int, int]]]) – The orbital pairs to apply the number-number interactions to.

Return type:

int

to_diag_coulomb_mats()[source]

Convert the operator to diagonal Coulomb matrices.

Return type:

ndarray

Returns:

A Numpy array of shape (2, norb, norb) holding two matrices. The first matrix holds the same-spin interactions and the second matrix holds the different-spin interactions.

to_parameters()[source]

Convert the operator to a real-valued parameter vector.

Return type:

ndarray