min_quad_dense.h 1.5 KB

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