quadprog.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
  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) quadratric program of 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. // Inputs:
  23. // G #x by #x matrix of quadratic coefficients
  24. // g0 #x vector of linear coefficients
  25. // CE #x by #CE list of linear equality coefficients
  26. // ce0 #CE list of linear equality right-hand sides
  27. // CI #x by #CI list of linear equality coefficients
  28. // ci0 #CI list of linear equality right-hand sides
  29. // Outputs:
  30. // x #x vector of solution values
  31. // Returns true iff success
  32. IGL_INLINE bool quadprog(
  33. const Eigen::MatrixXd & G,
  34. const Eigen::VectorXd & g0,
  35. const Eigen::MatrixXd & CE,
  36. const Eigen::VectorXd & ce0,
  37. const Eigen::MatrixXd & CI,
  38. const Eigen::VectorXd & ci0,
  39. Eigen::VectorXd& x);
  40. }
  41. }
  42. #ifndef IGL_STATIC_LIBRARY
  43. # include "quadprog.cpp"
  44. #endif
  45. #endif