useDynLib("geostatsp", .registration = TRUE, .fixes = "C_")


# functions that don't depend on other packages

export(lgm, glgm, lgcp,
 krigeLgm,stackRasterList,
 simLgcp,simPoissonPP,
 excProb, likfitLgm, loglikLgm,
 profLlgm, informationLgm, conditionalGmrf, spatialRoc,
 spdfToBrick, pcPriorRange, postExp
)


export(RFsimulate)
export(modelRandomFields)

export(matern)

S3method(matern, Raster)
S3method(matern, SpatialPointsDataFrame)
S3method(matern, SpatialPoints)
S3method(matern, dist)
S3method(matern, dsyMatrix)
S3method(matern, default)
export(fillParam)

#S3method(as.im, RasterLayer)
export(asImRaster)


export(squareRaster)

export(maternGmrfPrec)
S3method(maternGmrfPrec, dgCMatrix)
S3method(maternGmrfPrec, default)

export(NNmat)
S3method(NNmat, default)
S3method(NNmat,Raster)	

export(variog)
S3method(variog, SpatialPointsDataFrame)
S3method(variog, default)


export(variogMcEnv)
S3method(variogMcEnv, SpatialPointsDataFrame)
S3method(variogMcEnv, default)

# Import all packages listed as Imports or Depends
import(
  sp,
  raster,
  Matrix, methods
)

importFrom(numDeriv,hessian)
importFrom(abind, abind)
#importFrom(pracma, trapz)

# the following are imports from packages listed as Suggests
# calls to these functions are made with ::
# the imports below are unnecessary but here for completeness
#importFrom(geoR, variog, variog.mc.env)
#importFrom(spatstat,as.im,as.im.matrix)
#importFrom(parallel, mcmapply)


# only needed because INLA is requireNamespace instead of require
export(inla.models)

importFrom(utils, installed.packages)

importFrom(stats, as.formula, update.formula, terms, drop.terms)   
importFrom(stats, model.matrix, lm, model.frame) 

importFrom(stats, approx, na.omit, reshape)
importFrom(stats, dist, as.dist)
importFrom(stats, optimize, optim)
 
importFrom(stats, pgamma, dgamma, qgamma)
importFrom(stats, pnorm, rnorm, qnorm)
importFrom(stats, runif, rpois)
importFrom(stats, pchisq, qchisq)

importFrom(stats, logLik, AIC)
S3method(AIC, 'lgm')
S3method(logLik, 'lgm')
S3method(summary, 'lgm')