pyqubo.Array.fill

static Array.fill(obj, shape)[source]

Create a new array with the given shape, all filled with the given object.

Parameters:
  • obj (int/float/Express) – The object with which a new array is filled.
  • shape (tuple[int]) – Shape of the array.
Returns:

Created array.

Return type:

Array

Example

>>> from pyqubo import Array, Binary
>>> Array.fill(Binary('a'), shape=(2, 3))
Array([[Binary(a), Binary(a), Binary(a)],
       [Binary(a), Binary(a), Binary(a)]])