code: def _log_gauss_mass(a: np.ndarray, b: np.ndarray) -> np.ndarray:
      """Log of Gaussian probability mass within an interval"""
  
      # Calculations in right tail are inaccurate, so we'll exploit the
      # symmetry and work only in the left tail
      case_left = b <= 0
      case_right = a > 0
      case_central = ~(case_left | case_right)
  
      def mass_case_left(a: np.ndarray, b: np.ndarray) -> np.ndarray:
          return _log_diff(_log_ndtr(b), _log_ndtr(a))
  
      def mass_case_right(a: np.ndarray, b: np.ndarray) -> np.ndarray:
          return mass_case_left(-b, -a)
  
      def mass_case_central(a: np.ndarray, b: np.ndarray) -> np.ndarray:
          # Previously, this was implemented as:
          # left_mass = mass_case_left(a, 0)
          # right_mass = mass_case_right(0, b)
          # return _log_sum(left_mass, right_mass)
          # Catastrophic cancellation occurs as np.exp(log_mass) approaches 1.
          # Correct for this with an alternative formulation.
          # We're not concerned with underflow here: if only one term
          # underflows, it was insignificant; if both terms underflow,
          # the result can't accurately be represented in logspace anyway
          # because sc.log1p(x) ~ x for small x.
          return np.log1p(-_ndtr(a) - _ndtr(-b))
  
      # _lazyselect not working; don't care to debug it
      out = np.full_like(a, fill_value=np.nan, dtype=np.complex128)
      if a[case_left].size:
          out[case_left] = mass_case_left(a[case_left], b[case_left])
      if a[case_right].size:
          out[case_right] = mass_case_right(
              a[case_right], b[case_right]
          )
      if a[case_central].size:
          out[case_central] = mass_case_central(
              a[case_central], b[case_central]
          )
      return np.real(out)
  
imports: import functools
  import math
  import sys
  from typing import Callable
  from typing import Optional
  from typing import Union
  import numpy
  from optuna.samplers._tpe._erf import erf
label_desc: Use image node_id 8 for calling a global function with example usage: _log_gauss_mass(a, b) and returns: np, _log_diff, mass_case_left, np