eenticott / gamstackr

Tools for stacking probabilistic densities.
GNU General Public License v3.0
0 stars 0 forks source link

Properly export functions to be used by family() #10

Closed mfasiolo closed 5 months ago

mfasiolo commented 1 year ago

All the functions used within the family (i.e., within the loglikelihood, Jacobian etc) need to be properly exported. Otherwise, to avoid polluting the namespace, one can define a "master" internal function as done in the SCM package:

#' A pool of internal functions used by the family (please do not modify this function)
#'
#' @description Such function masks some functions used internally
#'
#' @return a list of building functions
#' @export
internal <- function(){
  return(list(# Common functions (between mcd and logm):
              "gamlss.gH_scm" = gamlss.gH_scm,
              "mat2vec" = mat2vec,
              "pred_logm" = pred_logm,
              "jacobian_logm" = jacobian_logm,
              "logM_Sigma" = logM_Sigma))
}

So here only internal() is exported. Then in the family, one would call internal$mat2vec(some_arguments).

eenticott commented 5 months ago

Implemented this