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

#include <RcppArmadillo.h>
#include <RcppEigen.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

// nip_pca_comp_rcpp
Rcpp::List nip_pca_comp_rcpp(Eigen::MatrixXd X);
RcppExport SEXP _metabom8_nip_pca_comp_rcpp(SEXP XSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Eigen::MatrixXd >::type X(XSEXP);
    rcpp_result_gen = Rcpp::wrap(nip_pca_comp_rcpp(X));
    return rcpp_result_gen;
END_RCPP
}
// multiY_Tw_rcpp
Eigen::MatrixXd multiY_Tw_rcpp(Eigen::MatrixXd X, Eigen::MatrixXd Y, int it_max, double eps);
RcppExport SEXP _metabom8_multiY_Tw_rcpp(SEXP XSEXP, SEXP YSEXP, SEXP it_maxSEXP, SEXP epsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Eigen::MatrixXd >::type X(XSEXP);
    Rcpp::traits::input_parameter< Eigen::MatrixXd >::type Y(YSEXP);
    Rcpp::traits::input_parameter< int >::type it_max(it_maxSEXP);
    Rcpp::traits::input_parameter< double >::type eps(epsSEXP);
    rcpp_result_gen = Rcpp::wrap(multiY_Tw_rcpp(X, Y, it_max, eps));
    return rcpp_result_gen;
END_RCPP
}
// nip_PLS_comp_rcpp
Rcpp::List nip_PLS_comp_rcpp(Eigen::Map<Eigen::MatrixXd> X, Eigen::Map<Eigen::MatrixXd> Y, int it_max, double eps);
RcppExport SEXP _metabom8_nip_PLS_comp_rcpp(SEXP XSEXP, SEXP YSEXP, SEXP it_maxSEXP, SEXP epsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Eigen::Map<Eigen::MatrixXd> >::type X(XSEXP);
    Rcpp::traits::input_parameter< Eigen::Map<Eigen::MatrixXd> >::type Y(YSEXP);
    Rcpp::traits::input_parameter< int >::type it_max(it_maxSEXP);
    Rcpp::traits::input_parameter< double >::type eps(epsSEXP);
    rcpp_result_gen = Rcpp::wrap(nip_PLS_comp_rcpp(X, Y, it_max, eps));
    return rcpp_result_gen;
END_RCPP
}
// ortho_gram_schmidt_rcpp
Eigen::MatrixXd ortho_gram_schmidt_rcpp(Eigen::VectorXd u, Eigen::MatrixXd v);
RcppExport SEXP _metabom8_ortho_gram_schmidt_rcpp(SEXP uSEXP, SEXP vSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Eigen::VectorXd >::type u(uSEXP);
    Rcpp::traits::input_parameter< Eigen::MatrixXd >::type v(vSEXP);
    rcpp_result_gen = Rcpp::wrap(ortho_gram_schmidt_rcpp(u, v));
    return rcpp_result_gen;
END_RCPP
}
// nip_opls_rcpp
Rcpp::List nip_opls_rcpp(Eigen::MatrixXd X, Eigen::MatrixXd Y);
RcppExport SEXP _metabom8_nip_opls_rcpp(SEXP XSEXP, SEXP YSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Eigen::MatrixXd >::type X(XSEXP);
    Rcpp::traits::input_parameter< Eigen::MatrixXd >::type Y(YSEXP);
    rcpp_result_gen = Rcpp::wrap(nip_opls_rcpp(X, Y));
    return rcpp_result_gen;
END_RCPP
}
// tss_rcpp
double tss_rcpp(const Eigen::Map<Eigen::MatrixXd>& X);
RcppExport SEXP _metabom8_tss_rcpp(SEXP XSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const Eigen::Map<Eigen::MatrixXd>& >::type X(XSEXP);
    rcpp_result_gen = Rcpp::wrap(tss_rcpp(X));
    return rcpp_result_gen;
END_RCPP
}
// opls_pred_rcpp
Rcpp::List opls_pred_rcpp(Rcpp::List opls_mod, Rcpp::List pred_mod, Eigen::MatrixXd Xnew);
RcppExport SEXP _metabom8_opls_pred_rcpp(SEXP opls_modSEXP, SEXP pred_modSEXP, SEXP XnewSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Rcpp::List >::type opls_mod(opls_modSEXP);
    Rcpp::traits::input_parameter< Rcpp::List >::type pred_mod(pred_modSEXP);
    Rcpp::traits::input_parameter< Eigen::MatrixXd >::type Xnew(XnewSEXP);
    rcpp_result_gen = Rcpp::wrap(opls_pred_rcpp(opls_mod, pred_mod, Xnew));
    return rcpp_result_gen;
END_RCPP
}
// pls_pred_rcpp
Rcpp::List pls_pred_rcpp(Rcpp::List pls_mod, Eigen::MatrixXd Xnew);
RcppExport SEXP _metabom8_pls_pred_rcpp(SEXP pls_modSEXP, SEXP XnewSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< Rcpp::List >::type pls_mod(pls_modSEXP);
    Rcpp::traits::input_parameter< Eigen::MatrixXd >::type Xnew(XnewSEXP);
    rcpp_result_gen = Rcpp::wrap(pls_pred_rcpp(pls_mod, Xnew));
    return rcpp_result_gen;
END_RCPP
}
// calcPhi
arma::vec calcPhi(double ph0, double& ph1, int& le);
RcppExport SEXP _metabom8_calcPhi(SEXP ph0SEXP, SEXP ph1SEXP, SEXP leSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< double >::type ph0(ph0SEXP);
    Rcpp::traits::input_parameter< double& >::type ph1(ph1SEXP);
    Rcpp::traits::input_parameter< int& >::type le(leSEXP);
    rcpp_result_gen = Rcpp::wrap(calcPhi(ph0, ph1, le));
    return rcpp_result_gen;
END_RCPP
}
// phase1d
arma::vec phase1d(arma::vec& sp_re, arma::vec& sp_im, double ph0, double ph1);
RcppExport SEXP _metabom8_phase1d(SEXP sp_reSEXP, SEXP sp_imSEXP, SEXP ph0SEXP, SEXP ph1SEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::vec& >::type sp_re(sp_reSEXP);
    Rcpp::traits::input_parameter< arma::vec& >::type sp_im(sp_imSEXP);
    Rcpp::traits::input_parameter< double >::type ph0(ph0SEXP);
    Rcpp::traits::input_parameter< double >::type ph1(ph1SEXP);
    rcpp_result_gen = Rcpp::wrap(phase1d(sp_re, sp_im, ph0, ph1));
    return rcpp_result_gen;
END_RCPP
}
// phaseTsp
arma::vec phaseTsp(arma::vec& sp_re, arma::vec& sp_im, arma::vec& ppm, arma::vec& ph0, double& ph1, arma::uvec idx_tsp);
RcppExport SEXP _metabom8_phaseTsp(SEXP sp_reSEXP, SEXP sp_imSEXP, SEXP ppmSEXP, SEXP ph0SEXP, SEXP ph1SEXP, SEXP idx_tspSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::vec& >::type sp_re(sp_reSEXP);
    Rcpp::traits::input_parameter< arma::vec& >::type sp_im(sp_imSEXP);
    Rcpp::traits::input_parameter< arma::vec& >::type ppm(ppmSEXP);
    Rcpp::traits::input_parameter< arma::vec& >::type ph0(ph0SEXP);
    Rcpp::traits::input_parameter< double& >::type ph1(ph1SEXP);
    Rcpp::traits::input_parameter< arma::uvec >::type idx_tsp(idx_tspSEXP);
    rcpp_result_gen = Rcpp::wrap(phaseTsp(sp_re, sp_im, ppm, ph0, ph1, idx_tsp));
    return rcpp_result_gen;
END_RCPP
}
// zerofil
arma::vec zerofil(arma::vec fid, const int zf, int le_ori);
RcppExport SEXP _metabom8_zerofil(SEXP fidSEXP, SEXP zfSEXP, SEXP le_oriSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::vec >::type fid(fidSEXP);
    Rcpp::traits::input_parameter< const int >::type zf(zfSEXP);
    Rcpp::traits::input_parameter< int >::type le_ori(le_oriSEXP);
    rcpp_result_gen = Rcpp::wrap(zerofil(fid, zf, le_ori));
    return rcpp_result_gen;
END_RCPP
}
// cplxFft
arma::cx_vec cplxFft(arma::vec fid);
RcppExport SEXP _metabom8_cplxFft(SEXP fidSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::vec >::type fid(fidSEXP);
    rcpp_result_gen = Rcpp::wrap(cplxFft(fid));
    return rcpp_result_gen;
END_RCPP
}
// defineChemShiftPpm
arma::vec defineChemShiftPpm(const float sf_mhz, const float sw_hz, const int n_sp_re, const float dref, bool ref);
RcppExport SEXP _metabom8_defineChemShiftPpm(SEXP sf_mhzSEXP, SEXP sw_hzSEXP, SEXP n_sp_reSEXP, SEXP drefSEXP, SEXP refSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const float >::type sf_mhz(sf_mhzSEXP);
    Rcpp::traits::input_parameter< const float >::type sw_hz(sw_hzSEXP);
    Rcpp::traits::input_parameter< const int >::type n_sp_re(n_sp_reSEXP);
    Rcpp::traits::input_parameter< const float >::type dref(drefSEXP);
    Rcpp::traits::input_parameter< bool >::type ref(refSEXP);
    rcpp_result_gen = Rcpp::wrap(defineChemShiftPpm(sf_mhz, sw_hz, n_sp_re, dref, ref));
    return rcpp_result_gen;
END_RCPP
}
// calibTsp
arma::vec calibTsp(arma::vec spec, arma::vec ppm);
RcppExport SEXP _metabom8_calibTsp(SEXP specSEXP, SEXP ppmSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< arma::vec >::type spec(specSEXP);
    Rcpp::traits::input_parameter< arma::vec >::type ppm(ppmSEXP);
    rcpp_result_gen = Rcpp::wrap(calibTsp(spec, ppm));
    return rcpp_result_gen;
END_RCPP
}
// sd_rcpp
Rcpp::List sd_rcpp(const Rcpp::NumericMatrix& X);
RcppExport SEXP _metabom8_sd_rcpp(SEXP XSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const Rcpp::NumericMatrix& >::type X(XSEXP);
    rcpp_result_gen = Rcpp::wrap(sd_rcpp(X));
    return rcpp_result_gen;
END_RCPP
}
// scale_rcpp
Rcpp::List scale_rcpp(const Rcpp::NumericMatrix& X, const Rcpp::IntegerVector& idc, bool center, int scale_type);
RcppExport SEXP _metabom8_scale_rcpp(SEXP XSEXP, SEXP idcSEXP, SEXP centerSEXP, SEXP scale_typeSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const Rcpp::NumericMatrix& >::type X(XSEXP);
    Rcpp::traits::input_parameter< const Rcpp::IntegerVector& >::type idc(idcSEXP);
    Rcpp::traits::input_parameter< bool >::type center(centerSEXP);
    Rcpp::traits::input_parameter< int >::type scale_type(scale_typeSEXP);
    rcpp_result_gen = Rcpp::wrap(scale_rcpp(X, idc, center, scale_type));
    return rcpp_result_gen;
END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
    {"_metabom8_nip_pca_comp_rcpp", (DL_FUNC) &_metabom8_nip_pca_comp_rcpp, 1},
    {"_metabom8_multiY_Tw_rcpp", (DL_FUNC) &_metabom8_multiY_Tw_rcpp, 4},
    {"_metabom8_nip_PLS_comp_rcpp", (DL_FUNC) &_metabom8_nip_PLS_comp_rcpp, 4},
    {"_metabom8_ortho_gram_schmidt_rcpp", (DL_FUNC) &_metabom8_ortho_gram_schmidt_rcpp, 2},
    {"_metabom8_nip_opls_rcpp", (DL_FUNC) &_metabom8_nip_opls_rcpp, 2},
    {"_metabom8_tss_rcpp", (DL_FUNC) &_metabom8_tss_rcpp, 1},
    {"_metabom8_opls_pred_rcpp", (DL_FUNC) &_metabom8_opls_pred_rcpp, 3},
    {"_metabom8_pls_pred_rcpp", (DL_FUNC) &_metabom8_pls_pred_rcpp, 2},
    {"_metabom8_calcPhi", (DL_FUNC) &_metabom8_calcPhi, 3},
    {"_metabom8_phase1d", (DL_FUNC) &_metabom8_phase1d, 4},
    {"_metabom8_phaseTsp", (DL_FUNC) &_metabom8_phaseTsp, 6},
    {"_metabom8_zerofil", (DL_FUNC) &_metabom8_zerofil, 3},
    {"_metabom8_cplxFft", (DL_FUNC) &_metabom8_cplxFft, 1},
    {"_metabom8_defineChemShiftPpm", (DL_FUNC) &_metabom8_defineChemShiftPpm, 5},
    {"_metabom8_calibTsp", (DL_FUNC) &_metabom8_calibTsp, 2},
    {"_metabom8_sd_rcpp", (DL_FUNC) &_metabom8_sd_rcpp, 1},
    {"_metabom8_scale_rcpp", (DL_FUNC) &_metabom8_scale_rcpp, 4},
    {NULL, NULL, 0}
};

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