dwave.optimization.mathematical.logical_or#

logical_or(lhs: ArraySymbol, rhs: ArraySymbol)[source]#

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

Parameters:
  • lhs – Left-hand side symbol.

  • rhs – Right-hand side 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.]