From 226d6728b3b0a5c5b9bdac059f1aefcc27bb354b Mon Sep 17 00:00:00 2001 From: robstine <87041718+robstine@users.noreply.github.com> Date: Tue, 6 Jul 2021 16:33:22 -0400 Subject: [PATCH] Update steep_descent.R Otherwise negative estimates get zeroed out. --- R/steep_descent.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/steep_descent.R b/R/steep_descent.R index 21a02b7..7ad8797 100644 --- a/R/steep_descent.R +++ b/R/steep_descent.R @@ -40,7 +40,7 @@ steep_descent <- function (x0, f, g = NULL, info = FALSE, if (a3 < tol/2) { if (info) cat("Method of steepest descent converged to:", x, "\n") - x[x < eps] <- 0 + x[abs(x) < eps] <- 0 return(list(xmin = x, fmin = f(x), niter = k)) } }