quadprog.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Alec Jacobson <[email protected]>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_COPYLEFT_QUADPROG_H
  9. #define IGL_COPYLEFT_QUADPROG_H
  10. #include "../igl_inline.h"
  11. #include <Eigen/Dense>
  12. namespace igl
  13. {
  14. namespace copyleft
  15. {
  16. /// Solve a (dense) convex quadratric program. Given in the form
  17. ///
  18. /// min 0.5 x G x + g0 x
  19. /// s.t. CE' x + ce0 = 0
  20. /// and CI' x + ci0 >= 0
  21. ///
  22. /// @param[in] G #x by #x matrix of quadratic coefficients
  23. /// @param[in] g0 #x vector of linear coefficients
  24. /// @param[in] CE #x by #CE list of linear equality coefficients
  25. /// @param[in] ce0 #CE list of linear equality right-hand sides
  26. /// @param[in] CI #x by #CI list of linear equality coefficients
  27. /// @param[in] ci0 #CI list of linear equality right-hand sides
  28. /// @param[out] x #x vector of solution values
  29. /// @return true iff success
  30. IGL_INLINE bool quadprog(
  31. const Eigen::MatrixXd & G,
  32. const Eigen::VectorXd & g0,
  33. const Eigen::MatrixXd & CE,
  34. const Eigen::VectorXd & ce0,
  35. const Eigen::MatrixXd & CI,
  36. const Eigen::VectorXd & ci0,
  37. Eigen::VectorXd& x);
  38. }
  39. }
  40. #ifndef IGL_STATIC_LIBRARY
  41. # include "quadprog.cpp"
  42. #endif
  43. #endif