dwave.optimization.mathematical.logical_or#

logical_or(x1: ArraySymbol, x2: ArraySymbol) Or[source]#

Return an element-wise logical OR on the given symbols.

Parameters:
  • x1 – Input array symbol.

  • x2 – Input array symbol.

Returns:

A symbol that is the element-wise OR of the given symbols.

Examples

This example ORs two binary symbols of size \(1 \times 3\).

>>> from dwave.optimization import Model
>>> from dwave.optimization.mathematical import logical_or
...
>>> model = Model()
>>> x = model.binary(3)
>>> y = model.binary(3)
>>> z = logical_or(x, y)
>>> with model.lock():
...     model.states.resize(1)
...     x.set_state(0, [True, True, False])
...     y.set_state(0, [False, True, False])
...     print(z.state(0))
[1. 1. 0.]

See also

Or: equivalent symbol.