qat.core.spins.integer_to_spins

qat.core.spins.integer_to_spins(integer, n_spins)

A function which translates an integer in decimal to its binary representation and then from the 0s and 1s in binary to a spin configuration with 1 and -1.

This function translates the integer value in the Result samples of the SimulatedAnnealing to a spin configuration with 1 and -1.

Parameters
  • integer (int) – a decimal integer number for the state

  • n_spins (int) – the number of spins in the problem

Returns

array of spins

Return type

1D numpy array