R/RcppExports.R

Defines functions subsample_mmd_fn mmd_fn init_alpha_j centre_x reorder_cube_slices reorder_cube_cols reorder_cube_rows reorder_matrix_cols reorder_matrix_rows reorder_vector print_ivector print_matrix print_vector set_seed_cpp fit_sampleqc_robust_cpp fit_sampleqc_mle_cpp

Documented in fit_sampleqc_mle_cpp fit_sampleqc_robust_cpp mmd_fn subsample_mmd_fn

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

#' @title Fits a multivariate Gaussian mixture model to given data via MLE
#' 
#' @keywords internal
fit_sampleqc_mle_cpp <- function(x, init_gamma_i, groups, D, J, K, N, n_iter, seed) {
    .Call(`_SampleQC_fit_sampleqc_mle_cpp`, x, init_gamma_i, groups, D, J, K, N, n_iter, seed)
}

#' @title Robustly fits a multivariate Gaussian mixture model to given data
#' 
#' @keywords internal
fit_sampleqc_robust_cpp <- function(x, init_z, groups, D, J, K, N, em_iters, mcd_alpha, mcd_iters, seed, track = FALSE) {
    .Call(`_SampleQC_fit_sampleqc_robust_cpp`, x, init_z, groups, D, J, K, N, em_iters, mcd_alpha, mcd_iters, seed, track)
}

set_seed_cpp <- function(seed) {
    invisible(.Call(`_SampleQC_set_seed_cpp`, seed))
}

print_vector <- function(vec, vec_name) {
    invisible(.Call(`_SampleQC_print_vector`, vec, vec_name))
}

print_matrix <- function(m, m_name, n_to_print = 0L) {
    invisible(.Call(`_SampleQC_print_matrix`, m, m_name, n_to_print))
}

print_ivector <- function(vec, vec_name) {
    invisible(.Call(`_SampleQC_print_ivector`, vec, vec_name))
}

reorder_vector <- function(x, idx) {
    .Call(`_SampleQC_reorder_vector`, x, idx)
}

reorder_matrix_rows <- function(x, idx) {
    .Call(`_SampleQC_reorder_matrix_rows`, x, idx)
}

reorder_matrix_cols <- function(x, idx) {
    .Call(`_SampleQC_reorder_matrix_cols`, x, idx)
}

reorder_cube_rows <- function(x, idx) {
    .Call(`_SampleQC_reorder_cube_rows`, x, idx)
}

reorder_cube_cols <- function(x, idx) {
    .Call(`_SampleQC_reorder_cube_cols`, x, idx)
}

reorder_cube_slices <- function(x, idx) {
    .Call(`_SampleQC_reorder_cube_slices`, x, idx)
}

centre_x <- function(x, mu_0, D, N) {
    .Call(`_SampleQC_centre_x`, x, mu_0, D, N)
}

init_alpha_j <- function(x, groups, D, J, N) {
    .Call(`_SampleQC_init_alpha_j`, x, groups, D, J, N)
}

#' Calculate MMD between two matrices
#' “A Kernel Two-Sample Test.” Journal of Machine Learning Research: JMLR 13 (Mar): 723–73.
#' Gretton, Arthur, Karsten M. Borgwardt, Malte J. Rasch, Bernhard Schölkopf, and Alexander Smola. 2012. 
#' 
#' @param X A matrix of observations (rows = observations)
#' @param Y A matrix of observations (rows = observations)
#' @param sigma Scale factor for Gaussian kernel)
mmd_fn <- function(X, Y, sigma) {
    .Call(`_SampleQC_mmd_fn`, X, Y, sigma)
}

#' Subsample matrices
#' 
#' @param m A matrix of observations (rows = observations)
#' @param subsample How many to subsample from each matrix?
#' @param N Number of matrix rows
NULL

#' Calculate MMD between two matrices
#' “A Kernel Two-Sample Test.” Journal of Machine Learning Research: JMLR 13 (Mar): 723–73.
#' Gretton, Arthur, Karsten M. Borgwardt, Malte J. Rasch, Bernhard Schölkopf, and Alexander Smola. 2012. 
#' 
#' @param X A matrix of observations (rows = observations)
#' @param Y A matrix of observations (rows = observations)
#' @param sigma Scale factor for Gaussian kernel)
NULL

#' Calculate mean subsampled MMD between two matrices
#' 
#' @param X A matrix of observations (rows = observations)
#' @param Y A matrix of observations (rows = observations)
#' @param subsample How many to subsample from each matrix?
#' @param n_times Mean over how many subsamples?
#' @param sigma Scale factor for Gaussian kernel
subsample_mmd_fn <- function(X, Y, subsample, n_times, sigma) {
    .Call(`_SampleQC_subsample_mmd_fn`, X, Y, subsample, n_times, sigma)
}
wmacnair/SampleQC documentation built on Nov. 18, 2022, 5 p.m.