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, SpatRaster)
S3method(matern, SpatVector)
S3method(matern, dist)
S3method(matern, dsyMatrix)
S3method(matern, default)
export(fillParam)

export(geostatData)
S3method(geostatData, SpatRaster)
S3method(geostatData, SpatVector)
S3method(geostatData, default)



export(squareRaster)

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

export(NNmat)
S3method(NNmat, default)
S3method(NNmat,SpatRaster)	

export(variog)
S3method(variog, SpatVector)
S3method(variog, default)


export(variogMcEnv)
S3method(variogMcEnv, SpatVector)
S3method(variogMcEnv, default)

# Import all packages listed as Imports or Depends
import(
  Matrix, methods
)
import(terra, except='na.omit')

importFrom(numDeriv,hessian)
importFrom(abind, abind)

#importFrom(pracma, trapz)



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

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')