dwave.optimization.model.ArraySymbol.size#

ArraySymbol.size()#

Return the number of elements in the symbol.

If the symbol has a fixed size, returns that size as an integer. Otherwise, returns a Size symbol.

Examples

This example checks the size of a \(2 \times 3\) binary symbol.

>>> from dwave.optimization import Model
>>> model = Model()
>>> x = model.binary((2, 3))
>>> x.size()
6