[R] quadprog::solve.QP sometimes returns NaNs
Benjamin Tyner
btyner at gmail.com
Sat Sep 27 04:26:10 CEST 2014
Hello,
Here is an example; hopefully it is reproducible on others' platform:
library(quadprog)
n <- 66L
set.seed(6860)
X <- matrix(1e-20, n, n)
diag(X) <- 1
Dmat <- crossprod(X)
y <- seq_len(n)
dvec <- crossprod(X, y)
Amat <- diag(n)
bvec <- y + runif(n)
sol <- solve.QP(Dmat, dvec, Amat, bvec, meq = n)
print(sol$solution) # this gives all NaNs
under sessionInfo():
R version 3.0.2 (2013-09-25)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods
base
other attached packages:
[1] quadprog_1.5-5
Any ideas?
Thanks
Ben
More information about the R-help
mailing list