log_semiring
jaxns.internals.log_semiring
Module Contents
- logaddexp(x1, x2)[source]
Equivalent to logaddexp but supporting complex arguments.
see np.logaddexp
- signed_logaddexp(log_abs_val1, sign1, log_abs_val2, sign2)[source]
Equivalent of logaddexp but for signed quantities too. Broadcasting supported.
- Parameters:
log_abs_val1 – Logarithm of absolute value of val1, \(\log(|x_1|)\)
sign1 – Sign of val1, \(\mathrm{sign}(x_1)\)
log_abs_val2 – Logarithm of absolute value of val2, \(\log(|x_2|)\)
sign2 – Sign of val2, \(\mathrm{sign}(x_2)\)
- Returns:
(\(\log(|x_1+x_2|)\), \(\mathrm{sign}(x_1+x_2)\))
- class LogSpace(log_abs_val, sign=None)[source]
Bases:
object
- Parameters:
- __add__(other)[source]
Implements addition in log space
log(exp(log_A) + exp(log_B))
- Parameters:
other – ndarray or LogSpace, if ndarray assumed to be log(B)
- Returns:
LogSpace
- __sub__(other)[source]
Implements addition in log space
log(exp(log_A) - exp(log_B))
- Parameters:
other – ndarray or LogSpace, if ndarray assumed to be log(B)
- Returns:
LogSpace
- __mul__(other)[source]
Implements addition in log space
log(exp(log_A) * exp(log_B))
- Parameters:
other – ndarray or LogSpace, if ndarray assumed to be log(B)
- Returns:
LogSpace