R/RcppExports.R

Defines functions sfpca_cd_solve_cpp gmd_deflation_cpp_sp gmd_deflation_cpp gmd_randomized_cpp_qdn_rsp gmd_randomized_cpp_qsp_rdn gmd_randomized_cpp_sp gmd_randomized_cpp_dn

Documented in sfpca_cd_solve_cpp

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

gmd_randomized_cpp_dn <- function(X, Q, R, k, oversample = 20L, n_power = 1L, n_polish = 0L, jitter = 1e-10, tol = 1e-9, polish_tol = 0.0, seed = 1234L) {
    .Call(`_genpca_gmd_randomized_cpp_dn`, X, Q, R, k, oversample, n_power, n_polish, jitter, tol, polish_tol, seed)
}

gmd_randomized_cpp_sp <- function(X, Q, R, k, oversample = 20L, n_power = 1L, n_polish = 0L, jitter = 1e-10, tol = 1e-9, polish_tol = 0.0, seed = 1234L) {
    .Call(`_genpca_gmd_randomized_cpp_sp`, X, Q, R, k, oversample, n_power, n_polish, jitter, tol, polish_tol, seed)
}

gmd_randomized_cpp_qsp_rdn <- function(X, Q, R, k, oversample = 20L, n_power = 1L, n_polish = 0L, jitter = 1e-10, tol = 1e-9, polish_tol = 0.0, seed = 1234L) {
    .Call(`_genpca_gmd_randomized_cpp_qsp_rdn`, X, Q, R, k, oversample, n_power, n_polish, jitter, tol, polish_tol, seed)
}

gmd_randomized_cpp_qdn_rsp <- function(X, Q, R, k, oversample = 20L, n_power = 1L, n_polish = 0L, jitter = 1e-10, tol = 1e-9, polish_tol = 0.0, seed = 1234L) {
    .Call(`_genpca_gmd_randomized_cpp_qdn_rsp`, X, Q, R, k, oversample, n_power, n_polish, jitter, tol, polish_tol, seed)
}

gmd_deflation_cpp <- function(X, Q, R, k, thr = 1e-7, maxit = 500L, verbose = FALSE, rank_rtol = 1e-6) {
    .Call(`_genpca_gmd_deflation_cpp`, X, Q, R, k, thr, maxit, verbose, rank_rtol)
}

gmd_deflation_cpp_sp <- function(X, Q, R, k, thr = 1e-7, maxit = 500L, verbose = FALSE, rank_rtol = 1e-6) {
    .Call(`_genpca_gmd_deflation_cpp_sp`, X, Q, R, k, thr, maxit, verbose, rank_rtol)
}

#' Coordinate descent for the SFPCA penalized quadratic subproblem
#'
#' Internal solver for `min_x 0.5 x'Sx - b'x + P(x; lambda)` with sparse SPD
#' `S` and an L1 or SCAD penalty.
#'
#' @param S sparse SPD matrix (`dgCMatrix`)
#' @param b numeric vector, linear term
#' @param x0 numeric vector, warm start
#' @param lambda penalty level (must be >= 0)
#' @param penalty 0 for L1, 1 for SCAD
#' @param scad_a SCAD shape parameter (> 2)
#' @param max_sweeps maximum number of full-equivalent sweeps
#' @param tol convergence tolerance on the KKT residual (gradient units)
#' @return list with `x`, `sweeps`, and `kkt` (max KKT residual)
#' @keywords internal
sfpca_cd_solve_cpp <- function(S, b, x0, lambda, penalty, scad_a, max_sweeps, tol) {
    .Call(`_genpca_sfpca_cd_solve_cpp`, S, b, x0, lambda, penalty, scad_a, max_sweeps, tol)
}

Try the genpca package in your browser

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

genpca documentation built on Sept. 17, 2026, 1:09 a.m.