// 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

// make_kernel
Rcpp::NumericMatrix make_kernel(const arma::mat& X, Nullable<NumericMatrix> X_new, std::string kernel, double rho, Nullable<int> n_threads);
RcppExport SEXP _FastKRR_make_kernel(SEXP XSEXP, SEXP X_newSEXP, SEXP kernelSEXP, SEXP rhoSEXP, SEXP n_threadsSEXP) {
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< Nullable<NumericMatrix> >::type X_new(X_newSEXP);
    Rcpp::traits::input_parameter< std::string >::type kernel(kernelSEXP);
    Rcpp::traits::input_parameter< double >::type rho(rhoSEXP);
    Rcpp::traits::input_parameter< Nullable<int> >::type n_threads(n_threadsSEXP);
    rcpp_result_gen = Rcpp::wrap(make_kernel(X, X_new, kernel, rho, n_threads));
    return rcpp_result_gen;
END_RCPP
}
// nystrom_kernel
Rcpp::List nystrom_kernel(const arma::mat& K_mm, const arma::mat& K_nm, Rcpp::Nullable<int> m_in, int n_threads);
RcppExport SEXP _FastKRR_nystrom_kernel(SEXP K_mmSEXP, SEXP K_nmSEXP, SEXP m_inSEXP, SEXP n_threadsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type K_mm(K_mmSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type K_nm(K_nmSEXP);
    Rcpp::traits::input_parameter< Rcpp::Nullable<int> >::type m_in(m_inSEXP);
    Rcpp::traits::input_parameter< int >::type n_threads(n_threadsSEXP);
    rcpp_result_gen = Rcpp::wrap(nystrom_kernel(K_mm, K_nm, m_in, n_threads));
    return rcpp_result_gen;
END_RCPP
}
// nystrom
Rcpp::List nystrom(const arma::mat& K_mm, const arma::mat& K_nm, const arma::vec& y, int m, double lambda, int n_threads);
RcppExport SEXP _FastKRR_nystrom(SEXP K_mmSEXP, SEXP K_nmSEXP, SEXP ySEXP, SEXP mSEXP, SEXP lambdaSEXP, SEXP n_threadsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type K_mm(K_mmSEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type K_nm(K_nmSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type y(ySEXP);
    Rcpp::traits::input_parameter< int >::type m(mSEXP);
    Rcpp::traits::input_parameter< double >::type lambda(lambdaSEXP);
    Rcpp::traits::input_parameter< int >::type n_threads(n_threadsSEXP);
    rcpp_result_gen = Rcpp::wrap(nystrom(K_mm, K_nm, y, m, lambda, n_threads));
    return rcpp_result_gen;
END_RCPP
}
// pchol_kernel
Rcpp::List pchol_kernel(const arma::mat& X, double rho, std::string kernel, Rcpp::Nullable<int> m, double eps, bool verbose);
RcppExport SEXP _FastKRR_pchol_kernel(SEXP XSEXP, SEXP rhoSEXP, SEXP kernelSEXP, SEXP mSEXP, SEXP epsSEXP, SEXP verboseSEXP) {
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< double >::type rho(rhoSEXP);
    Rcpp::traits::input_parameter< std::string >::type kernel(kernelSEXP);
    Rcpp::traits::input_parameter< Rcpp::Nullable<int> >::type m(mSEXP);
    Rcpp::traits::input_parameter< double >::type eps(epsSEXP);
    Rcpp::traits::input_parameter< bool >::type verbose(verboseSEXP);
    rcpp_result_gen = Rcpp::wrap(pchol_kernel(X, rho, kernel, m, eps, verbose));
    return rcpp_result_gen;
END_RCPP
}
// pchol
Rcpp::List pchol(const arma::mat& X, const arma::vec& y, double lambda, double rho, std::string kernel, Rcpp::Nullable<int> m, double eps, bool verbose);
RcppExport SEXP _FastKRR_pchol(SEXP XSEXP, SEXP ySEXP, SEXP lambdaSEXP, SEXP rhoSEXP, SEXP kernelSEXP, SEXP mSEXP, SEXP epsSEXP, SEXP verboseSEXP) {
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::vec& >::type y(ySEXP);
    Rcpp::traits::input_parameter< double >::type lambda(lambdaSEXP);
    Rcpp::traits::input_parameter< double >::type rho(rhoSEXP);
    Rcpp::traits::input_parameter< std::string >::type kernel(kernelSEXP);
    Rcpp::traits::input_parameter< Rcpp::Nullable<int> >::type m(mSEXP);
    Rcpp::traits::input_parameter< double >::type eps(epsSEXP);
    Rcpp::traits::input_parameter< bool >::type verbose(verboseSEXP);
    rcpp_result_gen = Rcpp::wrap(pchol(X, y, lambda, rho, kernel, m, eps, verbose));
    return rcpp_result_gen;
END_RCPP
}
// reml_exact
double reml_exact(const arma::mat& K, const arma::vec& y, const arma::vec& lambda_vec, int max_iter, double tol, int n_threads);
RcppExport SEXP _FastKRR_reml_exact(SEXP KSEXP, SEXP ySEXP, SEXP lambda_vecSEXP, SEXP max_iterSEXP, SEXP tolSEXP, SEXP n_threadsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type K(KSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type y(ySEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type lambda_vec(lambda_vecSEXP);
    Rcpp::traits::input_parameter< int >::type max_iter(max_iterSEXP);
    Rcpp::traits::input_parameter< double >::type tol(tolSEXP);
    Rcpp::traits::input_parameter< int >::type n_threads(n_threadsSEXP);
    rcpp_result_gen = Rcpp::wrap(reml_exact(K, y, lambda_vec, max_iter, tol, n_threads));
    return rcpp_result_gen;
END_RCPP
}
// reml_lowrank
double reml_lowrank(const arma::mat& F, const arma::vec& y, const arma::vec& lambda_vec, int max_iter, double tol, int n_threads);
RcppExport SEXP _FastKRR_reml_lowrank(SEXP FSEXP, SEXP ySEXP, SEXP lambda_vecSEXP, SEXP max_iterSEXP, SEXP tolSEXP, SEXP n_threadsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type F(FSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type y(ySEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type lambda_vec(lambda_vecSEXP);
    Rcpp::traits::input_parameter< int >::type max_iter(max_iterSEXP);
    Rcpp::traits::input_parameter< double >::type tol(tolSEXP);
    Rcpp::traits::input_parameter< int >::type n_threads(n_threadsSEXP);
    rcpp_result_gen = Rcpp::wrap(reml_lowrank(F, y, lambda_vec, max_iter, tol, n_threads));
    return rcpp_result_gen;
END_RCPP
}
// make_Z
arma::mat make_Z(const arma::mat& X, const arma::mat& W, const arma::vec& b, int n_threads);
RcppExport SEXP _FastKRR_make_Z(SEXP XSEXP, SEXP WSEXP, SEXP bSEXP, SEXP n_threadsSEXP) {
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::mat& >::type W(WSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type b(bSEXP);
    Rcpp::traits::input_parameter< int >::type n_threads(n_threadsSEXP);
    rcpp_result_gen = Rcpp::wrap(make_Z(X, W, b, n_threads));
    return rcpp_result_gen;
END_RCPP
}
// rff
List rff(const arma::mat& X, const arma::vec& y, const arma::mat& W, const arma::vec& b, double lambda, int n_threads);
RcppExport SEXP _FastKRR_rff(SEXP XSEXP, SEXP ySEXP, SEXP WSEXP, SEXP bSEXP, SEXP lambdaSEXP, SEXP n_threadsSEXP) {
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::vec& >::type y(ySEXP);
    Rcpp::traits::input_parameter< const arma::mat& >::type W(WSEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type b(bSEXP);
    Rcpp::traits::input_parameter< double >::type lambda(lambdaSEXP);
    Rcpp::traits::input_parameter< int >::type n_threads(n_threadsSEXP);
    rcpp_result_gen = Rcpp::wrap(rff(X, y, W, b, lambda, n_threads));
    return rcpp_result_gen;
END_RCPP
}
// get_num_procs
int get_num_procs();
RcppExport SEXP _FastKRR_get_num_procs() {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    rcpp_result_gen = Rcpp::wrap(get_num_procs());
    return rcpp_result_gen;
END_RCPP
}
// solve_chol
Rcpp::List solve_chol(const arma::mat& A, const arma::vec& b);
RcppExport SEXP _FastKRR_solve_chol(SEXP ASEXP, SEXP bSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type A(ASEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type b(bSEXP);
    rcpp_result_gen = Rcpp::wrap(solve_chol(A, b));
    return rcpp_result_gen;
END_RCPP
}
// SOLVE_sympd
arma::vec SOLVE_sympd(const arma::mat& A, const arma::vec& b);
RcppExport SEXP _FastKRR_SOLVE_sympd(SEXP ASEXP, SEXP bSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const arma::mat& >::type A(ASEXP);
    Rcpp::traits::input_parameter< const arma::vec& >::type b(bSEXP);
    rcpp_result_gen = Rcpp::wrap(SOLVE_sympd(A, b));
    return rcpp_result_gen;
END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
    {"_FastKRR_make_kernel", (DL_FUNC) &_FastKRR_make_kernel, 5},
    {"_FastKRR_nystrom_kernel", (DL_FUNC) &_FastKRR_nystrom_kernel, 4},
    {"_FastKRR_nystrom", (DL_FUNC) &_FastKRR_nystrom, 6},
    {"_FastKRR_pchol_kernel", (DL_FUNC) &_FastKRR_pchol_kernel, 6},
    {"_FastKRR_pchol", (DL_FUNC) &_FastKRR_pchol, 8},
    {"_FastKRR_reml_exact", (DL_FUNC) &_FastKRR_reml_exact, 6},
    {"_FastKRR_reml_lowrank", (DL_FUNC) &_FastKRR_reml_lowrank, 6},
    {"_FastKRR_make_Z", (DL_FUNC) &_FastKRR_make_Z, 4},
    {"_FastKRR_rff", (DL_FUNC) &_FastKRR_rff, 6},
    {"_FastKRR_get_num_procs", (DL_FUNC) &_FastKRR_get_num_procs, 0},
    {"_FastKRR_solve_chol", (DL_FUNC) &_FastKRR_solve_chol, 2},
    {"_FastKRR_SOLVE_sympd", (DL_FUNC) &_FastKRR_SOLVE_sympd, 2},
    {NULL, NULL, 0}
};

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