dimod
dimod copied to clipboard
printing samplesets fails when one of the datafields is more than one dimension and has float biases
rec = np.recarray(5, dtype=[('sample', '<f8', 2),
('energy', '<f8'),
('num_occurrences', 'int8'),
('violations', '<i1', 10),
])
rec[:] = 1
ss = dimod.SampleSet(rec, range(2), {}, 'SPIN')
print(ss)
works fine, but
rec = np.recarray(5, dtype=[('sample', '<f8', 2),
('energy', '<f8'),
('num_occurrences', 'int8'),
('violations', '<f8', 10),
])
rec[:] = 1
ss = dimod.SampleSet(rec, range(2), {}, 'SPIN')
print(ss)
raises
TypeError: only size-1 arrays can be converted to Python scalars