useDynLib(sommer, .registration=TRUE)
importFrom(Rcpp, evalCpp)
#exportPattern("^[[:alpha:]]+")


export(
       dfToMatrix
       )

## FUN_main
export(mmes, vsm, nbinom2, zipoisson, ordinal, multinomial,
       mmes_control, mmes_method, parameter, curve_term,
       nonlinear_curve,
       profile_nonlinear, boot_mmes,
       generate_mme_workload, mme_workload_grid,
       run_mme_benchmark, analyze_mme_crossovers, profile_mme_workload,
       mmer, vsr,
       GWAS,
       MNR)

## FUN_special and FUN_vsc and FUN_vsrgvsr
export( # small matrices constructors
       unsm, unsm2, fixm, 
       # mmes covariance functions
       atm,csm,dsm,usm,vsm, ism, covm, strm, ar1m, ar2m, ar3m, dsumm,
       mam, fam, antem, corgm, ownm,
       rrm, maternm , toeplitzm, sar, car, metricm,
       # mmes covariance functions
       usr, dsr, csr, atr,  
       # mmer DEPRECATED
        vs
       )

## FUN_spatial
export( spl2Dc,spl2Dmats,tpsmmbwrapper)

## FUN_stats
export( 
       corImputation,
       r2, postPEV, postVarU, post_nonlinear
       )

## FUN_relationships
export(A.mat, D.mat, E.mat, H.mat, APY)

## FUN_utils
export( 
        # mmes
       summary.mmes, residuals.mmes, fitted.mmes, coef.mmes,
       anova.mmes, plot.mmes, predict.mmes, pmonitor,
       loadings_mmes, scores_mmes, covparams_mmes, covparams_mmes_se, meffects_mmes,
       wald_mmes,
       rotate_back_mmes,
       # GLMM
       binm, familym,
       # multivariate
       stackTraits, covmatrix_mmes,
        # others
       randef)

# S3 METHODS mmes
export(vcDelta)
S3method(vcDelta, mmes)
S3method(vcDelta, mmes.nonlinear)

# S3 METHODS mmes
S3method(anova, mmes)
S3method(anova, mmes.nonlinear)
S3method(AIC, mmes.specification)
S3method(AIC, mmes.nonlinear)
S3method(BIC, mmes.specification)
S3method(BIC, mmes.nonlinear)
S3method(coef, mmes.nonlinear)
S3method(confint, mmes.nonlinear)
S3method(fitted, mmes.nonlinear)
S3method(logLik, mmes.nonlinear)
S3method(nobs, mmes.nonlinear)
S3method(predict, mmes.nonlinear)
S3method(print, mmes.nonlinear)
S3method(print, summary.mmes.nonlinear)
S3method(residuals, mmes.nonlinear)
S3method(simulate, mmes.nonlinear)
S3method(summary, mmes.nonlinear)
S3method(vcov, mmes.nonlinear)
S3method(vcov, mmes.glmm.laplace)
S3method(coef, mmes)
S3method(fitted, mmes)
S3method(logLik, mmes)
S3method(plot, mmes)
S3method(predict, mmes)
S3method(print, predict.mmes)
S3method(print, residuals.mmes)
S3method(print, fitted.mmes)
S3method(print, coef.mmes)
S3method(print, summary.mmes)
S3method(print, mmes.glmm.laplace)
S3method(print, wald.mmes)
S3method(print, mmesSolve)
S3method(print, sommer_mmes_control)
S3method(print, sommer_mme_benchmark)
S3method(print, sommer_mme_crossover)
S3method(print, sommer_mme_profile)
S3method(residuals, mmes)
S3method(simulate, mmes.glmm.laplace)
S3method(coef, mmes.specification)
S3method(fitted, mmes.specification)
S3method(residuals, mmes.specification)
S3method(predict, mmes.specification)
S3method(logLik, mmes.specification)
S3method(nobs, mmes.specification)
S3method(vcov, mmes.specification)
S3method(confint, mmes.specification)
S3method(anova, mmes.specification)
S3method(vcDelta, mmes.specification)
S3method(simulate, mmes.specification)
S3method(summary, mmes.specification)
S3method(print, mmes.specification)
S3method(print, summary.mmes.specification)
S3method(summary, mmes)
S3method(summary, mmer)
S3method("[", binm)



###########
## full imports
###########
  import("methods")
  import("Matrix")
  importFrom("crayon", "red", "blue", "bgGreen", "bgRed", "bgWhite",
             "bold", "magenta", "white", "yellow")
  import("enhancer")
############
# IMPORTS
############
  importFrom("graphics", "abline", "axis", "layout", "legend",
             "lines", "plot", "points", "rect", "text", "locator",
             "par", "grid", "plot.new", "polygon","segments", "title")
  importFrom("utils", "combn", "setTxtProgressBar", "txtProgressBar",
             "available.packages", "contrib.url","str")
  importFrom("methods", "as")
#  importFrom("crayon", "blue")

### extra suggested by CRAN
  importFrom("grDevices", "col2rgb", "colorRampPalette", "gray.colors",
             "rgb","dev.cur", "dev.size", "xy.coords", "topo.colors")
  importFrom("stats", "AIC", "BIC", "reformulate", "as.formula", "cov", "density", "gaussian", "glm",
             "lm", "median", "optimize", "pbeta", "pchisq","pnorm", "predict",
             "printCoefmat", "qqnorm", "smooth.spline", "var", "rnorm",
             "model.matrix","na.omit", "p.adjust","kmeans","dist", "runif",
             "nobs", "ppoints", "sd", "model.frame", "model.response", "na.pass",
             "cor", "optim", "rchisq","quantile","deriv","terms.formula",
             "aggregate","pf","terms", "reshape","ave", "plogis", "qlogis",
             "simulate", "residuals")
