R/RcppExports.R

Defines functions directed_node_positions_with_ground_response_added directed_node_positions lws_lsq_positions triIndices center_data_c fun_skip_sphere_norm fun_sphere_norm ref_window_lag ref_window_df rows_to_co_occurrences svector_to_ut vector_to_ut merge_columns_c ena_correlation combn_c2

Documented in combn_c2 directed_node_positions directed_node_positions_with_ground_response_added ena_correlation fun_skip_sphere_norm fun_sphere_norm merge_columns_c vector_to_ut

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

#' Fast combn choose 2
#'
#' @param n TBD
#' @description faster combn alternative
#'
#' @export
combn_c2 <- function(n) {
    .Call(`_rENA_combn_c2`, n)
}

#' Calculate the correlations
#'
#' @param points TBD
#' @param centroids TBD
#' @param conf_level TBD
#' @description Calculate both Pearson correlations for the
#' provided points and centorids
#' @export
ena_correlation <- function(points, centroids, conf_level = 0.95) {
    .Call(`_rENA_ena_correlation`, points, centroids, conf_level)
}

#' Merge data frame columns
#' @title Merge data frame columns
#' @description TBD
#' @param df Dataframe
#' @param cols Vector
#' @param sep Character seperator
#' @export
merge_columns_c <- function(df, cols, sep = "::") {
    .Call(`_rENA_merge_columns_c`, df, cols, sep)
}

#' Upper Triangle from Vector
#'
#' @title vector to upper triangle
#' @description TBD
#' @param v [TBD]
#' @export
vector_to_ut <- function(v) {
    .Call(`_rENA_vector_to_ut`, v)
}

svector_to_ut <- function(v) {
    .Call(`_rENA_svector_to_ut`, v)
}

rows_to_co_occurrences <- function(df, binary = TRUE) {
    .Call(`_rENA_rows_to_co_occurrences`, df, binary)
}

ref_window_df <- function(df, windowSize = 1, windowForward = 0, binary = TRUE) {
    .Call(`_rENA_ref_window_df`, df, windowSize, windowForward, binary)
}

ref_window_lag <- function(df, windowSize = 0L, binary = TRUE) {
    .Call(`_rENA_ref_window_lag`, df, windowSize, binary)
}

#' Row-wise L2 (Sphere) Normalization
#'
#' @title Row-wise L2 (Sphere) Normalization
#' @description Normalizes each row of a numeric dataframe or matrix to have unit L2 norm (Euclidean length). Each row is divided by its own length, projecting all rows onto the unit hypersphere. Useful for analyses where direction is important but magnitude should be removed.
#' @param dfM A data.frame or matrix. Each row is treated as a vector to compute its L2 norm.
#' @return A numeric matrix with the same dimensions as `dfM`, with each row normalized to unit length (L2 norm = 1), unless the row is all zeros (in which case it remains zeros).
#' @details This function computes the L2 norm (Euclidean length) of each row and divides the row by this value. Rows with zero length are left unchanged.
#' @examples
#' df <- data.frame(a = c(3, 4), b = c(0, 0))
#' fun_sphere_norm(df)
#' @export
fun_sphere_norm <- function(dfM) {
    .Call(`_rENA_fun_sphere_norm`, dfM)
}

#' Row-wise Max-Norm Scaling
#'
#' @title Row-wise Max-Norm Scaling
#' @description Scales all rows of a numeric dataframe by dividing by the largest row vector length (L2 norm) found in the dataframe. This preserves the relative magnitudes between rows but does not normalize each row to unit length. Useful for analyses where relative scale is important but full normalization is not desired.
#' @param dfM A data.frame or matrix. Each row is treated as a vector to compute its L2 norm.
#' @return A numeric matrix with the same dimensions as `dfM`, with all values divided by the largest row L2 norm.
#' @details This function finds the row with the largest L2 norm (Euclidean length) and divides all entries in the matrix by this value. It does not normalize each row individually.
#' @examples
#' df <- data.frame(a = c(3, 4), b = c(0, 0))
#' fun_skip_sphere_norm(df)
#' @export
fun_skip_sphere_norm <- function(dfM) {
    .Call(`_rENA_fun_skip_sphere_norm`, dfM)
}

center_data_c <- function(values) {
    .Call(`_rENA_center_data_c`, values)
}

triIndices <- function(len, row = -1L) {
    .Call(`_rENA_triIndices`, len, row)
}

lws_lsq_positions <- function(adjMats, t, numDims) {
    .Call(`_rENA_lws_lsq_positions`, adjMats, t, numDims)
}

#' Multiobjective, Component by Component, with Ellipsoidal Scaling, for directed ENA
#'
#' @title Multiobjective, Component by Component, with Ellipsoidal Scaling, for directed ENA
#' @description TBD
#' @param line_weights TBD
#' @param points TBD
#' @param numDims TBD
#' @export
directed_node_positions <- function(line_weights, points, numDims) {
    .Call(`_rENA_directed_node_positions`, line_weights, points, numDims)
}

#' Node position optimization with ground and response weights/points added
#'
#' @title Node position optimization with ground and response weights/points added
#' @description TBD
#' @param line_weights TBD
#' @param points TBD
#' @param numDims TBD
#' @export
directed_node_positions_with_ground_response_added <- function(line_weights, points, numDims) {
    .Call(`_rENA_directed_node_positions_with_ground_response_added`, line_weights, points, numDims)
}

# Register entry points for exported C++ functions
methods::setLoadAction(function(ns) {
    .Call(`_rENA_RcppExport_registerCCallable`)
})

Try the rENA package in your browser

Any scripts or data that you put into this service are public.

rENA documentation built on Nov. 5, 2025, 5:50 p.m.