Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only use quadmath on 64-bit archs, fixes #17 #18

Closed
wants to merge 1 commit into from

Conversation

@jeroen
Copy link

jeroen commented Feb 7, 2020

Hi, we are trying to upgrade the Windows toolchain to GCC-8 on CRAN.

Your use of quadmath seems to overflow on 32-bit systems, resulting in a crash with gcc 8. See #17

The following is a simple fix that only uses quadmath on 64-bit systems (c_intptr_t equals 4 on 32-bit and 8 on 64-bit). With this, the package should pass on winbuilder with the GCC-8 toolchain.

Because it overflows on 32-bit.
@lintr-bot

This comment has been minimized.

Copy link

lintr-bot commented Feb 7, 2020

R/bd_loglik_choosepar.R:1:1: style: Lines should not be more than 80 characters.

bd_loglik_choosepar = function(trparsopt,trparsfix,idparsopt,idparsfix,pars2,brts,missnumspec,methode)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik_choosepar.R:1:21: style: Use <-, not =, for assignment.

bd_loglik_choosepar = function(trparsopt,trparsfix,idparsopt,idparsfix,pars2,brts,missnumspec,methode)
                    ^

R/bd_loglik_choosepar.R:1:42: style: Commas should always have a space after.

bd_loglik_choosepar = function(trparsopt,trparsfix,idparsopt,idparsfix,pars2,brts,missnumspec,methode)
                                         ^

R/bd_loglik_choosepar.R:1:52: style: Commas should always have a space after.

bd_loglik_choosepar = function(trparsopt,trparsfix,idparsopt,idparsfix,pars2,brts,missnumspec,methode)
                                                   ^

R/bd_loglik_choosepar.R:1:62: style: Commas should always have a space after.

bd_loglik_choosepar = function(trparsopt,trparsfix,idparsopt,idparsfix,pars2,brts,missnumspec,methode)
                                                             ^

R/bd_loglik_choosepar.R:1:72: style: Commas should always have a space after.

bd_loglik_choosepar = function(trparsopt,trparsfix,idparsopt,idparsfix,pars2,brts,missnumspec,methode)
                                                                       ^

R/bd_loglik_choosepar.R:1:78: style: Commas should always have a space after.

bd_loglik_choosepar = function(trparsopt,trparsfix,idparsopt,idparsfix,pars2,brts,missnumspec,methode)
                                                                             ^

R/bd_loglik_choosepar.R:1:83: style: Commas should always have a space after.

bd_loglik_choosepar = function(trparsopt,trparsfix,idparsopt,idparsfix,pars2,brts,missnumspec,methode)
                                                                                  ^

R/bd_loglik_choosepar.R:1:95: style: Commas should always have a space after.

bd_loglik_choosepar = function(trparsopt,trparsfix,idparsopt,idparsfix,pars2,brts,missnumspec,methode)
                                                                                              ^

R/bd_loglik_choosepar.R:2:1: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​{
^

R/bd_loglik_choosepar.R:3:12: style: Use <-, not =, for assignment.

trpars1 = rep(0,4)
           ^

R/bd_loglik_choosepar.R:3:20: style: Commas should always have a space after.

trpars1 = rep(0,4)
                   ^

R/bd_loglik_choosepar.R:4:23: style: Use <-, not =, for assignment.

trpars1[idparsopt] = trparsopt
                      ^

R/bd_loglik_choosepar.R:5:6: style: Place a space before left parenthesis, except in a function call.

if(length(idparsfix) != 0)
     ^

R/bd_loglik_choosepar.R:6:4: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​   {
   ^

R/bd_loglik_choosepar.R:7:26: style: Use <-, not =, for assignment.

trpars1[idparsfix] = trparsfix
                         ^

R/bd_loglik_choosepar.R:9:6: style: Place a space before left parenthesis, except in a function call.

if(max(trpars1) > 1 | min(trpars1) < 0)
     ^

R/bd_loglik_choosepar.R:10:4: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​   {
   ^

R/bd_loglik_choosepar.R:11:14: style: Use <-, not =, for assignment.

loglik = -Inf
             ^

R/bd_loglik_choosepar.R:13:13: style: Use <-, not =, for assignment.

pars1 = trpars1/(1 - trpars1)
            ^

R/bd_loglik_choosepar.R:13:22: style: Put spaces around all infix operators.

pars1 = trpars1/(1 - trpars1)
                    ~^~

R/bd_loglik_choosepar.R:13:23: style: Place a space before left parenthesis, except in a function call.

pars1 = trpars1/(1 - trpars1)
                      ^

R/bd_loglik_choosepar.R:14:1: style: Lines should not be more than 80 characters.

loglik = bd_loglik(pars1 = pars1,pars2 = pars2[1:6],brts = brts,missnumspec = missnumspec, methode = methode)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik_choosepar.R:14:14: style: Use <-, not =, for assignment.

loglik = bd_loglik(pars1 = pars1,pars2 = pars2[1:6],brts = brts,missnumspec = missnumspec, methode = methode)
             ^

R/bd_loglik_choosepar.R:14:16: warning: no visible global function definition for ‘bd_loglik’

loglik = bd_loglik(pars1 = pars1,pars2 = pars2[1:6],brts = brts,missnumspec = missnumspec, methode = methode)
               ^~~~~~~~~

R/bd_loglik_choosepar.R:14:40: style: Commas should always have a space after.

loglik = bd_loglik(pars1 = pars1,pars2 = pars2[1:6],brts = brts,missnumspec = missnumspec, methode = methode)
                                       ^

R/bd_loglik_choosepar.R:14:59: style: Commas should always have a space after.

loglik = bd_loglik(pars1 = pars1,pars2 = pars2[1:6],brts = brts,missnumspec = missnumspec, methode = methode)
                                                          ^

R/bd_loglik_choosepar.R:14:71: style: Commas should always have a space after.

loglik = bd_loglik(pars1 = pars1,pars2 = pars2[1:6],brts = brts,missnumspec = missnumspec, methode = methode)
                                                                      ^

R/bd_loglik_choosepar.R:15:9: style: Place a space before left parenthesis, except in a function call.

if(is.nan(loglik) || is.na(loglik))
        ^

R/bd_loglik_choosepar.R:16:7: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​      {
      ^

R/bd_loglik_choosepar.R:17:1: style: Lines should not be more than 80 characters.

​         cat("There are parameter values used which cause numerical problems.\n")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik_choosepar.R:18:17: style: Use <-, not =, for assignment.

loglik = -Inf
                ^

R/bd_loglik.R:41:80: style: Trailing whitespace is superfluous.

#' \cr \cr \code{pars2[4]} sets whether the parameters and likelihood should be 
                                                                               ^

R/bd_loglik.R:59:68: style: Trailing whitespace is superfluous.

#' bd_loglik(pars1 = c(0.5,0.1), pars2 = c(0,1,1,0,2), brts = 1:10, 
                                                                   ^

R/bd_loglik.R:62:1: style: functions should have cyclomatic complexity of less than 15, this has 71.

bd_loglik <- function(pars1, pars2, brts, missnumspec, methode = "lsoda"){
^

R/bd_loglik.R:62:73: style: There should be a space between right parenthesis and an opening curly brace.

bd_loglik <- function(pars1, pars2, brts, missnumspec, methode = "lsoda"){
                                                                        ^~

R/bd_loglik.R:66:1: style: Lines should not be more than 80 characters.

# - pars1[3] = la1 = parameter in exponential decay of speciation rate, OR K in 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:66:82: style: Trailing whitespace is superfluous.

# - pars1[3] = la1 = parameter in exponential decay of speciation rate, OR K in 
                                                                                 ^

R/bd_loglik.R:70:62: style: Trailing whitespace is superfluous.

# - pars1[5] = T0 = age at which lambda is lambda0 (default 
                                                             ^

R/bd_loglik.R:76:73: style: Trailing whitespace is superfluous.

# . tdmodel == 2: stepwise decline following diversity-dependence when 
                                                                        ^

R/bd_loglik.R:77:7: style: Commented code should be removed.

#   extinction = 0
      ^~~~~~~~~~~~~~

R/bd_loglik.R:78:80: style: Trailing whitespace is superfluous.

# . tdmodel == 3: decline in speciation rate following deterministic logistic 
                                                                               ^

R/bd_loglik.R:80:1: style: Lines should not be more than 80 characters.

# . tdmodel == 4...8: change in speciation/extinction rate following ddmodel = 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:80:81: style: Trailing whitespace is superfluous.

# . tdmodel == 4...8: change in speciation/extinction rate following ddmodel = 
                                                                                ^

R/bd_loglik.R:82:1: style: Lines should not be more than 80 characters.

# - pars2[2] = cond = conditioning on age (0), non-extinction of the clade and 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:82:81: style: Trailing whitespace is superfluous.

# - pars2[2] = cond = conditioning on age (0), non-extinction of the clade and 
                                                                                ^

R/bd_loglik.R:86:79: style: Trailing whitespace is superfluous.

# - pars2[5] = likelihood is for a tree with crown age (2) or stem age (1) - 
                                                                              ^

R/bd_loglik.R:89:1: style: Trailing whitespace is superfluous.

^~

R/bd_loglik.R:90:36: style: There should be a space between right parenthesis and an opening curly brace.

rhotaut <- function(tau, t1, pars){
                                   ^~

R/bd_loglik.R:105:74: style: Trailing whitespace is superfluous.

rtt <- mu0 / mu1 * (exp(-mu1 * t1) - exp(-mu1 * tau)) - la0 / la1 * 
                                                                         ^

R/bd_loglik.R:110:1: style: Trailing whitespace is superfluous.

^~

R/bd_loglik.R:111:3: style: Variable and function name style should be snake_case.

PtTint <- function(x, t1, pars){
  ^~~~~~

R/bd_loglik.R:111:33: style: There should be a space between right parenthesis and an opening curly brace.

PtTint <- function(x, t1, pars){
                                ^~

R/bd_loglik.R:112:5: style: Variable and function name style should be snake_case.

PtTint <- pars[2] * exp(-pars[4] * x) * exp(rhotaut(x, t1, pars))
    ^~~~~~

R/bd_loglik.R:115:1: style: Trailing whitespace is superfluous.

^~

R/bd_loglik.R:116:26: style: There should be a space between right parenthesis and an opening curly brace.

ff <- function(t1, pars){
                         ^~

R/bd_loglik.R:117:54: style: Place a space before left parenthesis, except in a function call.

ff <- 1 / pars[3] + (1 / 2 - 1 / pars[3]) * exp(-(pars[1] - pars[2]) * t1)
                                                     ^

R/bd_loglik.R:120:1: style: Trailing whitespace is superfluous.

^~

R/bd_loglik.R:121:40: style: There should be a space between right parenthesis and an opening curly brace.

exprhotaut2 <- function(tau, t1, pars){
                                       ^~

R/bd_loglik.R:125:1: style: Trailing whitespace is superfluous.

^~

R/bd_loglik.R:126:3: style: Variable and function name style should be snake_case.

intPtTint2 <- function(t1, T, pars){
  ^~~~~~~~~~

R/bd_loglik.R:126:30: style: Variable and function name style should be snake_case.

intPtTint2 <- function(t1, T, pars){
                             ^

R/bd_loglik.R:126:37: style: There should be a space between right parenthesis and an opening curly brace.

intPtTint2 <- function(t1, T, pars){
                                    ^~

R/bd_loglik.R:127:5: style: Variable and function name style should be snake_case.

intPtTint2 <- pars[2] / ff(t1,pars) * 
    ^~~~~~~~~~

R/bd_loglik.R:127:35: style: Commas should always have a space after.

intPtTint2 <- pars[2] / ff(t1,pars) * 
                                  ^

R/bd_loglik.R:127:42: style: Trailing whitespace is superfluous.

intPtTint2 <- pars[2] / ff(t1,pars) * 
                                         ^

R/bd_loglik.R:128:8: style: Do not place spaces around code in parentheses or square brackets.

​      ( (T - t1) / pars[3] + (ff(t1, pars) - ff(T, pars)) / 
       ^

R/bd_loglik.R:128:60: style: Trailing whitespace is superfluous.

​      ( (T - t1) / pars[3] + (ff(t1, pars) - ff(T, pars)) / 
                                                           ^

R/bd_loglik.R:129:30: style: Do not place spaces around code in parentheses or square brackets.

​          (pars[1] - pars[2]) )
                             ^

R/bd_loglik.R:132:1: style: Trailing whitespace is superfluous.

^~

R/bd_loglik.R:134:61: style: There should be a space between right parenthesis and an opening curly brace.

if (min(pars1) < 0 | (tdmodel == 4 & pars1[1] <= pars1[2])){
                                                            ^~

R/bd_loglik.R:141:18: style: There should be a space between right parenthesis and an opening curly brace.

if (cond == 3){
                 ^~

R/bd_loglik.R:147:24: style: There should be a space between right parenthesis and an opening curly brace.

if (is.na(pars2[6])){
                       ^~

R/bd_loglik.R:148:16: style: Use <-, not =, for assignment.

pars2[6] = Inf
               ^

R/bd_loglik.R:150:1: style: Trailing whitespace is superfluous.

^~~~

R/bd_loglik.R:151:32: style: There should be a space between right parenthesis and an opening curly brace.

if (soc == 1 & tdmodel == 2){
                               ^~

R/bd_loglik.R:153:73: style: Trailing whitespace is superfluous.

"Stem age and conditioning on extant taxa only have not yet been 
                                                                        ^

R/bd_loglik.R:158:12: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​    } else {        
           ^

R/bd_loglik.R:158:13: style: Trailing whitespace is superfluous.

​    } else {        
            ^~~~~~~~

R/bd_loglik.R:160:34: style: There should be a space between right parenthesis and an opening curly brace.

if (brts[length(brts)] == 0){
                                 ^~

R/bd_loglik.R:164:10: style: Place a space before left parenthesis, except in a function call.

for(i in 2:length(brts2)) {
         ^

R/bd_loglik.R:165:37: style: There should be a space between right parenthesis and an opening curly brace.

if (brts2[i] == brts2[i - 1]){
                                    ^~

R/bd_loglik.R:169:19: style: There should be a space between right parenthesis and an opening curly brace.

if (soc == 2){
                  ^~

R/bd_loglik.R:172:7: style: Variable and function name style should be snake_case.

TT <- brts[1]
      ^~

R/bd_loglik.R:174:1: style: Trailing whitespace is superfluous.

^~~~~~

R/bd_loglik.R:175:7: style: Variable and function name style should be snake_case.

S <- length(brts)
      ^

R/bd_loglik.R:176:7: style: Variable and function name style should be snake_case.

N <- S + m
      ^

R/bd_loglik.R:178:7: style: Variable and function name style should be snake_case.

PtT <- rep(0, S)
      ^~~

R/bd_loglik.R:180:1: style: Trailing whitespace is superfluous.

^~~~~~

R/bd_loglik.R:181:7: warning: local variable ‘abstol’ assigned but may not be used

abstol <- 1e-16
      ^~~~~~

R/bd_loglik.R:182:7: warning: local variable ‘reltol’ assigned but may not be used

reltol <- 1e-10
      ^~~~~~

R/bd_loglik.R:183:1: style: Trailing whitespace is superfluous.

^~~~~~

R/bd_loglik.R:184:7: style: Variable and function name style should be snake_case.

T0 <- TT
      ^~

R/bd_loglik.R:187:28: style: There should be a space between right parenthesis and an opening curly brace.

if (length(pars1) > 2){
                           ^~

R/bd_loglik.R:189:9: style: Variable and function name style should be snake_case.

K <- pars1[3]
        ^

R/bd_loglik.R:191:31: style: There should be a space between right parenthesis and an opening curly brace.

if (length(pars1) == 5){
                              ^~

R/bd_loglik.R:192:11: style: Variable and function name style should be snake_case.

T0 <- pars1[5]
          ^~

R/bd_loglik.R:193:10: style: Trailing whitespace is superfluous.

​        } 
         ^

R/bd_loglik.R:196:9: style: Variable and function name style should be snake_case.

K <- Inf
        ^

R/bd_loglik.R:198:31: style: Commas should always have a space after.

pars1 <- c(pars1, c(0,0))
                              ^

R/bd_loglik.R:200:1: style: Trailing whitespace is superfluous.

^~~~~~

R/bd_loglik.R:201:9: style: Place a space before left parenthesis, except in a function call.

if(tdmodel == 1){
        ^

R/bd_loglik.R:201:22: style: There should be a space between right parenthesis and an opening curly brace.

if(tdmodel == 1){
                     ^~

R/bd_loglik.R:205:1: style: Trailing whitespace is superfluous.

^~~~~~

R/bd_loglik.R:207:1: style: Trailing whitespace is superfluous.

^~~~~~

R/bd_loglik.R:208:9: style: Place a space before left parenthesis, except in a function call.

if(tdmodel == 0 | (tdmodel == 1 & la1 == 0 & mu1 == 0))
        ^

R/bd_loglik.R:209:7: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​      {
      ^

R/bd_loglik.R:210:11: style: Place a space before left parenthesis, except in a function call.

if(abs(la0 - mu0) < 1E-10){
          ^

R/bd_loglik.R:210:34: style: There should be a space between right parenthesis and an opening curly brace.

if(abs(la0 - mu0) < 1E-10){
                                 ^~

R/bd_loglik.R:212:11: style: Variable and function name style should be snake_case.

PtT <- 1 / (1 + lamu * (TT - t))
          ^~~

R/bd_loglik.R:215:11: style: Variable and function name style should be snake_case.

PtT <- (la0 - mu0) / (la0 - mu0 * exp(-(la0 - mu0) * (TT - t)))
          ^~~

R/bd_loglik.R:215:50: style: Place a space before left parenthesis, except in a function call.

PtT <- (la0 - mu0) / (la0 - mu0 * exp(-(la0 - mu0) * (TT - t)))
                                                 ^

R/bd_loglik.R:216:29: style: Place a space before left parenthesis, except in a function call.

ux <- la0 * (1 - exp(-(la0 - mu0) * (TT - t))) /
                            ^

R/bd_loglik.R:217:27: style: Place a space before left parenthesis, except in a function call.

​        (la0 - mu0 * exp(-(la0 - mu0) * (TT - t)))
                          ^

R/bd_loglik.R:220:47: style: There should be a space between right parenthesis and an opening curly brace.

if (tdmodel == 1 & (la1 != 0 | mu1 != 0)){
                                              ^~

R/bd_loglik.R:221:12: style: Place a space before left parenthesis, except in a function call.

for(i in 1:S){
           ^

R/bd_loglik.R:221:21: style: There should be a space between right parenthesis and an opening curly brace.

for(i in 1:S){
                    ^~

R/bd_loglik.R:223:46: style: Trailing whitespace is superfluous.

PtTint, lower = t[i], upper = TT, 
                                             ^

R/bd_loglik.R:225:20: style: Place a space before left parenthesis, except in a function call.

​          )$value)^(-1)
                   ^

R/bd_loglik.R:228:30: style: There should be a space between right parenthesis and an opening curly brace.

​      } else if (tdmodel == 2){
                             ^~

R/bd_loglik.R:229:27: style: There should be a space between right parenthesis and an opening curly brace.

if (N > ceiling(K)){
                          ^~

R/bd_loglik.R:233:22: style: Commas should always have a space after.

la <- pmax(0,la0 * (1 - (2:S) / K))
                     ^

R/bd_loglik.R:234:33: style: Commas should always have a space after.

dx <- c(abs(diff(brts)),brts[S])[2:S]
                                ^

R/bd_loglik.R:235:11: style: Commented code should be removed.

# mpfr(la, precBits = 500)
          ^~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:236:11: style: Commented code should be removed.

# mpfr(dx, precBits = 500)
          ^~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:238:9: style: Variable and function name style should be snake_case.

PtT <- rep(1,S)
        ^~~

R/bd_loglik.R:238:22: style: Commas should always have a space after.

PtT <- rep(1,S)
                     ^

R/bd_loglik.R:239:12: style: Place a space before left parenthesis, except in a function call.

for(i in 2:S){
           ^

R/bd_loglik.R:239:21: style: There should be a space between right parenthesis and an opening curly brace.

for(i in 2:S){
                    ^~

R/bd_loglik.R:243:30: style: There should be a space between right parenthesis and an opening curly brace.

​      } else if (tdmodel == 3){
                             ^~

R/bd_loglik.R:244:9: style: Variable and function name style should be snake_case.

PtT <- 1 / (1 + intPtTint2(t, TT, pars1))
        ^~~

R/bd_loglik.R:246:30: style: There should be a space between right parenthesis and an opening curly brace.

​      } else if (tdmodel == 4){
                             ^~

R/bd_loglik.R:247:9: style: Variable and function name style should be snake_case.

Kprime <- la0 / (la0 - mu0) * K
        ^~~~~~

R/bd_loglik.R:250:32: style: Trailing whitespace is superfluous.

​          ceiling(Kprime) < N | 
                               ^

R/bd_loglik.R:251:39: style: Trailing whitespace is superfluous.

K >= 0.9 * round(pars2[6]) | 
                                      ^

R/bd_loglik.R:252:18: style: Trailing whitespace is superfluous.

K < 1 | 
                 ^

R/bd_loglik.R:253:22: style: Trailing whitespace is superfluous.

la0 < mu0 | 
                     ^

R/bd_loglik.R:255:9: style: There should be a space between right parenthesis and an opening curly brace.

​        ){
        ^~

R/bd_loglik.R:264:25: style: Trailing whitespace is superfluous.

latd[1] <- mu0 + 
                        ^

R/bd_loglik.R:266:12: style: Place a space before left parenthesis, except in a function call.

for(k in 2:np){
           ^

R/bd_loglik.R:266:22: style: There should be a space between right parenthesis and an opening curly brace.

for(k in 2:np){
                     ^~

R/bd_loglik.R:270:1: style: Lines should not be more than 80 characters.

#y2 = deSolve::ode(variables, c(t1, t2), td_loglik_rhs, c(pars1[1:min(4, length(pars1))], tdmodel - 3, lx), rtol = 1e-10, atol = 1e-16, method = methode)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:270:12: style: Commented code should be removed.

#y2 = deSolve::ode(variables, c(t1, t2), td_loglik_rhs, c(pars1[1:min(4, length(pars1))], tdmodel - 3, lx), rtol = 1e-10, atol = 1e-16, method = methode)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:287:19: style: Only use double-quotes.

​              cat('NA or NaN issues encountered.\n')
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:292:15: style: Place a space before left parenthesis, except in a function call.

if(verbose) cat('Probabilities smaller than 0 encountered\n')
              ^

R/bd_loglik.R:292:29: style: Only use double-quotes.

if(verbose) cat('Probabilities smaller than 0 encountered\n')
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:294:35: style: Commas should always have a space after.

variables <- rep(-Inf,length(variables))
                                  ^

R/bd_loglik.R:295:12: style: Trailing whitespace is superfluous.

​          } 
           ^

R/bd_loglik.R:296:12: style: Commented code should be removed.

#variables2 = y2[2, 2:(lx + k)]
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:298:13: style: Trailing whitespace is superfluous.

#{ 
            ^

R/bd_loglik.R:299:15: style: Commented code should be removed.

#   print(variables2 - variables)
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:300:15: style: Commented code should be removed.

#   unequal <- which(variables != variables2)
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:301:14: style: Commented code should be removed.

#  if(length(unequal) > 0) stop('Stop here')
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:305:11: style: Variable and function name style should be snake_case.

dEN_dt <- (la0 - mu0) * expn[k] - expn2 * (la0 - mu0) / K
          ^~~~~~

R/bd_loglik.R:308:40: style: Do not place spaces around code in parentheses or square brackets.

if (sum(variables[1:lx]) < 0.99 ) {
                                       ^

R/bd_loglik.R:309:12: style: Commented code should be removed.

#print(lx)
           ^~~~~~~~~

R/bd_loglik.R:310:12: style: Commented code should be removed.

#print(sum(variables[1:lx]))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:311:15: style: Only use double-quotes.

​          cat('Leaking probabilities detected.')
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:315:9: style: Variable and function name style should be snake_case.

PtT <- 1 / (1 + sig)
        ^~~

R/bd_loglik.R:318:11: style: Variable and function name style should be snake_case.

PtT <- c(PtT[1], PtT)
          ^~~

R/bd_loglik.R:322:1: style: Trailing whitespace is superfluous.

^~~~~~

R/bd_loglik.R:324:11: style: Place a space before left parenthesis, except in a function call.

if(tdmodel == 0) {
          ^

R/bd_loglik.R:326:34: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​        } else if (tdmodel == 1) { 
                                 ^

R/bd_loglik.R:326:35: style: Trailing whitespace is superfluous.

​        } else if (tdmodel == 1) { 
                                  ^

R/bd_loglik.R:330:18: style: Place a space before left parenthesis, except in a function call.

​        } else if(tdmodel == 3) {
                 ^

R/bd_loglik.R:332:18: style: Place a space before left parenthesis, except in a function call.

​        } else if(tdmodel == 4) {
                 ^

R/bd_loglik.R:335:9: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​        {
        ^

R/bd_loglik.R:336:16: style: Only use double-quotes.

​          stop('The tdmodel you selected does not exist. Please check pars2.')
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:338:20: style: There should be a space between right parenthesis and an opening curly brace.

if (S > soc){
                   ^~

R/bd_loglik.R:339:64: style: Trailing whitespace is superfluous.

loglik <- loglik + sum(log(lavec[soc:length(lavec)])) 
                                                               ^

R/bd_loglik.R:342:1: style: Trailing whitespace is superfluous.

^~~~~~

R/bd_loglik.R:344:9: style: Place a space before left parenthesis, except in a function call.

if(cond == 1) {
        ^

R/bd_loglik.R:345:14: style: Use <-, not =, for assignment.

logp = soc * log(PtT[1])
             ^

R/bd_loglik.R:347:9: style: Place a space before left parenthesis, except in a function call.

if(cond == 2 | cond == 3) {
        ^

R/bd_loglik.R:348:11: style: Place a space before left parenthesis, except in a function call.

if(tdmodel == 2) {
          ^

R/bd_loglik.R:350:11: style: Variable and function name style should be snake_case.

K2 <- K
          ^~

R/bd_loglik.R:351:39: style: Opening curly braces should never go on their own line and should always be followed by a new line.

if (floor(K) == ceiling(K)) { 
                                      ^

R/bd_loglik.R:351:40: style: Trailing whitespace is superfluous.

if (floor(K) == ceiling(K)) { 
                                       ^

R/bd_loglik.R:352:13: style: Variable and function name style should be snake_case.

K2 <- K + eps
            ^~

R/bd_loglik.R:353:52: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​          } else if (floor(K + eps) == ceiling(K)) { 
                                                   ^

R/bd_loglik.R:353:53: style: Trailing whitespace is superfluous.

​          } else if (floor(K + eps) == ceiling(K)) { 
                                                    ^

R/bd_loglik.R:354:13: style: Variable and function name style should be snake_case.

K2 <- K - eps
            ^~

R/bd_loglik.R:356:13: style: Variable and function name style should be snake_case.

K2 <- K + eps
            ^~

R/bd_loglik.R:366:12: style: Commented code should be removed.

#pB = max(50,round(3/la0))
           ^~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:367:12: style: Commented code should be removed.

#s = mpfr(s, precBits = pB)      
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:367:38: style: Trailing whitespace is superfluous.

#s = mpfr(s, precBits = pB)      
                                     ^~~~~~

R/bd_loglik.R:368:12: style: Commented code should be removed.

#sgnsdiff = mpfr(sgnsdiff, precBits = pB)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:369:12: style: Commented code should be removed.

#logsdiff = mpfr(logsdiff, precBits = pB)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:370:12: style: Commented code should be removed.

#sgnsdiff2 = mpfr(sgnsdiff2, precBits = pB)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:371:12: style: Commented code should be removed.

#logsdiff2 = mpfr(logsdiff2, precBits = pB)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:372:12: style: Commented code should be removed.

#logsdiff3 = mpfr(logsdiff3, precBits = pB)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:374:26: style: Opening curly braces should never go on their own line and should always be followed by a new line.

for (i in 1:N) { 
                         ^

R/bd_loglik.R:374:27: style: Trailing whitespace is superfluous.

for (i in 1:N) { 
                          ^

R/bd_loglik.R:375:45: style: Commas should always have a space after.

sgnsdiff[i] <- prod(sign(s[-c(1,i)] - s[i]))
                                            ^

R/bd_loglik.R:376:47: style: Commas should always have a space after.

logsdiff[i] <- sum(log(abs(s[-c(1,i)] - s[i])))
                                              ^

R/bd_loglik.R:379:50: style: Put spaces around all infix operators.

logsdiff3[i] <- -sum(log(abs(1 - s[i]/s[-c(1,i,N)]))) - 
                                                ~^~

R/bd_loglik.R:379:58: style: Commas should always have a space after.

logsdiff3[i] <- -sum(log(abs(1 - s[i]/s[-c(1,i,N)]))) - 
                                                         ^

R/bd_loglik.R:379:60: style: Commas should always have a space after.

logsdiff3[i] <- -sum(log(abs(1 - s[i]/s[-c(1,i,N)]))) - 
                                                           ^

R/bd_loglik.R:379:68: style: Trailing whitespace is superfluous.

logsdiff3[i] <- -sum(log(abs(1 - s[i]/s[-c(1,i,N)]))) - 
                                                                   ^

R/bd_loglik.R:384:77: style: Trailing whitespace is superfluous.

#         logp <- sum(log(s[2:(N-1)])) + log(sum(sgnsdiff[2:N] * 
                                                                            ^

R/bd_loglik.R:386:1: style: Lines should not be more than 80 characters.

#         logp <- log(sum(sgnsdiff[2:N] * exp(sum(log(s[2:(N-1)])) - 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:386:81: style: Trailing whitespace is superfluous.

#         logp <- log(sum(sgnsdiff[2:N] * exp(sum(log(s[2:(N-1)])) - 
                                                                                ^

R/bd_loglik.R:390:35: style: Put spaces around all infix operators.

logp <- sum(log(s[1:(N-1)])) + 
                                 ~^~

R/bd_loglik.R:390:43: style: Trailing whitespace is superfluous.

logp <- sum(log(s[1:(N-1)])) + 
                                          ^

R/bd_loglik.R:395:13: style: Place a space before left parenthesis, except in a function call.

if(cond == 2) {
            ^

R/bd_loglik.R:396:70: style: Trailing whitespace is superfluous.

logp <- (soc == 2) * log(S + m - 1) + soc * log(PtT[1]) + 
                                                                     ^

R/bd_loglik.R:399:57: style: Trailing whitespace is superfluous.

logp <- log(PtT[1]) - log(S + missnumspec) - 
                                                        ^

R/bd_loglik.R:404:1: style: Trailing whitespace is superfluous.

^~~~~~

R/bd_loglik.R:406:1: style: Trailing whitespace is superfluous.

^~~~~~

R/bd_loglik.R:408:11: style: Place a space before left parenthesis, except in a function call.

if(tdmodel == 2) {
          ^

R/bd_loglik.R:410:60: style: Trailing whitespace is superfluous.

"Missing species in diversity-dependence models 
                                                           ^

R/bd_loglik.R:415:11: style: Place a space before left parenthesis, except in a function call.

if(cond == 3) {
          ^

R/bd_loglik.R:416:27: style: Place a space before left parenthesis, except in a function call.

x <- (1 - ux[1]^((0:m)+1)) / (1 - ux[1])
                          ^

R/bd_loglik.R:416:33: style: Put spaces around all infix operators.

x <- (1 - ux[1]^((0:m)+1)) / (1 - ux[1])
                               ~^~

R/bd_loglik.R:418:36: style: Place a space before left parenthesis, except in a function call.

x <- (1:(m + 1)) * ux[1]^(0:m)
                                   ^

R/bd_loglik.R:420:12: style: Place a space before left parenthesis, except in a function call.

for(j in 2:S) {
           ^

R/bd_loglik.R:421:1: style: Lines should not be more than 80 characters.

#x = convolve(x,rev((1:(m + 1)) * ux[j]^(0:m)),type = 'open')[1:(m + 1)]
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:421:12: style: Commented code should be removed.

#x = convolve(x,rev((1:(m + 1)) * ux[j]^(0:m)),type = 'open')[1:(m + 1)]
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:422:16: warning: no visible global function definition for ‘conv’

x <- conv(x, (1:(m + 1)) * ux[j]^(0:m))[1:(m+1)]
               ^~~~

R/bd_loglik.R:422:44: style: Place a space before left parenthesis, except in a function call.

x <- conv(x, (1:(m + 1)) * ux[j]^(0:m))[1:(m+1)]
                                           ^

R/bd_loglik.R:422:55: style: Put spaces around all infix operators.

x <- conv(x, (1:(m + 1)) * ux[j]^(0:m))[1:(m+1)]
                                                     ~^~

R/bd_loglik.R:424:59: style: Trailing whitespace is superfluous.

loglik <- loglik + lgamma(S + 1) + lgamma(m + 1) - 
                                                          ^

R/bd_loglik.R:426:1: style: Lines should not be more than 80 characters.

#loglik = loglik - log(S + m + 1) + log(S + 1) + log(S + m - 1) - log(S - 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:426:10: style: Commented code should be removed.

#loglik = loglik - log(S + m + 1) + log(S + 1) + log(S + m - 1) - log(S - 1)
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:429:11: style: Place a space before left parenthesis, except in a function call.

if(tdmodel == 0) {
          ^

R/bd_loglik.R:430:25: style: Only use double-quotes.

s1 <- sprintf('Parameters: %f %f', pars1[1], pars1[2])
                        ^~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:433:13: style: Only use double-quotes.

'Parameters: %f %f %f %f', pars1[1], pars1[2], pars1[3], pars1[4]
            ^~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:436:25: style: Only use double-quotes.

s1 <- sprintf('Parameters: %f %f %f', pars1[1], pars1[2], pars1[3])
                        ^~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:438:23: style: Only use double-quotes.

s2 <- sprintf(', Loglikelihood: %f', loglik)
                      ^~~~~~~~~~~~~~~~~~~~~

R/bd_ML.R:3:3: style: Trailing whitespace is superfluous.

#' 
  ^

R/bd_ML.R:8:3: style: Trailing whitespace is superfluous.

#' 
  ^

R/bd_ML.R:14:3: style: Trailing whitespace is superfluous.

#' 
  ^

R/bd_ML.R:40:1: style: Lines should not be more than 80 characters.

#' tdmodel == 4 : decline in speciation rate such that the expected number of species matches with
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_ML.R:48:1: style: Lines should not be more than 80 characters.

#' cond == 3 : conditioning on the total number of extant taxa (including missing species)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Feb 7, 2020

Codecov Report

Merging #18 into master will increase coverage by 0.88%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #18      +/-   ##
==========================================
+ Coverage   22.79%   23.68%   +0.88%     
==========================================
  Files          36       36              
  Lines        3487     3310     -177     
==========================================
- Hits          795      784      -11     
+ Misses       2692     2526     -166
Impacted Files Coverage Δ
src/dd_loglik_rhs_FORTRAN.f95 100% <100%> (ø) ⬆️
R/bd_loglik.R 47.6% <0%> (-1.45%) ⬇️
R/dd_KI_sim.R 0% <0%> (ø) ⬆️
R/dd_SR_sim.R 0% <0%> (ø) ⬆️
R/dd_MS_sim.R 0% <0%> (ø) ⬆️
src/R_init_DDD.c 100% <0%> (ø) ⬆️
R/dd_sim.R 0% <0%> (ø) ⬆️
R/dd_LR.R 0% <0%> (ø) ⬆️
R/td_sim.R 0% <0%> (ø) ⬆️
R/dd_utils.R 6.72% <0%> (+1.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 467f31e...6c6e433. Read the comment docs.

@rsetienne

This comment has been minimized.

Copy link
Owner

rsetienne commented Feb 7, 2020

Fixed in develop and will be pushed to master.

@rsetienne rsetienne closed this Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.