quadprog::solve.QP sometimes returns NaNs

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

quadprog::solve.QP sometimes returns NaNs

Benjamin Tyner
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


______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.