##-*- mode: org -*-

* Important
** TODO MM: your TODOs in the code
** TODO MM: proper data analysis in the paper
** TODO MM: In subjob(), at match() call: If there is a "..." among nmOne, (maybe?) match all the others
** TODO MM: please fix robcovMCD demo. I receive "Error: n.sim%%block.size == 0 is not TRUE" with doForeach() on line 101 [please check the whole demo].
** TODO introduce 'names' = TRUE/FALSE to plot varList[["tau"]]$expr (for all variables), so 'tau==' instead of just values
** TODO fix 'cex' error in legend (a lot to do in 'grid'... see emails from Paul Murrell + post on stackoverflow)
** DONE fix background grob (or use old, base-graphics idea)
** DONE fix legend in mayplot() (depends on panel function)
** DONE mayplot() with 'n.sim' should have (optionally)  mtext(4, "n.sim=",n.sim) [already mentioned in the paper!!!!!!!]
** DONE use and describe doCheck() in paper
** DONE MM: doCheck(doOne, vList) {in the end calling mkAL()} - called in each do*Apply()
** DONE MH man/varlist.Rd : better describe varlist() - as in paper! default="frozen" etc
** DONE mayplot: make standard 'lines' the default panel function
** DONE Change doOne()'s arg.list to contain *all* (=> adjust subjob)
 (grid,inner,frozen) variables.  In that case, doCheck() is even more important.
 see demo/TGforecasts.R : the future doOne() is basically stat() there;
 and subjob()'s job is to take (x, nonGrids) and call doOne() correctly.
** DONE Good statistical simulation: *all* method variants on *same* random data.
If method variants are "inner", and are all done in doOne(); RNG only
happens once, instead of often (giving identical RN).
** DONE Robin says "bad design in doOne()"  MM disagrees, but still good idea!
 If you allow the user to provide own functions (in many other contexts),
 it is typically the case that this system calls the user function (which
 calls other ..).
  Can't we just add all that in subJob and have doOne just return an array (=
  value)? Also: final arg 'f' is not mentioned in onion graphic
** DONE New option to *not* store the .Random.seed
** DONE Solution: Not importing Rmpi; Fix warnings 'selectChildren'
** DONE pass 'monitor' (instead of 'printInfo') to clusters in doRmpi/doCluster.
*** DONE Check that this works with monitor = user-provided func. myMoni()
** DONE MM: finish other demos
** DONE Google is not our boss. Google also has an ugly R style "straight jacket" (they call "guide").
1) ... that we use fancy (= listings/non-R) characters for '!=' etc. ...
2) ... that we have no obvious convention for using spaces around '='
Robin: At Google, both 1) (in job interviews) and 2) are considered 'bad
style/quality'. MH: Concerning 1), we could just use special characters for
arrows (so far, we have them for arrows, <=, >=, !=); Concerning 2), Robin
mentioned that Google's policy is to either use " = " or "=" everywhere in the
same script/file.
** DONE We do not do this: Robin: why not convert lines of virtual grid to seeds (via hash functions for strings)?
** DONE R cannot do multithreading, in general; multi-threaded BLAS etc, mentioned in 'parallel' vignette.
** DONE why does demo fail (return object of doRmpi is different) => don't use different mkAL for comparing
** DONE MH: make clear in paper which *function definitions* are contributed by *user* (vs. those from the pkg)
** DONE MH: put in n.block feature
** DONE MM: 'value' of varlist being functions: anything left to do?
     => maybe you can briefly check the code if it 'looks' fine/suspicious
** DONE MM: what do you think about these package names?
  + SIMPA (= simulations parallelized; toent 'sympatisch')
  + SIRUP (= simulations in R under parllelism)
  + SIMM or simmmmh(simulation + 'MM' fuer 'Martin/Marius'
  + RIP (= R in parallel)
  + || (= zwei parallele Striche; vlt. etwas zu heftig)
  + SIN (= simulations nonrestricted (oder so))
  + simple (= simulations parallelized)
** DONE fix many bugs of Gneiting demo
** DONE solve switch(factor)-bug; varlist() user doesn't know that grid converts strings to factors!
** DONE heartbeat in subjob: doRmpi() and doClusterApply do *not* display heartbeat! (see http://r.789695.n4.nabble.com/snow-parLapply-standard-output-td821511.html) For the latter, use makeCluster's 'outfile' argument, for the former, use mpi.remote.exec as described here (http://math.acadiau.ca/ACMMaC/Rmpi/sample.html)
** DONE export dev.off.pdf() [ R/device.R ]; how to prevent device from being opened?
** DONE export fftable() probably *after* renaming it: Used in example(tablines)
** DONE mayplot: proper centering of y-axis label
** DONE Consider to replace 'type="MPI" in makeCluster(), by its default, i.e. "PSOCK".
Dirk E.: You don't want to do that; PSOCK is only minimal s.th. it runs on windows.
** DONE 2a, b, d, e: do we need "snow::"makeCluster??? should work with parallel's makeCluster!!! [parallel is better/an improved version; does the right thing depending on the communication [sockets/forking]]
** DONE 2a, b, d, e: when in package, need an argument to provide the number of cores!
** DONE write toLatex."varList"; varList class --> 01*Rnw
** DONE write toLatex.ftable --> 03*Rnw
** DONE simsalapar: a package of the general simulation-related functions (and the R scripts);
** DONE how do we call doCallWE with return value being a vector or 'htest' object?
** DONE put more functions from the data analysis in 'simsalapar'
** DONE shouldn't mclapply (and others) *always* use RNGkind(...)?
** DONE lapply: write a version based on parallel's lecuyer which advances the seed
  (as we suspect parallel does) => hopefully we get a reproducible example
MMH: it's given in parallel's vignette how to advance L'Ecuyer's rng:
nnextRNGSubStream() advances to the next substream.
** DONE check if error and warning "counting" (percentages) works correctly (since a vector of NULL is just NULL)
** DONE simsalapar/ - gridBase
*** Currently  mayplot() needs to  require(grid), {and DESCRIPTION a Suggests:grid}
--- no longer in new gridBase {thanks to E-mails to Paul Murrell}

** DONE labeling of colors for different d
** DONE tau labels
** DONE put graphic in a function
** DONE xtable with siunitx
** DONE Graphic in demo.R
** DONE Which cases (3.1), 3.2), ...) work without restarting R? [ideally all...]
      => up to foreach, all (in current order)
** DONE use parallel::foo instead of require() (as in the parallel vignette)
MMH: DONE as much as possible, sometimes not possible!!! (NextMethod/UseMethod errors)
** DONE replace clusterApplyLB() by clusterApply()
MH: with mpi.apply (instead of mpi.applyLB()) not possible, so there we use load
balancing at the cost of not being reproducible.

** DONE "move" resEQ() from demo/TGforecasts.R into inst/xtraR/util.R or the package itself

* Further (mid term):
** TODO MM: do*Apply(): use  check=check.control() which has
(doCheck=TRUE, checkSave=TRUE, verbose=FALSE, nChks=1)
** Add a demo / example with getArray(*, FUN= F) {F: R^p -> R}, e.g. coef. |-> MSE
** MM export the nice expr2pdf() utilities in demo/latex.tables.R
** deprecate format.ftable.() and forMat() after a while
** change mayplot(): return a "grob" !  ==> base all on grid alone.
* Outlook -- maybe
** R/array-stuff.R : getArray(.) maybe allow  comp = '.Random.seed' (but new dim..)
** is getEl() "vectorized"? [for extracting several types and components simultaneously]
