## NAMESPACE

useDynLib(diversitree, .registration = TRUE)

import(methods)
import(Rcpp)
import(ape)
import(deSolve)
import(subplex)

importFrom("grDevices", "col2rgb", "heat.colors", "rgb")
importFrom("graphics", "arrows", "hist", "legend", "lines", "par",
           "plot", "points", "polygon", "rect", "segments", "strwidth",
           "text")
importFrom("stats", "AIC", "approxfun", "as.formula", "coef", "dbeta",
           "dexp", "dhyper", "dnorm", "ecdf", "fft", "fitted",
           "logLik", "mahalanobis", "model.frame", "model.matrix",
           "na.fail", "na.omit", "nlm", "nlminb", "optim", "optimize",
           "pchisq", "predict", "quantile", "reorder", "rexp", "rnorm",
           "runif", "spline")
importFrom("utils", "combn", "modifyList", "write.csv")

## 1. make
export(make.bd)
export(make.bd.split)
export(make.bd.t)
export(make.bisse)
export(make.bisse.split)
export(make.bisse.t)
export(make.bisse.td)
export(make.bisse.uneven)
export(make.bisseness)
export(make.bm)
export(make.classe)
export(make.eb)
export(make.geosse)
export(make.geosse.split)
export(make.geosse.t)
export(make.geosse.uneven)
export(make.lambda)
export(make.mk2)
export(make.mkn)
export(make.mkn.multitrait)
export(make.mkn.meristic)
export(make.musse)
export(make.musse.multitrait)
export(make.musse.split)
export(make.musse.t)
export(make.musse.td)
export(make.ou)
export(make.pgls)
export(make.quasse)
export(make.quasse.split)
export(make.yule)

## 2. print:
S3method(print, dtlik)

## 3: argnames / argnames<-
export(argnames)
export("argnames<-")

S3method(argnames, dtlik)
S3method("argnames<-", dtlik)

S3method(argnames, constrained)
S3method("argnames<-", constrained)

## 4: find.mle
export(find.mle)

S3method(find.mle, default)
S3method(find.mle, dtlik)
S3method(find.mle, mixed)

## Other method support:
S3method(anova, fit.mle)
S3method(coef, fit.mle)
S3method(extractAIC, fit.mle)
S3method(logLik, fit.mle)

## Changes coming soon.
S3method(predict, dtlik.t)
S3method(plot, dtlik.t)
S3method(coef, mcmcsamples)

## Starting points:
export(starting.point.bisse)
export(starting.point.bd)
export(starting.point.classe)
export(starting.point.geosse)
export(starting.point.musse)
export(starting.point.musse.multitrait)
export(starting.point.quasse)

## 5. MCMC:
export(mcmc)

S3method(mcmc, default)
S3method(mcmc, dtlik)
S3method(mcmc, lowerzero)

export(sampler.slice)
export(sampler.norm)

export(constrain)
export(constrain.i)

export(expand.parameters)

## Tree evolution code
export(trees)

export(tree.bd)
export(tree.bisse)
export(tree.bisseness)
export(tree.classe)
export(tree.geosse)
export(tree.musse)
export(tree.musse.multitrait)
export(tree.quasse)
export(tree.yule)

export(sim.character)
export(make.sim.character)

## Utility functions:
export(protect)
export(invert)
export(big.brother)
export(set.defaults)
export(combine)

export(profiles.plot)
export(trait.plot)

export(make.prior.exponential)
export(make.prior.uniform)

export(prune)
export(get.descendants)

export(run.cached)
export(drop.likelihood)
export(get.likelihood)

## Support for QuaSSE models.
export(constant.x)
export(make.linear.x)
export(noroptimal.x)
export(sigmoid.x)
export(sigmoid2.x)
export(stepf.x)

export(make.brownian.with.drift)

## Support for MuSSE/Multitrait models
export(mkn.multitrait.translate)
export(musse.multitrait.translate)

## Support for ClaSSE (not yet exported)
## export(flatten.pars.classe)
## export(inflate.pars.classe)

## ASR:
export(make.asr.marginal)
export(make.asr.joint)
export(make.asr.stoch)

## Convenience:
export(asr.marginal)
export(asr.joint)
export(asr.stoch)

S3method(make.asr.marginal, constrained)
S3method(make.asr.joint, constrained)
S3method(make.asr.stoch, constrained)

## ASR/Mkn
S3method(make.asr.marginal, mkn)
S3method(make.asr.joint, mkn)
S3method(make.asr.stoch, mkn)

## ASR/xxSSE
S3method(make.asr.marginal, bisse)
S3method(make.asr.marginal, bisse.split)
S3method(make.asr.marginal, musse)
S3method(make.asr.marginal, bisse.t)
S3method(make.asr.marginal, musse.t)

S3method(make.asr.marginal, geosse)

S3method(residuals, pgls.dt)
S3method(fitted,    pgls.dt)
S3method(residuals, fit.mle.pgls)
S3method(fitted,    fit.mle.pgls)
S3method(residuals, mcmcsamples.pgls)
S3method(fitted,    mcmcsamples.pgls)

## TODO: This means that the time-dependent ones won't dispatch?

## Support for "clade.tree"s
export(make.clade.tree)
export(clades.from.polytomies)
export(clades.from.classification)
S3method(plot, clade.tree)

## Deprecated:
export(polytomies.to.clades)

## History objects
S3method(plot, history)
export(history.from.sim.discrete)

## Constants
export(ROOT.FLAT)
export(ROOT.EQUI)
export(ROOT.OBS)
export(ROOT.GIVEN)
export(ROOT.BOTH)
export(ROOT.MAX)
export(ROOT.ALL)

## QuaSSE util: not generally used.
## export(quasse.extent)
## export(expand.pars.quasse)
## export(make.pde.quasse.fftC)
## export(make.pde.quasse.fftR)
## export(make.pde.quasse.mol)
## export(make.branches.quasse.fftC)
## export(make.branches.quasse.fftR)
## export(make.branches.quasse.mol)
## export(make.branches.aux.quasse.fftC)

## These aren't really needed any more.
## export(load.wisdom)
## export(save.wisdom)

## Check capabilities of package
export(check.fftC)
