~showard314/ubuntu/karmic/r-base/remove_start_comments

« back to all changes in this revision

Viewing changes to src/library/stats/R/optim.R

  • Committer: Bazaar Package Importer
  • Author(s): Dirk Eddelbuettel
  • Date: 2009-01-19 12:40:24 UTC
  • mfrom: (5.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090119124024-abxsf4e0y7713w9m
Tags: 2.8.1-2
debian/control: Add another Build-Depends: exclusion for the 
'kfreebsd-i386 kfreebsd-amd64 hurd-i386' architecture to openjdk-6-jdk.
Thanks to Petr Salinger for the heads-up.               (Closes: 512324)

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
    ## Defaults :
32
32
    con <- list(trace = 0, fnscale = 1, parscale = rep.int(1, length(par)),
33
33
                ndeps = rep.int(1e-3, length(par)),
34
 
                maxit = 100, abstol = -Inf, reltol=sqrt(.Machine$double.eps),
 
34
                maxit = 100L, abstol = -Inf, reltol=sqrt(.Machine$double.eps),
35
35
                alpha = 1.0, beta = 0.5, gamma = 2.0,
36
36
                REPORT = 10,
37
37
                type = 1,
39
39
                tmax = 10, temp = 10.0)
40
40
    nmsC <- names(con)
41
41
    if (method == "Nelder-Mead") con$maxit <- 500
42
 
    if (method == "SANN") con$maxit <- 10000
43
 
 
 
42
    if (method == "SANN") {
 
43
        con$maxit <- 10000
 
44
        con$REPORT <- 100
 
45
    }
44
46
    con[(namc <- names(control))] <- control
45
47
    if(length(noNms <- namc[!namc %in% nmsC]) > 0)
46
48
        warning("unknown names in control: ", paste(noNms,collapse=", "))
47
49
    if(con$trace < 0)
48
50
        warning("read the documentation for 'trace' more carefully")
 
51
    else if (method == "SANN" && con$trace && as.integer(con$REPORT) == 0)
 
52
        stop("'trace != 0' needs 'REPORT >= 1'")
49
53
    if (method == "L-BFGS-B" &&
50
54
        any(!is.na(match(c("reltol","abstol"), namc))))
51
55
        warning("method L-BFGS-B uses 'factr' (and 'pgtol') instead of 'reltol' and 'abstol'")