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

#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

// risk_parity_portfolio_ccd_choi
Eigen::VectorXd risk_parity_portfolio_ccd_choi(const Eigen::MatrixXd& cov, const Eigen::VectorXd& b, const double tol, const unsigned int maxiter);
RcppExport SEXP _riskParityPortfolio_risk_parity_portfolio_ccd_choi(SEXP covSEXP, SEXP bSEXP, SEXP tolSEXP, SEXP maxiterSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const Eigen::MatrixXd& >::type cov(covSEXP);
    Rcpp::traits::input_parameter< const Eigen::VectorXd& >::type b(bSEXP);
    Rcpp::traits::input_parameter< const double >::type tol(tolSEXP);
    Rcpp::traits::input_parameter< const unsigned int >::type maxiter(maxiterSEXP);
    rcpp_result_gen = Rcpp::wrap(risk_parity_portfolio_ccd_choi(cov, b, tol, maxiter));
    return rcpp_result_gen;
END_RCPP
}
// risk_parity_portfolio_ccd_spinu
Eigen::VectorXd risk_parity_portfolio_ccd_spinu(const Eigen::MatrixXd& Sigma, const Eigen::VectorXd& b, const double tol, const unsigned int maxiter);
RcppExport SEXP _riskParityPortfolio_risk_parity_portfolio_ccd_spinu(SEXP SigmaSEXP, SEXP bSEXP, SEXP tolSEXP, SEXP maxiterSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const Eigen::MatrixXd& >::type Sigma(SigmaSEXP);
    Rcpp::traits::input_parameter< const Eigen::VectorXd& >::type b(bSEXP);
    Rcpp::traits::input_parameter< const double >::type tol(tolSEXP);
    Rcpp::traits::input_parameter< const unsigned int >::type maxiter(maxiterSEXP);
    rcpp_result_gen = Rcpp::wrap(risk_parity_portfolio_ccd_spinu(Sigma, b, tol, maxiter));
    return rcpp_result_gen;
END_RCPP
}
// risk_parity_portfolio_ccd_roncalli
Eigen::VectorXd risk_parity_portfolio_ccd_roncalli(const Eigen::MatrixXd& Sigma, const Eigen::VectorXd& b, const double tol, const unsigned int maxiter);
RcppExport SEXP _riskParityPortfolio_risk_parity_portfolio_ccd_roncalli(SEXP SigmaSEXP, SEXP bSEXP, SEXP tolSEXP, SEXP maxiterSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const Eigen::MatrixXd& >::type Sigma(SigmaSEXP);
    Rcpp::traits::input_parameter< const Eigen::VectorXd& >::type b(bSEXP);
    Rcpp::traits::input_parameter< const double >::type tol(tolSEXP);
    Rcpp::traits::input_parameter< const unsigned int >::type maxiter(maxiterSEXP);
    rcpp_result_gen = Rcpp::wrap(risk_parity_portfolio_ccd_roncalli(Sigma, b, tol, maxiter));
    return rcpp_result_gen;
END_RCPP
}
// active_risk_parity_portfolio_ccd
Eigen::VectorXd active_risk_parity_portfolio_ccd(const Eigen::MatrixXd& Sigma, const Eigen::VectorXd& b, const Eigen::VectorXd& mu, const double c, const double r, const double tol, const unsigned int maxiter);
RcppExport SEXP _riskParityPortfolio_active_risk_parity_portfolio_ccd(SEXP SigmaSEXP, SEXP bSEXP, SEXP muSEXP, SEXP cSEXP, SEXP rSEXP, SEXP tolSEXP, SEXP maxiterSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const Eigen::MatrixXd& >::type Sigma(SigmaSEXP);
    Rcpp::traits::input_parameter< const Eigen::VectorXd& >::type b(bSEXP);
    Rcpp::traits::input_parameter< const Eigen::VectorXd& >::type mu(muSEXP);
    Rcpp::traits::input_parameter< const double >::type c(cSEXP);
    Rcpp::traits::input_parameter< const double >::type r(rSEXP);
    Rcpp::traits::input_parameter< const double >::type tol(tolSEXP);
    Rcpp::traits::input_parameter< const unsigned int >::type maxiter(maxiterSEXP);
    rcpp_result_gen = Rcpp::wrap(active_risk_parity_portfolio_ccd(Sigma, b, mu, c, r, tol, maxiter));
    return rcpp_result_gen;
END_RCPP
}
// risk_parity_portfolio_nn
Eigen::VectorXd risk_parity_portfolio_nn(const Eigen::MatrixXd& Sigma, const Eigen::VectorXd& b, const double tol, const unsigned int maxiter);
RcppExport SEXP _riskParityPortfolio_risk_parity_portfolio_nn(SEXP SigmaSEXP, SEXP bSEXP, SEXP tolSEXP, SEXP maxiterSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const Eigen::MatrixXd& >::type Sigma(SigmaSEXP);
    Rcpp::traits::input_parameter< const Eigen::VectorXd& >::type b(bSEXP);
    Rcpp::traits::input_parameter< const double >::type tol(tolSEXP);
    Rcpp::traits::input_parameter< const unsigned int >::type maxiter(maxiterSEXP);
    rcpp_result_gen = Rcpp::wrap(risk_parity_portfolio_nn(Sigma, b, tol, maxiter));
    return rcpp_result_gen;
END_RCPP
}
// obj_function_spinu
double obj_function_spinu(const Eigen::MatrixXd& Sigma, const Eigen::VectorXd& x, const Eigen::VectorXd& b);
RcppExport SEXP _riskParityPortfolio_obj_function_spinu(SEXP SigmaSEXP, SEXP xSEXP, SEXP bSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const Eigen::MatrixXd& >::type Sigma(SigmaSEXP);
    Rcpp::traits::input_parameter< const Eigen::VectorXd& >::type x(xSEXP);
    Rcpp::traits::input_parameter< const Eigen::VectorXd& >::type b(bSEXP);
    rcpp_result_gen = Rcpp::wrap(obj_function_spinu(Sigma, x, b));
    return rcpp_result_gen;
END_RCPP
}
// obj_function_roncalli
double obj_function_roncalli(const Eigen::MatrixXd& Sigma, const Eigen::VectorXd& x, const Eigen::VectorXd& b);
RcppExport SEXP _riskParityPortfolio_obj_function_roncalli(SEXP SigmaSEXP, SEXP xSEXP, SEXP bSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const Eigen::MatrixXd& >::type Sigma(SigmaSEXP);
    Rcpp::traits::input_parameter< const Eigen::VectorXd& >::type x(xSEXP);
    Rcpp::traits::input_parameter< const Eigen::VectorXd& >::type b(bSEXP);
    rcpp_result_gen = Rcpp::wrap(obj_function_roncalli(Sigma, x, b));
    return rcpp_result_gen;
END_RCPP
}
// rpp_equality_constraints_iteration
Eigen::VectorXd rpp_equality_constraints_iteration(const Eigen::MatrixXd& Cmat, const Eigen::VectorXd& cvec, const Eigen::MatrixXd& Qk, const Eigen::VectorXd& qk);
RcppExport SEXP _riskParityPortfolio_rpp_equality_constraints_iteration(SEXP CmatSEXP, SEXP cvecSEXP, SEXP QkSEXP, SEXP qkSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const Eigen::MatrixXd& >::type Cmat(CmatSEXP);
    Rcpp::traits::input_parameter< const Eigen::VectorXd& >::type cvec(cvecSEXP);
    Rcpp::traits::input_parameter< const Eigen::MatrixXd& >::type Qk(QkSEXP);
    Rcpp::traits::input_parameter< const Eigen::VectorXd& >::type qk(qkSEXP);
    rcpp_result_gen = Rcpp::wrap(rpp_equality_constraints_iteration(Cmat, cvec, Qk, qk));
    return rcpp_result_gen;
END_RCPP
}
// project_onto_equality_constraint_set
Eigen::VectorXd project_onto_equality_constraint_set(const Eigen::VectorXd& w, const Eigen::MatrixXd& Cmat, const Eigen::VectorXd& cvec);
RcppExport SEXP _riskParityPortfolio_project_onto_equality_constraint_set(SEXP wSEXP, SEXP CmatSEXP, SEXP cvecSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const Eigen::VectorXd& >::type w(wSEXP);
    Rcpp::traits::input_parameter< const Eigen::MatrixXd& >::type Cmat(CmatSEXP);
    Rcpp::traits::input_parameter< const Eigen::VectorXd& >::type cvec(cvecSEXP);
    rcpp_result_gen = Rcpp::wrap(project_onto_equality_constraint_set(w, Cmat, cvec));
    return rcpp_result_gen;
END_RCPP
}
// rpp_eq_and_ineq_constraints_iteration
std::vector<Eigen::VectorXd> rpp_eq_and_ineq_constraints_iteration(const Eigen::MatrixXd& Cmat, const Eigen::VectorXd& cvec, const Eigen::MatrixXd& Dmat, const Eigen::VectorXd& dvec, const Eigen::MatrixXd& Qk, const Eigen::VectorXd& qk, const Eigen::VectorXd& wk, Eigen::VectorXd& dual_mu_0, Eigen::VectorXd& dual_mu_minus_1, Eigen::VectorXd& dual_lmd_0, Eigen::VectorXd& dual_lmd_minus_1, unsigned int maxiter, double tol);
RcppExport SEXP _riskParityPortfolio_rpp_eq_and_ineq_constraints_iteration(SEXP CmatSEXP, SEXP cvecSEXP, SEXP DmatSEXP, SEXP dvecSEXP, SEXP QkSEXP, SEXP qkSEXP, SEXP wkSEXP, SEXP dual_mu_0SEXP, SEXP dual_mu_minus_1SEXP, SEXP dual_lmd_0SEXP, SEXP dual_lmd_minus_1SEXP, SEXP maxiterSEXP, SEXP tolSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const Eigen::MatrixXd& >::type Cmat(CmatSEXP);
    Rcpp::traits::input_parameter< const Eigen::VectorXd& >::type cvec(cvecSEXP);
    Rcpp::traits::input_parameter< const Eigen::MatrixXd& >::type Dmat(DmatSEXP);
    Rcpp::traits::input_parameter< const Eigen::VectorXd& >::type dvec(dvecSEXP);
    Rcpp::traits::input_parameter< const Eigen::MatrixXd& >::type Qk(QkSEXP);
    Rcpp::traits::input_parameter< const Eigen::VectorXd& >::type qk(qkSEXP);
    Rcpp::traits::input_parameter< const Eigen::VectorXd& >::type wk(wkSEXP);
    Rcpp::traits::input_parameter< Eigen::VectorXd& >::type dual_mu_0(dual_mu_0SEXP);
    Rcpp::traits::input_parameter< Eigen::VectorXd& >::type dual_mu_minus_1(dual_mu_minus_1SEXP);
    Rcpp::traits::input_parameter< Eigen::VectorXd& >::type dual_lmd_0(dual_lmd_0SEXP);
    Rcpp::traits::input_parameter< Eigen::VectorXd& >::type dual_lmd_minus_1(dual_lmd_minus_1SEXP);
    Rcpp::traits::input_parameter< unsigned int >::type maxiter(maxiterSEXP);
    Rcpp::traits::input_parameter< double >::type tol(tolSEXP);
    rcpp_result_gen = Rcpp::wrap(rpp_eq_and_ineq_constraints_iteration(Cmat, cvec, Dmat, dvec, Qk, qk, wk, dual_mu_0, dual_mu_minus_1, dual_lmd_0, dual_lmd_minus_1, maxiter, tol));
    return rcpp_result_gen;
END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
    {"_riskParityPortfolio_risk_parity_portfolio_ccd_choi", (DL_FUNC) &_riskParityPortfolio_risk_parity_portfolio_ccd_choi, 4},
    {"_riskParityPortfolio_risk_parity_portfolio_ccd_spinu", (DL_FUNC) &_riskParityPortfolio_risk_parity_portfolio_ccd_spinu, 4},
    {"_riskParityPortfolio_risk_parity_portfolio_ccd_roncalli", (DL_FUNC) &_riskParityPortfolio_risk_parity_portfolio_ccd_roncalli, 4},
    {"_riskParityPortfolio_active_risk_parity_portfolio_ccd", (DL_FUNC) &_riskParityPortfolio_active_risk_parity_portfolio_ccd, 7},
    {"_riskParityPortfolio_risk_parity_portfolio_nn", (DL_FUNC) &_riskParityPortfolio_risk_parity_portfolio_nn, 4},
    {"_riskParityPortfolio_obj_function_spinu", (DL_FUNC) &_riskParityPortfolio_obj_function_spinu, 3},
    {"_riskParityPortfolio_obj_function_roncalli", (DL_FUNC) &_riskParityPortfolio_obj_function_roncalli, 3},
    {"_riskParityPortfolio_rpp_equality_constraints_iteration", (DL_FUNC) &_riskParityPortfolio_rpp_equality_constraints_iteration, 4},
    {"_riskParityPortfolio_project_onto_equality_constraint_set", (DL_FUNC) &_riskParityPortfolio_project_onto_equality_constraint_set, 3},
    {"_riskParityPortfolio_rpp_eq_and_ineq_constraints_iteration", (DL_FUNC) &_riskParityPortfolio_rpp_eq_and_ineq_constraints_iteration, 13},
    {NULL, NULL, 0}
};

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