pysolvegn.soft_l1_rho#

soft_l1_rho(x)[source]#

Compute the soft L1 robust cost function \(\rho(x) = 2(\sqrt{1 + x} - 1)\) and its derivatives.

\[\rho'(x) = \frac{1}{\sqrt{1 + x}}\]
\[\rho''(x) = -\frac{1}{2(1 + x)^{3/2}}\]
Parameters:

x (ArrayLike) – Squared residuals \(x = \|R\|^2\). Shape (N,).

Returns:

  • rho (numpy.ndarray) – The cost function values with shape (N,).

  • rho_prime (numpy.ndarray) – The first derivatives with shape (N,).

  • rho_double_prime (numpy.ndarray) – The second derivatives with shape (N,).

Return type:

Tuple[ndarray, ndarray, ndarray]