pinv.h 789 B

1234567891011121314151617181920212223242526272829
  1. #ifndef IGL_PINV_H
  2. #define IGL_PINV_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. namespace igl
  6. {
  7. // Compute the Moore-Penrose pseudoinverse
  8. //
  9. // Inputs:
  10. // A m by n matrix
  11. // tol tolerance (if negative then default is used)
  12. // Outputs:
  13. // X n by m matrix so that A*X*A = A and X*A*X = X and A*X = (A*X)' and
  14. // (X*A) = (X*A)'
  15. template <typename DerivedA, typename DerivedX>
  16. void pinv(
  17. const Eigen::MatrixBase<DerivedA> & A,
  18. typename DerivedA::Scalar tol,
  19. Eigen::PlainObjectBase<DerivedX> & X);
  20. // Wrapper using default tol
  21. template <typename DerivedA, typename DerivedX>
  22. void pinv(
  23. const Eigen::MatrixBase<DerivedA> & A,
  24. Eigen::PlainObjectBase<DerivedX> & X);
  25. }
  26. #ifndef IGL_STATIC_LIBRARY
  27. # include "pinv.cpp"
  28. #endif
  29. #endif