Skip to content

komm.boxplus

Computes the box-plus operation. It is defined by $$ a \boxplus b = 2 \operatorname{atanh} \left( \tanh\left(\frac{a}{2}\right) \tanh\left(\frac{b}{2}\right) \right). $$ If $X, Y$ are independent binary random variables, then $L(X \oplus Y) = L(X) \boxplus L(Y)$, where $L$ denotes the L-value and $\oplus$ denotes the modulo-$2$ sum.

Parameters:

  • a (ArrayLike)

    A float or array of floats containing L-values.

  • b (ArrayLike)

    A float or array of floats containing L-values.

Returns:

  • NDArray[floating]

    The result of the boxplus operation. It has the same shape as the inputs.

Examples:

>>> komm.boxplus(1, 2)
np.float64(0.735325664055519)
>>> komm.boxplus([0, 1, 2], [1, -1, -1])
array([ 0.        , -0.43378083, -0.73532566])