Compile error with QR reparameterization


#1

When I try to compile the QR re-parameterization model on pg 127 of the 2.17.1 manual, I get the error error: call of overloaded ‘sqrt(int)’ is ambiguous. Any idea what’s up?

Operating System: Ubuntu 17.10

Interface Version: 2.17.3

Output of rstan::stan_version(): 2.17.0

Output of writeLines(readLines(file.path(Sys.getenv(“HOME”), “.R/Makevars”))):

CXXFLAGS = -O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function
CXXFLAGS += -flto -ffat-lto-objects  -Wno-unused-local-typedefs
CXXFLAGS += -Wno-ignored-attributes -Wno-deprecated-declarations
CXXFLAGS += -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION

Output of devtools::session_info("rstan”):

Session info ------------------------------------------------------------------
 setting  value                       
 version  R version 3.4.3 (2017-11-30)
 system   x86_64, linux-gnu           
 ui       X11                         
 language en_CA:en                    
 collate  en_CA.UTF-8                 
 tz       America/Halifax             
 date     2018-02-10                  

Packages ----------------------------------------------------------------------
 package      * version   date       source        
 BH             1.65.0-1  2017-08-24 CRAN (R 3.4.1)
 colorspace     1.3-2     2016-12-14 CRAN (R 3.4.1)
 dichromat      2.0-0     2013-01-24 CRAN (R 3.4.1)
 digest         0.6.12    2017-01-27 CRAN (R 3.4.1)
 ggplot2      * 2.2.1     2016-12-30 CRAN (R 3.4.1)
 graphics     * 3.4.3     2017-12-01 local         
 grDevices    * 3.4.3     2017-12-01 local         
 grid           3.4.3     2017-12-01 local         
 gridExtra      2.2.1     2016-02-29 CRAN (R 3.4.1)
 gtable         0.2.0     2016-02-26 CRAN (R 3.4.1)
 inline         0.3.14    2015-04-13 CRAN (R 3.4.1)
 labeling       0.3       2014-08-23 CRAN (R 3.4.1)
 lattice        0.20-35   2017-03-25 CRAN (R 3.4.0)
 lazyeval       0.2.0     2016-06-12 CRAN (R 3.4.1)
 magrittr       1.5       2014-11-22 CRAN (R 3.4.1)
 MASS           7.3-48    2017-12-24 CRAN (R 3.4.3)
 Matrix         1.2-11    2017-08-16 CRAN (R 3.4.1)
 methods      * 3.4.3     2017-12-01 local         
 munsell        0.4.3     2016-02-13 CRAN (R 3.4.1)
 plyr           1.8.4     2016-06-08 CRAN (R 3.4.1)
 R6             2.2.2     2017-06-17 CRAN (R 3.4.1)
 RColorBrewer   1.1-2     2014-12-07 CRAN (R 3.4.1)
 Rcpp           0.12.15   2018-01-20 CRAN (R 3.4.3)
 RcppEigen      0.3.3.3.0 2017-05-01 CRAN (R 3.4.1)
 reshape2       1.4.2     2016-10-22 CRAN (R 3.4.1)
 rlang          0.1.6     2017-12-21 cran (@0.1.6) 
 rstan        * 2.17.3    2018-01-20 CRAN (R 3.4.3)
 scales         0.5.0     2017-08-24 CRAN (R 3.4.1)
 StanHeaders  * 2.17.2    2018-01-20 CRAN (R 3.4.3)
 stats        * 3.4.3     2017-12-01 local         
 stats4         3.4.3     2017-12-01 local         
 stringi        1.1.5     2017-04-07 CRAN (R 3.4.1)
 stringr        1.2.0     2017-02-18 CRAN (R 3.4.1)
 tibble         1.3.4     2017-08-22 CRAN (R 3.4.1)
 tools          3.4.3     2017-12-01 local         
 utils        * 3.4.3     2017-12-01 local         
 viridisLite    0.2.0     2017-03-24 CRAN (R 3.4.1)

Logistic elastic-net model with QR reparametrization
#2

You need sqrt(N - 1.0); with some compilers.


#3

Yup, that does the trick.


#4

We’re going to fix that. It’s about number four or five on my to-do list at the moment, but if someone else wants to jump in and help flesh out the boundary conditions in the math lib, I know what needs to be done to fix this.