.. _program_listing_file_include_eiquadprog_eiquadprog-fast.hpp: Program Listing for File eiquadprog-fast.hpp ============================================ |exhale_lsh| :ref:`Return to documentation for file ` (``include/eiquadprog/eiquadprog-fast.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // // Copyright (c) 2017 CNRS // // This file is part of eiquadprog. // // eiquadprog is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or //(at your option) any later version. // eiquadprog is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // You should have received a copy of the GNU Lesser General Public License // along with eiquadprog. If not, see . #ifndef EIQUADPROGFAST_HPP_ #define EIQUADPROGFAST_HPP_ #include #define OPTIMIZE_STEP_1_2 // compute s(x) = ci^T * x + ci0 #define OPTIMIZE_COMPUTE_D #define OPTIMIZE_UPDATE_Z #define OPTIMIZE_HESSIAN_INVERSE #define OPTIMIZE_UNCONSTR_MINIM // #define USE_WARM_START // #define PROFILE_EIQUADPROG // #define DEBUG_STREAM(msg) std::cout<::d bool is_inverse_provided_; private: size_t m_nVars; size_t m_nEqCon; size_t m_nIneqCon; int m_maxIter; double f_value; Eigen::LLT chol_; // ::d MatrixXd R; // ::d VectorXd s; // ::d VectorXd r; // ::d VectorXd u; // ::d VectorXd z; // ::d VectorXd d; //::d VectorXd np; //::d VectorXi A; // VectorXi iai; // ::i VectorXi iaexcl; //::i VectorXd x_old; // old value of x ::d VectorXd u_old; // old value of u ::d VectorXi A_old; // old value of A ::i #ifdef OPTIMIZE_ADD_CONSTRAINT VectorXd T1; #endif size_t q; int iter; inline void compute_d(VectorXd& d, const MatrixXd& J, const VectorXd& np) { #ifdef OPTIMIZE_COMPUTE_D d.noalias() = J.adjoint() * np; #else d = J.adjoint() * np; #endif } inline void update_z(VectorXd& z, const MatrixXd& J, const VectorXd& d, size_t iq) { #ifdef OPTIMIZE_UPDATE_Z z.noalias() = J.rightCols(z.size() - iq) * d.tail(z.size() - iq); #else z = J.rightCols(J.cols() - iq) * d.tail(J.cols() - iq); #endif } inline void update_r(const MatrixXd& R, VectorXd& r, const VectorXd& d, size_t iq) { r.head(iq) = d.head(iq); R.topLeftCorner(iq, iq).triangularView().solveInPlace( r.head(iq)); } inline bool add_constraint(MatrixXd& R, MatrixXd& J, VectorXd& d, size_t& iq, double& R_norm); inline void delete_constraint(MatrixXd& R, MatrixXd& J, VectorXi& A, VectorXd& u, size_t nEqCon, size_t& iq, size_t l); }; } /* namespace solvers */ } /* namespace eiquadprog */ #endif /* EIQUADPROGFAST_HPP_ */