xsf/scipy_special/softplus.rs
1use crate::LogAddExpArg;
2
3/// $\ln(1 + e^x)$
4///
5/// Corresponds to [`scipy.special.softplus`][softplus] in SciPy.
6///
7/// [softplus]: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.softplus.html
8#[inline]
9pub fn softplus<T: LogAddExpArg>(x: T) -> T {
10 x.npy_logaddexp(T::ZERO)
11}