full.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #include "full.h"
  2. template <typename T>
  3. IGL_INLINE void igl::full(
  4. const Eigen::SparseMatrix<T> & A,
  5. Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> & B)
  6. {
  7. B = Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>::Zero(A.rows(),A.cols());
  8. // Iterate over outside
  9. for(int k=0; k<A.outerSize(); ++k)
  10. {
  11. // Iterate over inside
  12. for(typename Eigen::SparseMatrix<T>::InnerIterator it (A,k); it; ++it)
  13. {
  14. B(it.row(),it.col()) = it.value();
  15. }
  16. }
  17. }
  18. template <typename DerivedA,typename DerivedB>
  19. IGL_INLINE void igl::full(
  20. const Eigen::PlainObjectBase<DerivedA>& A,
  21. Eigen::PlainObjectBase<DerivedB>& B)
  22. {
  23. B = A;
  24. }
  25. #ifndef IGL_HEADER_ONLY
  26. // Explicit template specialization
  27. // generated by autoexplicit.sh
  28. template void igl::full<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
  29. // generated by autoexplicit.sh
  30. template void igl::full<double>(Eigen::SparseMatrix<double, 0, int> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1>&);
  31. #endif