# Load dynamic library
useDynLib(mixAK)


# Export all names
exportPattern("GLMM_MCMC*")
exportClasses("GLMM_MCMC", "GLMM_MCMClist")
S3method(fitted, "GLMM_MCMC")
S3method(print, "GLMM_MCMC")
S3method(print, "GLMM_MCMClist")

export("GLMM_longitDA")

exportPattern("NMix*")
exportClasses("NMixEM", "NMixMCMC", "NMixMCMClist")
S3method(print, "NMixEM")
S3method(print, "NMixMCMC")
S3method(print, "NMixMCMClist")

S3method(NMixPseudoGOF, "default")
S3method(NMixPseudoGOF, "NMixMCMC")

S3method(NMixRelabel, "default")
S3method(NMixRelabel, "NMixMCMC")
S3method(NMixRelabel, "GLMM_MCMC")

S3method(NMixSummComp, "default")
S3method(NMixSummComp, "NMixMCMC")
S3method(NMixSummComp, "GLMM_MCMC")

S3method(NMixChainComp, "default")
S3method(NMixChainComp, "NMixMCMC")
S3method(NMixChainComp, "GLMM_MCMC")

export("tracePlots")
S3method(tracePlots, "default")
S3method(tracePlots, "NMixMCMC")
S3method(tracePlots, "GLMM_MCMC")
S3method(tracePlots, "GLMM_MCMClist")

exportClasses("NMixPlugCondDensJoint2", "NMixPlugCondDensMarg", "NMixPlugDensJoint2", "NMixPlugDensMarg", "NMixPredCDFMarg", "NMixPredCondCDFMarg", "NMixPredCondDensJoint2", "NMixPredCondDensMarg", "NMixPredDensJoint2", "NMixPredDensMarg")
S3method(plot, "NMixPlugCondDensJoint2")
S3method(plot, "NMixPlugCondDensMarg")
S3method(plot, "NMixPlugDensJoint2")
S3method(plot, "NMixPlugDensMarg")
S3method(plot, "NMixPredCDFMarg")
S3method(plot, "NMixPredCondCDFMarg")
S3method(plot, "NMixPredCondDensJoint2")
S3method(plot, "NMixPredCondDensMarg")
S3method(plot, "NMixPredDensJoint2")
S3method(plot, "NMixPredDensMarg")

export("Y2T")
S3method(Y2T, "NMixPlugCondDensJoint2")
S3method(Y2T, "NMixPlugCondDensMarg")
S3method(Y2T, "NMixPlugDensJoint2")
S3method(Y2T, "NMixPlugDensMarg")
S3method(Y2T, "NMixPredCDFMarg")
S3method(Y2T, "NMixPredCondCDFMarg")
S3method(Y2T, "NMixPredCondDensJoint2")
S3method(Y2T, "NMixPredCondDensMarg")
S3method(Y2T, "NMixPredDensJoint2")
S3method(Y2T, "NMixPredDensMarg")

export("summaryDiff")
export("BLA", "BsBasis", "MatMPpinv", "MatSqrt", "SP2Rect", "autolayout", "cbplot", "generatePermutations", "getProfiles", "plotProfiles")
export("dMVN", "rMVN")
export("rcMVN")
export("dMVNmixture", "dMVNmixture2", "rMVNmixture", "rMVNmixture2")
export("rTMVN")
export("rTNorm")
export("dMVT", "rMVT")
export("dWISHART", "rWISHART")
export("rDirichlet")
export("rRotationMatrix")
export("rSamplePair")

# Selective import from other packages
importFrom(splines,  "bs")               ## In: BsBasis
importFrom(mnormt,   "pmnorm")           ## In: NMixPseudoGOF.default
importFrom(parallel, "detectCores", "makeCluster", "parLapply", "stopCluster")      ## In: GLMM_MCMC, NMixMCMC, NMixRelabel.GLMM_MCMClist
importFrom(lme4, "lmer", "glmer", "fixef", "VarCorr", "ranef", "glmerControl")      ## In: GLMM_MCMCifit
importClassesFrom(lme4, "glmerMod", "lmerMod", "merMod")
     ### From lme4, we additionally use: vcov, which is defined in the lme4 (1.0-4) NAMESPACE as:
     ###   importFrom(stats, vcov)
     ###   S3method(vcov, merMod)
     ###
     ### Telling importFrom(lme4, "vcov") here causes error: objects `vcov' are not exported by 'namespace:lme4'
     ### I guess that by importing the merMod class, it is no more necessary import vcov explicitely...
     ###
importFrom(fastGHQuad, "gaussHermiteData", "aghQuad")           ## In: fitted.GLMM_MCMC

# Import full packages where more functions are used
import(colorspace)
