Exemple #1
0
def _ndtr(x):
    """Implements ndtr core logic."""
    dtype = lax.dtype(x).type
    half_sqrt_2 = dtype(0.5) * np.sqrt(2., dtype=dtype)
    w = x * half_sqrt_2
    z = lax.abs(w)
    y = lax.select(
        lax.lt(z, half_sqrt_2),
        dtype(1.) + lax.erf(w),
        lax.select(lax.gt(w, dtype(0.)),
                   dtype(2.) - lax.erfc(z), lax.erfc(z)))
    return dtype(0.5) * y
Exemple #2
0
def erfc(x):
    x, = _promote_args_inexact("erfc", x)
    return lax.erfc(x)