ยง LM algorithm for nonlinear least squares