full.cpp 1.2 KB

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