useDynLib(nvmix, .registration = TRUE)


### Imports ####################################################################

importFrom("stats",
           "runif", "rnorm", "pt", "qt", "dt", "pgamma", "rgamma", "pnorm",
           "sd", qchisq, "qnorm", "dnorm", "qgamma", "uniroot", "cov2cor",
           "cor", "cov", "cov.wt", "optim", "optimize", "var", "pchisq",
           "dgamma", "mahalanobis", "pf", "ppoints", "qf", "df", "qqnorm",
           "qqline", "ks.test", "quantile", "splinefun")
importFrom("methods",
           "existsFunction", "hasArg")
importFrom("qrng",
           "sobol", "ghalton")
importFrom("utils",
           "head", "tail")
importFrom("Matrix",
	   "nearPD")
importFrom("graphics",
           "lines", "plot", "axis", "legend", "mtext", "par", "points", "abline")
importFrom("copula",
           "pobs")
importFrom("pcaPP",
           "cor.fk")
importFrom("ADGofTest",
           "ad.test")
importFrom("mnormt",
            "pd.solve")
importFrom("pracma", 
	   "pchip")

### Exports ####################################################################

export("dnvmix", "pnvmix", "rnvmix", "pgnvmix", "rgnvmix", "dgnvmix",
       "fitnvmix", "qnvmix", "qqplot_maha",
       "dStudent", "dgStudent", "pStudent", "rStudent", "fitStudent", "pgStudent", "rgStudent", 
       "pgStudentcopula", "rgStudentcopula", "dgStudentcopula",
       "fitgStudentcopula", "fitStudentcopula",
       "dNorm", "pNorm", "rNorm", "fitNorm", "rNorm_sumconstr",
       "get_set_param",
       "dnvmixcopula", "pnvmixcopula", "rnvmixcopula",
       "pStudentcopula", "rStudentcopula", "dStudentcopula", 
       "dgammamix", "pgammamix", "qgammamix", "rgammamix",
       "ES_nvmix", "VaR_nvmix",
       "lambda_gStudent", "corgnvmix", "get_set_qqplot_param",
       "rskewt", "dskewt", "rskewtcopula", "dskewtcopula"
)

### S3 Methods ################################################################

S3method(print, fitnvmix)
S3method(summary, fitnvmix)
S3method(plot, fitnvmix)

S3method(print, fitgStudentcopula)
S3method(summary, fitgStudentcopula)

S3method(plot, qqplot_maha)
S3method(print, qqplot_maha)
S3method(testtext, qqplot_maha)
