polar_dec.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef IGL_POLAR_DEC
  2. #define IGL_POLAR_DEC
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. namespace igl
  6. {
  7. // Computes the polar decomposition (R,T) of a matrix A
  8. // Inputs:
  9. // A 3 by 3 matrix to be decomposed
  10. // Outputs:
  11. // R 3 by 3 orthonormal matrix part of decomposition
  12. // T 3 by 3 stretch matrix part of decomposition
  13. // U 3 by 3 left-singular vectors
  14. // S 3 by 1 singular values
  15. // V 3 by 3 right-singular vectors
  16. //
  17. //
  18. template <
  19. typename DerivedA,
  20. typename DerivedR,
  21. typename DerivedT,
  22. typename DerivedU,
  23. typename DerivedS,
  24. typename DerivedV>
  25. IGL_INLINE void polar_dec(
  26. const Eigen::PlainObjectBase<DerivedA> & A,
  27. Eigen::PlainObjectBase<DerivedR> & R,
  28. Eigen::PlainObjectBase<DerivedT> & T,
  29. Eigen::PlainObjectBase<DerivedU> & U,
  30. Eigen::PlainObjectBase<DerivedS> & S,
  31. Eigen::PlainObjectBase<DerivedV> & V);
  32. template <
  33. typename DerivedA,
  34. typename DerivedR,
  35. typename DerivedT>
  36. IGL_INLINE void polar_dec(
  37. const Eigen::PlainObjectBase<DerivedA> & A,
  38. Eigen::PlainObjectBase<DerivedR> & R,
  39. Eigen::PlainObjectBase<DerivedT> & T);
  40. }
  41. #ifdef IGL_HEADER_ONLY
  42. # include "polar_dec.cpp"
  43. #endif
  44. #endif