dwave.optimization.mathematical.logical#

logical(x: ArraySymbol) Logical[source]#

Return the element-wise truth value on the given symbol.

Parameters:

x – Input array symbol.

Returns:

A symbol that propagates the element-wise truth value of the given symbol.

Examples

This example shows the truth values an array symbol.

>>> from dwave.optimization import Model
>>> from dwave.optimization.mathematical import logical
...
>>> model = Model()
>>> x = model.constant([0, 1, -2, .5])
>>> logical_x = logical(x)
>>> model.states.resize(1)
>>> with model.lock():
...     print(logical_x.state())
[0. 1. 1. 1.]

See also

Logical: equivalent symbol.