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

#' Generate Multiple IAAFT Surrogates (Univariate)
#' @param x A numeric vector.
#' @param n_surr Number of surrogates to generate.
#' @param max_iter Maximum iterations for IAAFT.
#' @return A matrix of surrogates (N x n_surr).
#' @export
surrogate_iaaft_cpp <- function(x, n_surr, max_iter = 100L) {
    .Call(`_xiacf_surrogate_iaaft_cpp`, x, n_surr, max_iter)
}

#' Generate Multiple MIAAFT Surrogates (3D Array / Cube)
#' @param X A numeric matrix (N x p).
#' @param n_surr Number of surrogates to generate.
#' @param max_iter Maximum iterations for MIAAFT.
#' @return A 3D array (arma::cube) of dimensions N x p x n_surr.
#' @export
surrogate_miaaft_cpp <- function(X, n_surr, max_iter = 100L) {
    .Call(`_xiacf_surrogate_miaaft_cpp`, X, n_surr, max_iter)
}

#' Compute empirical Xi-ACF and Max-Statistic null distribution
#' @export
#' @keywords internal
compute_xi_acf_maxstat_cpp <- function(x, max_lag, n_surr, max_iter = 100L) {
    .Call(`_xiacf_compute_xi_acf_maxstat_cpp`, x, max_lag, n_surr, max_iter)
}

#' Compute empirical Xi-CCF and Max-Statistic null distribution
#' @export
#' @keywords internal
compute_xi_ccf_maxstat_cpp <- function(x, y, max_lag, n_surr, max_iter = 100L, both_directions = TRUE) {
    .Call(`_xiacf_compute_xi_ccf_maxstat_cpp`, x, y, max_lag, n_surr, max_iter, both_directions)
}

#' Compute empirical Xi-Matrix and Max-Statistic null distribution
#' @export
#' @keywords internal
compute_xi_matrix_maxstat_cpp <- function(X, max_lag, n_surr, max_iter = 100L) {
    .Call(`_xiacf_compute_xi_matrix_maxstat_cpp`, X, max_lag, n_surr, max_iter)
}

#' Shuffle indices using R's random number generator
#' @noRd
NULL

#' Calculate ranks with random tie-breaking
#' @noRd
NULL

#' Compute Chatterjee's Xi Coefficient (Internal)
#' @noRd
NULL

#' Compute Chatterjee's Xi coefficient (Exported to R)
#' @param x A numeric vector.
#' @param y A numeric vector.
#' @return The Xi coefficient.
#' @export
xi_coefficient <- function(x, y) {
    .Call(`_xiacf_xi_coefficient_export`, x, y)
}

