dimod.binary.BinaryQuadraticModel.add_linear_from_array#

BinaryQuadraticModel.add_linear_from_array(linear: Sequence)[source]#

Add linear biases from an array-like to a binary quadratic model.

Args:
linear:

Linear biases as a one-dimensional array_like.

Examples:
>>> bqm = dimod.BinaryQuadraticModel("BINARY")
>>> bqm.add_linear_from_array([0.5, 0.2, -0.3, 0.25])
>>> print(bqm.linear)
{0: 0.5, 1: 0.2, 2: -0.3, 3: 0.25}