dimod.concatenate

concatenate(samplesets, defaults=None)[source]

Combine sample sets.

Parameters:
  • samplesets (iterable[SampleSet) – Iterable of sample sets.
  • defaults (dict, optional) – Dictionary mapping data vector names to the corresponding default values.
Returns:

A sample set with the same vartype and variable order as the first given in samplesets.

Return type:

SampleSet

Examples

>>> a = dimod.SampleSet.from_samples(([-1, +1], 'ab'), dimod.SPIN, energy=-1)
>>> b = dimod.SampleSet.from_samples(([-1, +1], 'ba'), dimod.SPIN, energy=-1)
>>> ab = dimod.concatenate((a, b))
>>> ab.record.sample
array([[-1,  1],
       [ 1, -1]], dtype=int8)