min_quad_dense.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef IGL_MIN_QUAD_DENSE_H
  2. #define IGL_MIN_QUAD_DENSE_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Dense>
  5. //// debug
  6. //#include <matlabinterface.h>
  7. //Engine *g_pEngine;
  8. namespace igl
  9. {
  10. // MIN_QUAD_WITH_FIXED Minimize quadratic energy Z'*A*Z + Z'*B + C
  11. // subject to linear constraints Aeq*Z = Beq
  12. //
  13. // Templates:
  14. // T should be a eigen matrix primitive type like float or double
  15. // Inputs:
  16. // A n by n matrix of quadratic coefficients
  17. // B n by 1 column of linear coefficients
  18. // Aeq m by n list of linear equality constraint coefficients
  19. // Beq m by 1 list of linear equality constraint constant values
  20. // use_lu_decomposition use lu rather than SVD
  21. // Outputs:
  22. // S n by (n + m) "solve" matrix, such that S*[B', Beq'] is a solution
  23. // Returns true on success, false on error
  24. template <typename T>
  25. IGL_INLINE void min_quad_dense_precompute(
  26. const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& A,
  27. const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& Aeq,
  28. const bool use_lu_decomposition,
  29. Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& S);
  30. }
  31. #ifdef IGL_HEADER_ONLY
  32. # include "min_quad_dense.cpp"
  33. #endif
  34. #endif