useDynLib(Rmpfr, .registration=TRUE)

##-- From 'gmp' (on which we 'Depend' ------------------------------------------

## cheap, somewhat experimental -- hence the "."
export(.mpfr2bigz, .bigz2mpfr, .bigq2mpfr)

importFrom("utils", str)
importFrom("stats", stats__pnorm = pnorm)# import *and* rename !
importFrom("gmp"
           , crossprod, tcrossprod# `%*%`, <- as we write (S4) methods for those
           ## not yet (maybe never) , biginteger_as, biginteger_as_character
	   ## more to come
           , is.whole, formatN # because we add own S3 methods
	   )
##------------------------------------------------------------------------------

exportClasses("mpfr1", "mpfr"
              , "mpfrArray"
              , "mpfrMatrix"

              , "atomicVector"
              , "array_or_vector"
              , "Mnumber"

              ## new, *not* containing "matrix" (which has -> "character"!):
              , "numericVector"
              , "mNumber"
)

export(
       ## ".Arith.codes"
       ## , ".Arith.mpfr.num"
       ## , ".Arith.num.mpfr"
       ## , ".Compare.codes"
       ## , ".Compare.codesRev"
       ## , ".Compare.mpfr.num"
       ## , ".Compare.num.mpfr"
       ## , ".Math.codes"
       ## , ".Math.gen"
       ## , ".Summary.codes"
       ## , ".abs.mpfr"
       ## , ".dimCheck"
       ## , ".getPrec"
       ".getSign"
       ## , ".mA.subAssign"
       ## , ".matmult.R"
       ## , ".mpfr.debug"
       ## , ".mpfr.negative"
       ## , ".mpfr.negative.R"
       ## , ".mpfr.repl"
       ## , ".mpfr.sign"
       ## , ".mpfr.subset"
       , ".mpfr2str"
       ## , ".mpfrA.subset"
       ## , ".mpfrVersion"
       ## , ".packageName"
       ## , ".print.mpfr"
       ## , ".requireCachedGenerics"
       , "Ai"
       , "Bernoulli"
       , "Const"
       , "Ei"
       , "Li2"
       , "all.equal"
       , "aperm"
       , "apply" ## <- we make it S4 generic
       , "as.vector"
       , "atan2"
       , "beta" , "lbeta"
       ## S3 "c.mpfr"
       , "cbind"
       , "chooseMpfr", "chooseMpfr.all", "sumBinomMpfr"
       , "crossprod"
       , "erf" , "erfc"
       , "factorial"
       , "factorialMpfr"
       , "format"
       , "formatMpfr"
       , "getD"
       , "getPrec"
       , "hypot"
       , "integrateR"
       , "j0" , "j1" , "jn"
       , "mean"
       , "mpfr"
       , "mpfr.is.0"
       , "mpfr.is.integer"
       , "mpfr2array"
       , "mpfrArray"
       , "mpfrVersion"
       , "mpfr_default_prec"
       , "optimizeR"
       , "hjkMpfr" ## <-- FIXME, rather part of an  optimR(...., method = "hjk")
       , "pmax", "pmin"
       , "pnorm"
       , "pochMpfr"
       , "print.integrate"
       , "rbind"
       , "roundMpfr"
       , "seqMpfr"
       , "t"
       , "tcrossprod"
       , "toNum"
       , "unique"
       , "unirootR"
       , "y0", "y1", "yn"
       , "zeta"
       )


exportMethods(
              ## "own generics":
              "apply",

              ## "other generics"
              "abs", "log", "sign"
              , "all.equal", "aperm"
              , "as.vector", "as.integer", "as.numeric"
              , "coerce", "coerce<-"
              , "cbind", "rbind"
              , "dim", "dim<-", "dimnames", "dimnames<-"
              , "atan2", "beta", "lbeta"
              , "factorial"
              , "is.finite", "is.infinite", "is.na", "is.nan"
              , "%*%", "crossprod", "tcrossprod", "t"
              , "format"
              , "mean", "pmax", "pmin"
              , "show", "unique"
              , "colSums", "colMeans"
              , "rowSums", "rowMeans"
)


S3method(c, mpfr)

S3method(as.array, mpfr)
S3method(as.matrix, mpfr)

S3method(diff, mpfr)
S3method(str,  mpfr)

S3method(is.whole, mpfr)
S3method(formatN, mpfr)

S3method(print, mpfr)
S3method(print, mpfr1)
S3method(print, mpfrArray)
