dwave.system.temperatures.background_susceptibility_ising#

background_susceptibility_ising(h: ndarray | dict, J: ndarray | dict) Tuple[source]#

Calculate the biases and couplings due to background susceptibility.

Background susceptibility is a significant source of systematic error in annealing processors. It can be treated as a perturbation of the programmed Hamiltonian.

The perturbed Hamiltonian can be most concisely expressed for an Ising model in matrix vector notation. Assuming \(J\) is a real, symmetric (0 on the diagonal) matrix, \(h\) and \(s\) are column vectors, and \(\chi\) is a small real value, then the Ising model is is defined as,

\[H = k + (h + \chi J h)' s + 1/2 s' (J + \chi J^2) s,\]

where the apostrophe (’) denotes transpose and matrix multiplication applies.

The constant (\(k\), irrelevant to sampled distributions) is defined as \(k = - \frac{\chi}{2} \textrm{Trace}[J^2]\).

This function returns the perturbative part \(H(s) = k + h' J s + \frac{1}{2} s' (J + \chi J^2) s\).

Parameters:
  • h – Linear terms (fields/biases) in the Hamiltonian.

  • J – Quadratic terms (couplings) in the Hamiltonian.

Returns:

Couplings and scalar constant as a tuple. If \(h\) and \(J\) are of type numpy.ndarray, returned fields and couplings are too; otherwise returns a tuple of dictionaries.

Examples

This example calculates the background-susceptibility corrections, shown symbolically in the Background Susceptibility section, for a three-qubit BQM with the following values:

  • Biases \(h_1=0.3, h_2=0.8, h_3=-0.25\)

  • Couplings \(J_{1,2}=1.2, J_{2,3}=-0.4\)

  • \(\chi=-0.01\)

>>> import dimod
>>> from dwave.system.temperatures import background_susceptibility_ising
...
>>> h1 = 0.3; h2 = 0.8; h3 = -0.25
>>> J12 = 1.2; J23 = -0.4
>>> h, J, _ = background_susceptibility_ising(
...     {'1': h1, '2': h2, '3': h3},
...     {('1', '2'): J12, ('2', '3'): J23})
>>> print(round(h['2'], 2))
0.46

The formula shown in the Background Susceptibility section for qubit 2, is \(h_2 + h_1 \chi J_{1,2} + h3 \chi J_{2,3}\). The perturbation part can be rearranged as \(h_1 \chi J_{1,2} + h3 \chi J_{2,3} = \chi (h_1 J_{1,2} + h3 J_{2,3})\) and using the values of this example, setting \(\chi = 1\) for convenience, gives \((h_1 J_{1,2} + h3 J_{2,3}) = 0.3*1.2 - 0.25*(-0.4) = 0.459999\).