# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

mi_gauss_cpp <- function(Mu, sigma) {
    .Call(`_hetGP_mi_gauss_cpp`, Mu, sigma)
}

Wijs_gauss_cpp <- function(Mu1, Mu2, sigma) {
    .Call(`_hetGP_Wijs_gauss_cpp`, Mu1, Mu2, sigma)
}

Wijs_gauss_sym_cpp <- function(Mu, sigma) {
    .Call(`_hetGP_Wijs_gauss_sym_cpp`, Mu, sigma)
}

d_gauss_cpp <- function(X, x, sigma) {
    .Call(`_hetGP_d_gauss_cpp`, X, x, sigma)
}

c2_gauss_cpp <- function(x, t, w) {
    .Call(`_hetGP_c2_gauss_cpp`, x, t, w)
}

c1_gauss_cpp <- function(X, x, sigma, W) {
    .Call(`_hetGP_c1_gauss_cpp`, X, x, sigma, W)
}

mi_mat52_cpp <- function(Mu, sigma) {
    .Call(`_hetGP_mi_mat52_cpp`, Mu, sigma)
}

Wijs_mat52_cpp <- function(Mu1, Mu2, sigma) {
    .Call(`_hetGP_Wijs_mat52_cpp`, Mu1, Mu2, sigma)
}

Wijs_mat52_sym_cpp <- function(Mu, sigma) {
    .Call(`_hetGP_Wijs_mat52_sym_cpp`, Mu, sigma)
}

c2_mat52_cpp <- function(x, t, w) {
    .Call(`_hetGP_c2_mat52_cpp`, x, t, w)
}

c1_mat52_cpp <- function(X, x, sigma, W) {
    .Call(`_hetGP_c1_mat52_cpp`, X, x, sigma, W)
}

d_mat52_cpp <- function(X, x, sigma) {
    .Call(`_hetGP_d_mat52_cpp`, X, x, sigma)
}

mi_mat32_cpp <- function(Mu, sigma) {
    .Call(`_hetGP_mi_mat32_cpp`, Mu, sigma)
}

Wijs_mat32_cpp <- function(Mu1, Mu2, sigma) {
    .Call(`_hetGP_Wijs_mat32_cpp`, Mu1, Mu2, sigma)
}

Wijs_mat32_sym_cpp <- function(Mu, sigma) {
    .Call(`_hetGP_Wijs_mat32_sym_cpp`, Mu, sigma)
}

d_mat32_cpp <- function(X, x, sigma) {
    .Call(`_hetGP_d_mat32_cpp`, X, x, sigma)
}

c2_mat32_cpp <- function(x, t, w) {
    .Call(`_hetGP_c2_mat32_cpp`, x, t, w)
}

c1_mat32_cpp <- function(X, x, sigma, W) {
    .Call(`_hetGP_c1_mat32_cpp`, X, x, sigma, W)
}

matern5_2_1args <- function(X1) {
    .Call(`_hetGP_matern5_2_1args`, X1)
}

d_matern5_2_1args_theta_k_iso <- function(X1, theta) {
    .Call(`_hetGP_d_matern5_2_1args_theta_k_iso`, X1, theta)
}

d_matern5_2_1args_theta_k <- function(X1, theta) {
    .Call(`_hetGP_d_matern5_2_1args_theta_k`, X1, theta)
}

d_matern5_2_1args_kthetag <- function(X1, kt) {
    .Call(`_hetGP_d_matern5_2_1args_kthetag`, X1, kt)
}

matern5_2_2args <- function(X1, X2) {
    .Call(`_hetGP_matern5_2_2args`, X1, X2)
}

d_matern5_2_2args_theta_k_iso <- function(X1, X2, theta) {
    .Call(`_hetGP_d_matern5_2_2args_theta_k_iso`, X1, X2, theta)
}

d_matern5_2_2args_kthetag <- function(X1, X2, kt) {
    .Call(`_hetGP_d_matern5_2_2args_kthetag`, X1, X2, kt)
}

partial_d_dist_abs_dX_i1_i2 <- function(X1, i1, i2) {
    .Call(`_hetGP_partial_d_dist_abs_dX_i1_i2`, X1, i1, i2)
}

partial_d_dist_abs_dX1_i1_i2_X2 <- function(X1, X2, i1, i2) {
    .Call(`_hetGP_partial_d_dist_abs_dX1_i1_i2_X2`, X1, X2, i1, i2)
}

matern3_2_1args <- function(X1) {
    .Call(`_hetGP_matern3_2_1args`, X1)
}

d_matern3_2_1args_theta_k_iso <- function(X1, theta) {
    .Call(`_hetGP_d_matern3_2_1args_theta_k_iso`, X1, theta)
}

d_matern3_2_1args_theta_k <- function(X1, theta) {
    .Call(`_hetGP_d_matern3_2_1args_theta_k`, X1, theta)
}

d_matern3_2_1args_kthetag <- function(X1, kt) {
    .Call(`_hetGP_d_matern3_2_1args_kthetag`, X1, kt)
}

matern3_2_2args <- function(X1, X2) {
    .Call(`_hetGP_matern3_2_2args`, X1, X2)
}

d_matern3_2_2args_theta_k_iso <- function(X1, X2, theta) {
    .Call(`_hetGP_d_matern3_2_2args_theta_k_iso`, X1, X2, theta)
}

d_matern3_2_2args_kthetag <- function(X1, X2, kt) {
    .Call(`_hetGP_d_matern3_2_2args_kthetag`, X1, X2, kt)
}

partial_d_dist_abs_dX_i1_i2_m32 <- function(X1, i1, i2) {
    .Call(`_hetGP_partial_d_dist_abs_dX_i1_i2_m32`, X1, i1, i2)
}

partial_d_dist_abs_dX1_i1_i2_X2_m32 <- function(X1, X2, i1, i2) {
    .Call(`_hetGP_partial_d_dist_abs_dX1_i1_i2_X2_m32`, X1, X2, i1, i2)
}

distance_cpp <- function(X1, X2 = NULL, m = NULL) {
    .Call(`_hetGP_distance_cpp`, X1, X2, m)
}

partial_d_dist_dX_i1_i2 <- function(X1, i1, i2) {
    .Call(`_hetGP_partial_d_dist_dX_i1_i2`, X1, i1, i2)
}

partial_d_dist_dX1_i1_i2_X2 <- function(X1, X2, i1, i2) {
    .Call(`_hetGP_partial_d_dist_dX1_i1_i2_X2`, X1, X2, i1, i2)
}

#' @param i_begin, i_end first index in the matrix to consider
#' @param ptr_mat pointer to matrix with dimensions:
#' @param nobj,nr number of columns and rows
#' @noRd
NULL

#' Non dominated indices of a matrix
#' @param mat matrix of objective values, of size n x nobj
#' @return indices of non-dominated points
#' @details Use Kung non-domination sorting
#' @noRd
#' @references
#' Kung, H. T., Luccio, F., & Preparata, F. P. (1975). On finding the maxima of a set of vectors. Journal of the ACM (JACM), 22(4), 469-476.
#' @examples
#' d <- 6
#' n <- 1000
#' test <- matrix(runif(d * n), n)
#' library(emoa)
#' test <- test[order(test[,1]),]
#' indPF_ref <- which(!is_dominated(t(test)))
#' indPF <- nonDomInd(test)
#' all(indPF == indPF_ref)
#'
#' library(microbenchmark)
#' microbenchmark(is_dominated(t(test)), nonDomInd(test))
nonDomInd_cpp <- function(mat) {
    .Call(`_hetGP_nonDomInd_cpp`, mat)
}

#' Determines which elements in a set are dominated by reference points
#' @title Non-dominated points with respect to a reference
#' @param points matrix (one point per row) that are compared to a reference \code{ref} (i.e., not between themselves)
#' @param ref matrix (one point per row) of reference (faster if they are already Pareto optimal)
#' @noRd
#' @examples
#' \dontrun{
#' d <- 6
#' n <- 1000
#' n2 <- 1000
#'
#' test <- matrix(runif(d * n), n)
#' ref <- matrix(runif(d * n), n)
#' indPF <- nonDom(ref)
#'
#' system.time(res <- nonDomSet(test, ref[indPF,,drop = FALSE]))
#'
#' res2 <- rep(NA, n2)
#' library(emoa)
#' t0 <- Sys.time()
#' for(i in 1:n2){
#'   res2[i] <- !is_dominated(t(rbind(test[i,, drop = FALSE], ref[indPF,])))[1]
#' }
#' print(Sys.time() - t0)
#'
#' all(res == res2)
#' }
nonDomSet <- function(points, ref) {
    .Call(`_hetGP_nonDomSet`, points, ref)
}

fast_diag <- function(A, B) {
    .Call(`_hetGP_fast_diag`, A, B)
}

add_diag <- function(A, B) {
    .Call(`_hetGP_add_diag`, A, B)
}

fast_tUY2 <- function(mult, Y2) {
    .Call(`_hetGP_fast_tUY2`, mult, Y2)
}

fast_trace <- function(A, B) {
    .Call(`_hetGP_fast_trace`, A, B)
}

trace_sym <- function(A, B) {
    .Call(`_hetGP_trace_sym`, A, B)
}

find_corres <- function(X0, X) {
    .Call(`_hetGP_find_corres`, X0, X)
}

v1cpp <- function(mu1, mu2, s1, s2, rho) {
    .Call(`_hetGP_v1cpp`, mu1, mu2, s1, s2, rho)
}

v2cpp <- function(mu1, mu2, s1, s2, rho) {
    .Call(`_hetGP_v2cpp`, mu1, mu2, s1, s2, rho)
}

r_cpp <- function(mu1, mu2, s1, s2, rho, rho1, rho2) {
    .Call(`_hetGP_r_cpp`, mu1, mu2, s1, s2, rho, rho1, rho2)
}

qEI_cpp <- function(mu, s, cor, threshold) {
    .Call(`_hetGP_qEI_cpp`, mu, s, cor, threshold)
}

hyperSharperP <- function(A, l, u) {
    .Call(`_hetGP_hyperSharperP`, A, l, u)
}

