dwave.optimization.mathematical.logical_xor#
- logical_xor(x1: ArraySymbol, x2: ArraySymbol) Xor [source]#
Return an element-wise logical XOR on the given symbols.
- Parameters:
x1 – Input array symbol.
x2 – Input array symbol.
- Returns:
A symbol that is the element-wise XOR of the given symbols.
Examples
This example XORs two binary symbols of size \(1 \times 3\).
>>> from dwave.optimization import Model >>> from dwave.optimization.mathematical import logical_xor ... >>> model = Model() >>> x = model.binary(3) >>> y = model.binary(3) >>> z = logical_xor(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. 0. 0.]
See also
Xor
: equivalent symbol.Added in version 0.4.1.