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

#include <Rcpp.h>

using namespace Rcpp;

// r_wrapper_poismf
void r_wrapper_poismf(Rcpp::NumericVector A, Rcpp::NumericVector B, size_t dimA, size_t dimB, size_t k, Rcpp::NumericVector Xr, Rcpp::IntegerVector Xr_ind_int, Rcpp::IntegerVector Xr_indptr_int, Rcpp::NumericVector Xc, Rcpp::IntegerVector Xc_ind_int, Rcpp::IntegerVector Xc_indptr_int, size_t nnz, double l1_reg, double l2_reg, size_t niter, size_t npass, double step_size, int use_cg, int nthreads);
RcppExport SEXP _poismf_r_wrapper_poismf(SEXP ASEXP, SEXP BSEXP, SEXP dimASEXP, SEXP dimBSEXP, SEXP kSEXP, SEXP XrSEXP, SEXP Xr_ind_intSEXP, SEXP Xr_indptr_intSEXP, SEXP XcSEXP, SEXP Xc_ind_intSEXP, SEXP Xc_indptr_intSEXP, SEXP nnzSEXP, SEXP l1_regSEXP, SEXP l2_regSEXP, SEXP niterSEXP, SEXP npassSEXP, SEXP step_sizeSEXP, SEXP use_cgSEXP, SEXP nthreadsSEXP) {
BEGIN_RCPP
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type A(ASEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type B(BSEXP);
    Rcpp::traits::input_parameter< size_t >::type dimA(dimASEXP);
    Rcpp::traits::input_parameter< size_t >::type dimB(dimBSEXP);
    Rcpp::traits::input_parameter< size_t >::type k(kSEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type Xr(XrSEXP);
    Rcpp::traits::input_parameter< Rcpp::IntegerVector >::type Xr_ind_int(Xr_ind_intSEXP);
    Rcpp::traits::input_parameter< Rcpp::IntegerVector >::type Xr_indptr_int(Xr_indptr_intSEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type Xc(XcSEXP);
    Rcpp::traits::input_parameter< Rcpp::IntegerVector >::type Xc_ind_int(Xc_ind_intSEXP);
    Rcpp::traits::input_parameter< Rcpp::IntegerVector >::type Xc_indptr_int(Xc_indptr_intSEXP);
    Rcpp::traits::input_parameter< size_t >::type nnz(nnzSEXP);
    Rcpp::traits::input_parameter< double >::type l1_reg(l1_regSEXP);
    Rcpp::traits::input_parameter< double >::type l2_reg(l2_regSEXP);
    Rcpp::traits::input_parameter< size_t >::type niter(niterSEXP);
    Rcpp::traits::input_parameter< size_t >::type npass(npassSEXP);
    Rcpp::traits::input_parameter< double >::type step_size(step_sizeSEXP);
    Rcpp::traits::input_parameter< int >::type use_cg(use_cgSEXP);
    Rcpp::traits::input_parameter< int >::type nthreads(nthreadsSEXP);
    r_wrapper_poismf(A, B, dimA, dimB, k, Xr, Xr_ind_int, Xr_indptr_int, Xc, Xc_ind_int, Xc_indptr_int, nnz, l1_reg, l2_reg, niter, npass, step_size, use_cg, nthreads);
    return R_NilValue;
END_RCPP
}
// predict_multiple
void predict_multiple(Rcpp::NumericVector A, Rcpp::NumericVector B, int k, size_t npred, Rcpp::IntegerVector ia, Rcpp::IntegerVector ib, Rcpp::NumericVector out, int nthreads);
RcppExport SEXP _poismf_predict_multiple(SEXP ASEXP, SEXP BSEXP, SEXP kSEXP, SEXP npredSEXP, SEXP iaSEXP, SEXP ibSEXP, SEXP outSEXP, SEXP nthreadsSEXP) {
BEGIN_RCPP
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type A(ASEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type B(BSEXP);
    Rcpp::traits::input_parameter< int >::type k(kSEXP);
    Rcpp::traits::input_parameter< size_t >::type npred(npredSEXP);
    Rcpp::traits::input_parameter< Rcpp::IntegerVector >::type ia(iaSEXP);
    Rcpp::traits::input_parameter< Rcpp::IntegerVector >::type ib(ibSEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type out(outSEXP);
    Rcpp::traits::input_parameter< int >::type nthreads(nthreadsSEXP);
    predict_multiple(A, B, k, npred, ia, ib, out, nthreads);
    return R_NilValue;
END_RCPP
}
// calc_fun_single_R
double calc_fun_single_R(Rcpp::NumericVector x_R, Rcpp::NumericVector X_R, Rcpp::IntegerVector X_ind, int nnz_this, Rcpp::NumericVector F_R, Rcpp::NumericVector Fsum, int n, double l2_reg, Rcpp::NumericVector grad);
RcppExport SEXP _poismf_calc_fun_single_R(SEXP x_RSEXP, SEXP X_RSEXP, SEXP X_indSEXP, SEXP nnz_thisSEXP, SEXP F_RSEXP, SEXP FsumSEXP, SEXP nSEXP, SEXP l2_regSEXP, SEXP gradSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type x_R(x_RSEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type X_R(X_RSEXP);
    Rcpp::traits::input_parameter< Rcpp::IntegerVector >::type X_ind(X_indSEXP);
    Rcpp::traits::input_parameter< int >::type nnz_this(nnz_thisSEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type F_R(F_RSEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type Fsum(FsumSEXP);
    Rcpp::traits::input_parameter< int >::type n(nSEXP);
    Rcpp::traits::input_parameter< double >::type l2_reg(l2_regSEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type grad(gradSEXP);
    rcpp_result_gen = Rcpp::wrap(calc_fun_single_R(x_R, X_R, X_ind, nnz_this, F_R, Fsum, n, l2_reg, grad));
    return rcpp_result_gen;
END_RCPP
}
// calc_grad_single_R
Rcpp::NumericVector calc_grad_single_R(Rcpp::NumericVector x_R, Rcpp::NumericVector X_R, Rcpp::IntegerVector X_ind, int nnz_this, Rcpp::NumericVector F_R, Rcpp::NumericVector Fsum, int n, double l2_reg, Rcpp::NumericVector grad_R);
RcppExport SEXP _poismf_calc_grad_single_R(SEXP x_RSEXP, SEXP X_RSEXP, SEXP X_indSEXP, SEXP nnz_thisSEXP, SEXP F_RSEXP, SEXP FsumSEXP, SEXP nSEXP, SEXP l2_regSEXP, SEXP grad_RSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type x_R(x_RSEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type X_R(X_RSEXP);
    Rcpp::traits::input_parameter< Rcpp::IntegerVector >::type X_ind(X_indSEXP);
    Rcpp::traits::input_parameter< int >::type nnz_this(nnz_thisSEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type F_R(F_RSEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type Fsum(FsumSEXP);
    Rcpp::traits::input_parameter< int >::type n(nSEXP);
    Rcpp::traits::input_parameter< double >::type l2_reg(l2_regSEXP);
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type grad_R(grad_RSEXP);
    rcpp_result_gen = Rcpp::wrap(calc_grad_single_R(x_R, X_R, X_ind, nnz_this, F_R, Fsum, n, l2_reg, grad_R));
    return rcpp_result_gen;
END_RCPP
}
// select_topN
void select_topN(Rcpp::NumericVector preds, Rcpp::IntegerVector ix, int topN);
RcppExport SEXP _poismf_select_topN(SEXP predsSEXP, SEXP ixSEXP, SEXP topNSEXP) {
BEGIN_RCPP
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type preds(predsSEXP);
    Rcpp::traits::input_parameter< Rcpp::IntegerVector >::type ix(ixSEXP);
    Rcpp::traits::input_parameter< int >::type topN(topNSEXP);
    select_topN(preds, ix, topN);
    return R_NilValue;
END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
    {"_poismf_r_wrapper_poismf", (DL_FUNC) &_poismf_r_wrapper_poismf, 19},
    {"_poismf_predict_multiple", (DL_FUNC) &_poismf_predict_multiple, 8},
    {"_poismf_calc_fun_single_R", (DL_FUNC) &_poismf_calc_fun_single_R, 9},
    {"_poismf_calc_grad_single_R", (DL_FUNC) &_poismf_calc_grad_single_R, 9},
    {"_poismf_select_topN", (DL_FUNC) &_poismf_select_topN, 3},
    {NULL, NULL, 0}
};

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