Later, we might tweak the following to call quadprog by ourselves and then control the amount of ridge regularization (here arbitrarily set to 1e-8):
else if (type == 2) {
if (!is.null(Wx))
stop("cannot solve least squares problem - weights not implemented for type 2")
if (!is.null(Wa))
stop("cannot solve least squares problem - weights not implemented for type 2")
dvec <- crossprod(A, B)
Dmat <- crossprod(A, A)
diag(Dmat) <- diag(Dmat) + 1e-08
Amat <- t(rbind(E, G))
bvec <- c(F, H)
sol <- solve.QP(Dmat, dvec, Amat, bvec, meq = Neq)
sol$IsError <- FALSE
sol$X <- sol$solution
}
Extracted from https://github.com/pneuvial/c3co/issues/58#issuecomment-465957716 on 2019-02-21 where @jchiquet wrote:
Later, we might tweak the following to call quadprog by ourselves and then control the amount of ridge regularization (here arbitrarily set to 1e-8):