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

#include <RcppArmadillo.h>
#include <Rcpp.h>

using namespace Rcpp;

#ifdef RCPP_USE_GLOBAL_ROSTREAM
Rcpp::Rostream<true>&  Rcpp::Rcout = Rcpp::Rcpp_cout_get();
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
#endif

// RunModularityClusteringCpp
IntegerVector RunModularityClusteringCpp(arma::sp_mat SNN, int modularityFunction, double resolution, int algorithm, int nRandomStarts, int nIterations, int randomSeed, bool printOutput, std::string edgefilename);
RcppExport SEXP _rliger_RunModularityClusteringCpp(SEXP SNNSEXP, SEXP modularityFunctionSEXP, SEXP resolutionSEXP, SEXP algorithmSEXP, SEXP nRandomStartsSEXP, SEXP nIterationsSEXP, SEXP randomSeedSEXP, SEXP printOutputSEXP, SEXP edgefilenameSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::sp_mat >::type SNN(SNNSEXP);
    Rcpp::traits::input_parameter< int >::type modularityFunction(modularityFunctionSEXP);
    Rcpp::traits::input_parameter< double >::type resolution(resolutionSEXP);
    Rcpp::traits::input_parameter< int >::type algorithm(algorithmSEXP);
    Rcpp::traits::input_parameter< int >::type nRandomStarts(nRandomStartsSEXP);
    Rcpp::traits::input_parameter< int >::type nIterations(nIterationsSEXP);
    Rcpp::traits::input_parameter< int >::type randomSeed(randomSeedSEXP);
    Rcpp::traits::input_parameter< bool >::type printOutput(printOutputSEXP);
    Rcpp::traits::input_parameter< std::string >::type edgefilename(edgefilenameSEXP);
    rcpp_result_gen = Rcpp::wrap(RunModularityClusteringCpp(SNN, modularityFunction, resolution, algorithm, nRandomStarts, nIterations, randomSeed, printOutput, edgefilename));
    return rcpp_result_gen;
END_RCPP
}
// moe_correct_ridge_cpp
arma::mat moe_correct_ridge_cpp(const arma::mat& Z_orig, const arma::mat& R, const arma::colvec& lambda, const arma::sp_mat& Phi, const unsigned int B, const unsigned int N);
RcppExport SEXP _rliger_moe_correct_ridge_cpp(SEXP Z_origSEXP, SEXP RSEXP, SEXP lambdaSEXP, SEXP PhiSEXP, SEXP BSEXP, SEXP NSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type Z_orig(Z_origSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type R(RSEXP);
    Rcpp::traits::input_parameter< const arma::colvec& >::type lambda(lambdaSEXP);
    Rcpp::traits::input_parameter< const arma::sp_mat& >::type Phi(PhiSEXP);
    Rcpp::traits::input_parameter< const unsigned int >::type B(BSEXP);
    Rcpp::traits::input_parameter< const unsigned int >::type N(NSEXP);
    rcpp_result_gen = Rcpp::wrap(moe_correct_ridge_cpp(Z_orig, R, lambda, Phi, B, N));
    return rcpp_result_gen;
END_RCPP
}
// normalize_byCol_dense_rcpp
arma::mat normalize_byCol_dense_rcpp(arma::mat x);
RcppExport SEXP _rliger_normalize_byCol_dense_rcpp(SEXP xSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::mat >::type x(xSEXP);
    rcpp_result_gen = Rcpp::wrap(normalize_byCol_dense_rcpp(x));
    return rcpp_result_gen;
END_RCPP
}
// colNormalize_dense_cpp
arma::mat colNormalize_dense_cpp(arma::mat& x, const arma::uword L);
RcppExport SEXP _rliger_colNormalize_dense_cpp(SEXP xSEXP, SEXP LSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::mat& >::type x(xSEXP);
    Rcpp::traits::input_parameter< const arma::uword >::type L(LSEXP);
    rcpp_result_gen = Rcpp::wrap(colNormalize_dense_cpp(x, L));
    return rcpp_result_gen;
END_RCPP
}
// scaleNotCenter_byRow_rcpp
arma::sp_mat scaleNotCenter_byRow_rcpp(arma::sp_mat x);
RcppExport SEXP _rliger_scaleNotCenter_byRow_rcpp(SEXP xSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::sp_mat >::type x(xSEXP);
    rcpp_result_gen = Rcpp::wrap(scaleNotCenter_byRow_rcpp(x));
    return rcpp_result_gen;
END_RCPP
}
// safe_scale
arma::mat safe_scale(arma::mat x, bool center, bool scale);
RcppExport SEXP _rliger_safe_scale(SEXP xSEXP, SEXP centerSEXP, SEXP scaleSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::mat >::type x(xSEXP);
    Rcpp::traits::input_parameter< bool >::type center(centerSEXP);
    Rcpp::traits::input_parameter< bool >::type scale(scaleSEXP);
    rcpp_result_gen = Rcpp::wrap(safe_scale(x, center, scale));
    return rcpp_result_gen;
END_RCPP
}
// scaleNotCenter_byCol_dense_rcpp
arma::mat scaleNotCenter_byCol_dense_rcpp(arma::mat x);
RcppExport SEXP _rliger_scaleNotCenter_byCol_dense_rcpp(SEXP xSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::mat >::type x(xSEXP);
    rcpp_result_gen = Rcpp::wrap(scaleNotCenter_byCol_dense_rcpp(x));
    return rcpp_result_gen;
END_RCPP
}
// scaleNotCenter_byRow_perDataset_rcpp
arma::sp_mat scaleNotCenter_byRow_perDataset_rcpp(arma::sp_mat x, const arma::uvec& ann, const arma::uword& n);
RcppExport SEXP _rliger_scaleNotCenter_byRow_perDataset_rcpp(SEXP xSEXP, SEXP annSEXP, SEXP nSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::sp_mat >::type x(xSEXP);
    Rcpp::traits::input_parameter< const arma::uvec& >::type ann(annSEXP);
    Rcpp::traits::input_parameter< const arma::uword& >::type n(nSEXP);
    rcpp_result_gen = Rcpp::wrap(scaleNotCenter_byRow_perDataset_rcpp(x, ann, n));
    return rcpp_result_gen;
END_RCPP
}
// rowVars_sparse_rcpp
NumericVector rowVars_sparse_rcpp(const arma::sp_mat& x, const NumericVector& means);
RcppExport SEXP _rliger_rowVars_sparse_rcpp(SEXP xSEXP, SEXP meansSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::sp_mat& >::type x(xSEXP);
    Rcpp::traits::input_parameter< const NumericVector& >::type means(meansSEXP);
    rcpp_result_gen = Rcpp::wrap(rowVars_sparse_rcpp(x, means));
    return rcpp_result_gen;
END_RCPP
}
// rowDivide_rcpp
arma::sp_mat rowDivide_rcpp(arma::sp_mat x, const arma::vec& v);
RcppExport SEXP _rliger_rowDivide_rcpp(SEXP xSEXP, SEXP vSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::sp_mat >::type x(xSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type v(vSEXP);
    rcpp_result_gen = Rcpp::wrap(rowDivide_rcpp(x, v));
    return rcpp_result_gen;
END_RCPP
}
// sumSquaredDeviations
NumericVector sumSquaredDeviations(arma::sp_mat x, NumericVector means);
RcppExport SEXP _rliger_sumSquaredDeviations(SEXP xSEXP, SEXP meansSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::sp_mat >::type x(xSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type means(meansSEXP);
    rcpp_result_gen = Rcpp::wrap(sumSquaredDeviations(x, means));
    return rcpp_result_gen;
END_RCPP
}
// denseZScore
NumericMatrix denseZScore(NumericMatrix& x, NumericVector m);
RcppExport SEXP _rliger_denseZScore(SEXP xSEXP, SEXP mSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< NumericMatrix& >::type x(xSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type m(mSEXP);
    rcpp_result_gen = Rcpp::wrap(denseZScore(x, m));
    return rcpp_result_gen;
END_RCPP
}
// rowVarsDense
NumericVector rowVarsDense(arma::mat x, arma::vec m);
RcppExport SEXP _rliger_rowVarsDense(SEXP xSEXP, SEXP mSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::mat >::type x(xSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type m(mSEXP);
    rcpp_result_gen = Rcpp::wrap(rowVarsDense(x, m));
    return rcpp_result_gen;
END_RCPP
}
// SparseRowVarStd
NumericVector SparseRowVarStd(arma::sp_mat x, NumericVector mu, NumericVector sd, double vmax);
RcppExport SEXP _rliger_SparseRowVarStd(SEXP xSEXP, SEXP muSEXP, SEXP sdSEXP, SEXP vmaxSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< arma::sp_mat >::type x(xSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type mu(muSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type sd(sdSEXP);
    Rcpp::traits::input_parameter< double >::type vmax(vmaxSEXP);
    rcpp_result_gen = Rcpp::wrap(SparseRowVarStd(x, mu, sd, vmax));
    return rcpp_result_gen;
END_RCPP
}
// colAggregateSums_sparse
arma::sp_mat colAggregateSums_sparse(const arma::sp_mat& x, const arma::uvec& group, const arma::uword& ngroups);
RcppExport SEXP _rliger_colAggregateSums_sparse(SEXP xSEXP, SEXP groupSEXP, SEXP ngroupsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::sp_mat& >::type x(xSEXP);
    Rcpp::traits::input_parameter< const arma::uvec& >::type group(groupSEXP);
    Rcpp::traits::input_parameter< const arma::uword& >::type ngroups(ngroupsSEXP);
    rcpp_result_gen = Rcpp::wrap(colAggregateSums_sparse(x, group, ngroups));
    return rcpp_result_gen;
END_RCPP
}
// colAggregateMedian_dense_cpp
arma::mat colAggregateMedian_dense_cpp(const arma::mat& x, const arma::uvec& group, const arma::uword n);
RcppExport SEXP _rliger_colAggregateMedian_dense_cpp(SEXP xSEXP, SEXP groupSEXP, SEXP nSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type x(xSEXP);
    Rcpp::traits::input_parameter< const arma::uvec& >::type group(groupSEXP);
    Rcpp::traits::input_parameter< const arma::uword >::type n(nSEXP);
    rcpp_result_gen = Rcpp::wrap(colAggregateMedian_dense_cpp(x, group, n));
    return rcpp_result_gen;
END_RCPP
}
// sample_cpp
Rcpp::NumericVector sample_cpp(const int x, const int size);
RcppExport SEXP _rliger_sample_cpp(SEXP xSEXP, SEXP sizeSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const int >::type x(xSEXP);
    Rcpp::traits::input_parameter< const int >::type size(sizeSEXP);
    rcpp_result_gen = Rcpp::wrap(sample_cpp(x, size));
    return rcpp_result_gen;
END_RCPP
}
// updatePseudoBulkRcpp
void updatePseudoBulkRcpp(Rcpp::NumericMatrix& psdBulk, const arma::sp_mat& sparseRaw, const Rcpp::IntegerVector& featureIdx, const Rcpp::IntegerVector& repIdx);
RcppExport SEXP _rliger_updatePseudoBulkRcpp(SEXP psdBulkSEXP, SEXP sparseRawSEXP, SEXP featureIdxSEXP, SEXP repIdxSEXP) {
BEGIN_RCPP
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Rcpp::NumericMatrix& >::type psdBulk(psdBulkSEXP);
    Rcpp::traits::input_parameter< const arma::sp_mat& >::type sparseRaw(sparseRawSEXP);
    Rcpp::traits::input_parameter< const Rcpp::IntegerVector& >::type featureIdx(featureIdxSEXP);
    Rcpp::traits::input_parameter< const Rcpp::IntegerVector& >::type repIdx(repIdxSEXP);
    updatePseudoBulkRcpp(psdBulk, sparseRaw, featureIdx, repIdx);
    return R_NilValue;
END_RCPP
}
// updateNCellExprRcpp
void updateNCellExprRcpp(Rcpp::NumericMatrix& out, const arma::sp_mat& sparseRaw, const Rcpp::IntegerVector& featureIdx, const Rcpp::IntegerVector& groupVar);
RcppExport SEXP _rliger_updateNCellExprRcpp(SEXP outSEXP, SEXP sparseRawSEXP, SEXP featureIdxSEXP, SEXP groupVarSEXP) {
BEGIN_RCPP
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Rcpp::NumericMatrix& >::type out(outSEXP);
    Rcpp::traits::input_parameter< const arma::sp_mat& >::type sparseRaw(sparseRawSEXP);
    Rcpp::traits::input_parameter< const Rcpp::IntegerVector& >::type featureIdx(featureIdxSEXP);
    Rcpp::traits::input_parameter< const Rcpp::IntegerVector& >::type groupVar(groupVarSEXP);
    updateNCellExprRcpp(out, sparseRaw, featureIdx, groupVar);
    return R_NilValue;
END_RCPP
}
// makeFeatureMatrix
NumericMatrix makeFeatureMatrix(DataFrame& bedmat, StringVector& barcodes);
RcppExport SEXP _rliger_makeFeatureMatrix(SEXP bedmatSEXP, SEXP barcodesSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame& >::type bedmat(bedmatSEXP);
    Rcpp::traits::input_parameter< StringVector& >::type barcodes(barcodesSEXP);
    rcpp_result_gen = Rcpp::wrap(makeFeatureMatrix(bedmat, barcodes));
    return rcpp_result_gen;
END_RCPP
}
// cluster_vote_rcpp
IntegerVector cluster_vote_rcpp(const arma::mat& nn_ranked, IntegerVector clusts);
RcppExport SEXP _rliger_cluster_vote_rcpp(SEXP nn_rankedSEXP, SEXP clustsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type nn_ranked(nn_rankedSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type clusts(clustsSEXP);
    rcpp_result_gen = Rcpp::wrap(cluster_vote_rcpp(nn_ranked, clusts));
    return rcpp_result_gen;
END_RCPP
}
// max_factor_rcpp
IntegerVector max_factor_rcpp(arma::mat H, const arma::uvec& dims_use, bool center);
RcppExport SEXP _rliger_max_factor_rcpp(SEXP HSEXP, SEXP dims_useSEXP, SEXP centerSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::mat >::type H(HSEXP);
    Rcpp::traits::input_parameter< const arma::uvec& >::type dims_use(dims_useSEXP);
    Rcpp::traits::input_parameter< bool >::type center(centerSEXP);
    rcpp_result_gen = Rcpp::wrap(max_factor_rcpp(H, dims_use, center));
    return rcpp_result_gen;
END_RCPP
}
// ComputeSNN
arma::sp_mat ComputeSNN(arma::umat& nn_idx, double prune);
RcppExport SEXP _rliger_ComputeSNN(SEXP nn_idxSEXP, SEXP pruneSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::umat& >::type nn_idx(nn_idxSEXP);
    Rcpp::traits::input_parameter< double >::type prune(pruneSEXP);
    rcpp_result_gen = Rcpp::wrap(ComputeSNN(nn_idx, prune));
    return rcpp_result_gen;
END_RCPP
}
// WriteEdgeFile
void WriteEdgeFile(arma::sp_mat snn, String filename, bool display_progress);
RcppExport SEXP _rliger_WriteEdgeFile(SEXP snnSEXP, SEXP filenameSEXP, SEXP display_progressSEXP) {
BEGIN_RCPP
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::sp_mat >::type snn(snnSEXP);
    Rcpp::traits::input_parameter< String >::type filename(filenameSEXP);
    Rcpp::traits::input_parameter< bool >::type display_progress(display_progressSEXP);
    WriteEdgeFile(snn, filename, display_progress);
    return R_NilValue;
END_RCPP
}
// DirectSNNToFile
arma::sp_mat DirectSNNToFile(arma::umat& nn_ranked, double prune, bool display_progress, String filename);
RcppExport SEXP _rliger_DirectSNNToFile(SEXP nn_rankedSEXP, SEXP pruneSEXP, SEXP display_progressSEXP, SEXP filenameSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::umat& >::type nn_ranked(nn_rankedSEXP);
    Rcpp::traits::input_parameter< double >::type prune(pruneSEXP);
    Rcpp::traits::input_parameter< bool >::type display_progress(display_progressSEXP);
    Rcpp::traits::input_parameter< String >::type filename(filenameSEXP);
    rcpp_result_gen = Rcpp::wrap(DirectSNNToFile(nn_ranked, prune, display_progress, filename));
    return rcpp_result_gen;
END_RCPP
}
// cpp_rank_matrix_dgc
std::vector<std::list<float> > cpp_rank_matrix_dgc(arma::vec& x, const arma::vec& p, int nrow, int ncol);
RcppExport SEXP _rliger_cpp_rank_matrix_dgc(SEXP xSEXP, SEXP pSEXP, SEXP nrowSEXP, SEXP ncolSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::vec& >::type x(xSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type p(pSEXP);
    Rcpp::traits::input_parameter< int >::type nrow(nrowSEXP);
    Rcpp::traits::input_parameter< int >::type ncol(ncolSEXP);
    rcpp_result_gen = Rcpp::wrap(cpp_rank_matrix_dgc(x, p, nrow, ncol));
    return rcpp_result_gen;
END_RCPP
}
// rowAggregateSum_sparse
arma::mat rowAggregateSum_sparse(arma::sp_mat& X, const arma::uvec& groups, unsigned ngroups);
RcppExport SEXP _rliger_rowAggregateSum_sparse(SEXP XSEXP, SEXP groupsSEXP, SEXP ngroupsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::sp_mat& >::type X(XSEXP);
    Rcpp::traits::input_parameter< const arma::uvec& >::type groups(groupsSEXP);
    Rcpp::traits::input_parameter< unsigned >::type ngroups(ngroupsSEXP);
    rcpp_result_gen = Rcpp::wrap(rowAggregateSum_sparse(X, groups, ngroups));
    return rcpp_result_gen;
END_RCPP
}
// colAggregateSum_sparse
arma::mat colAggregateSum_sparse(arma::sp_mat& X, const arma::uvec& groups, unsigned ngroups);
RcppExport SEXP _rliger_colAggregateSum_sparse(SEXP XSEXP, SEXP groupsSEXP, SEXP ngroupsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::sp_mat& >::type X(XSEXP);
    Rcpp::traits::input_parameter< const arma::uvec& >::type groups(groupsSEXP);
    Rcpp::traits::input_parameter< unsigned >::type ngroups(ngroupsSEXP);
    rcpp_result_gen = Rcpp::wrap(colAggregateSum_sparse(X, groups, ngroups));
    return rcpp_result_gen;
END_RCPP
}
// colNNZAggr_sparse
arma::mat colNNZAggr_sparse(arma::sp_mat& X, const arma::uvec& groups, unsigned ngroups);
RcppExport SEXP _rliger_colNNZAggr_sparse(SEXP XSEXP, SEXP groupsSEXP, SEXP ngroupsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::sp_mat& >::type X(XSEXP);
    Rcpp::traits::input_parameter< const arma::uvec& >::type groups(groupsSEXP);
    Rcpp::traits::input_parameter< unsigned >::type ngroups(ngroupsSEXP);
    rcpp_result_gen = Rcpp::wrap(colNNZAggr_sparse(X, groups, ngroups));
    return rcpp_result_gen;
END_RCPP
}
// rowNNZAggr_sparse
arma::mat rowNNZAggr_sparse(arma::sp_mat& X, const arma::uvec& groups, unsigned ngroups);
RcppExport SEXP _rliger_rowNNZAggr_sparse(SEXP XSEXP, SEXP groupsSEXP, SEXP ngroupsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::sp_mat& >::type X(XSEXP);
    Rcpp::traits::input_parameter< const arma::uvec& >::type groups(groupsSEXP);
    Rcpp::traits::input_parameter< unsigned >::type ngroups(ngroupsSEXP);
    rcpp_result_gen = Rcpp::wrap(rowNNZAggr_sparse(X, groups, ngroups));
    return rcpp_result_gen;
END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
    {"_rliger_RunModularityClusteringCpp", (DL_FUNC) &_rliger_RunModularityClusteringCpp, 9},
    {"_rliger_moe_correct_ridge_cpp", (DL_FUNC) &_rliger_moe_correct_ridge_cpp, 6},
    {"_rliger_normalize_byCol_dense_rcpp", (DL_FUNC) &_rliger_normalize_byCol_dense_rcpp, 1},
    {"_rliger_colNormalize_dense_cpp", (DL_FUNC) &_rliger_colNormalize_dense_cpp, 2},
    {"_rliger_scaleNotCenter_byRow_rcpp", (DL_FUNC) &_rliger_scaleNotCenter_byRow_rcpp, 1},
    {"_rliger_safe_scale", (DL_FUNC) &_rliger_safe_scale, 3},
    {"_rliger_scaleNotCenter_byCol_dense_rcpp", (DL_FUNC) &_rliger_scaleNotCenter_byCol_dense_rcpp, 1},
    {"_rliger_scaleNotCenter_byRow_perDataset_rcpp", (DL_FUNC) &_rliger_scaleNotCenter_byRow_perDataset_rcpp, 3},
    {"_rliger_rowVars_sparse_rcpp", (DL_FUNC) &_rliger_rowVars_sparse_rcpp, 2},
    {"_rliger_rowDivide_rcpp", (DL_FUNC) &_rliger_rowDivide_rcpp, 2},
    {"_rliger_sumSquaredDeviations", (DL_FUNC) &_rliger_sumSquaredDeviations, 2},
    {"_rliger_denseZScore", (DL_FUNC) &_rliger_denseZScore, 2},
    {"_rliger_rowVarsDense", (DL_FUNC) &_rliger_rowVarsDense, 2},
    {"_rliger_SparseRowVarStd", (DL_FUNC) &_rliger_SparseRowVarStd, 4},
    {"_rliger_colAggregateSums_sparse", (DL_FUNC) &_rliger_colAggregateSums_sparse, 3},
    {"_rliger_colAggregateMedian_dense_cpp", (DL_FUNC) &_rliger_colAggregateMedian_dense_cpp, 3},
    {"_rliger_sample_cpp", (DL_FUNC) &_rliger_sample_cpp, 2},
    {"_rliger_updatePseudoBulkRcpp", (DL_FUNC) &_rliger_updatePseudoBulkRcpp, 4},
    {"_rliger_updateNCellExprRcpp", (DL_FUNC) &_rliger_updateNCellExprRcpp, 4},
    {"_rliger_makeFeatureMatrix", (DL_FUNC) &_rliger_makeFeatureMatrix, 2},
    {"_rliger_cluster_vote_rcpp", (DL_FUNC) &_rliger_cluster_vote_rcpp, 2},
    {"_rliger_max_factor_rcpp", (DL_FUNC) &_rliger_max_factor_rcpp, 3},
    {"_rliger_ComputeSNN", (DL_FUNC) &_rliger_ComputeSNN, 2},
    {"_rliger_WriteEdgeFile", (DL_FUNC) &_rliger_WriteEdgeFile, 3},
    {"_rliger_DirectSNNToFile", (DL_FUNC) &_rliger_DirectSNNToFile, 4},
    {"_rliger_cpp_rank_matrix_dgc", (DL_FUNC) &_rliger_cpp_rank_matrix_dgc, 4},
    {"_rliger_rowAggregateSum_sparse", (DL_FUNC) &_rliger_rowAggregateSum_sparse, 3},
    {"_rliger_colAggregateSum_sparse", (DL_FUNC) &_rliger_colAggregateSum_sparse, 3},
    {"_rliger_colNNZAggr_sparse", (DL_FUNC) &_rliger_colNNZAggr_sparse, 3},
    {"_rliger_rowNNZAggr_sparse", (DL_FUNC) &_rliger_rowNNZAggr_sparse, 3},
    {NULL, NULL, 0}
};

RcppExport void R_init_rliger(DllInfo *dll) {
    R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
    R_useDynamicSymbols(dll, FALSE);
}
