full.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #include "full.h"
  9. template <typename T,typename DerivedB>
  10. IGL_INLINE void igl::full(
  11. const Eigen::SparseMatrix<T> & A,
  12. Eigen::PlainObjectBase<DerivedB>& B)
  13. {
  14. assert(false && "Obsolete. Just call B = Matrix(A)");
  15. using namespace Eigen;
  16. B = PlainObjectBase<DerivedB >::Zero(A.rows(),A.cols());
  17. // Iterate over outside
  18. for(int k=0; k<A.outerSize(); ++k)
  19. {
  20. // Iterate over inside
  21. for(typename SparseMatrix<T>::InnerIterator it (A,k); it; ++it)
  22. {
  23. B(it.row(),it.col()) = it.value();
  24. }
  25. }
  26. }
  27. template <typename DerivedA,typename DerivedB>
  28. IGL_INLINE void igl::full(
  29. const Eigen::PlainObjectBase<DerivedA>& A,
  30. Eigen::PlainObjectBase<DerivedB>& B)
  31. {
  32. assert(false && "Obsolete. Just call B = Matrix(A)");
  33. B = A;
  34. }
  35. #ifdef IGL_STATIC_LIBRARY
  36. // Explicit template specialization
  37. // generated by autoexplicit.sh
  38. 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> >&);
  39. // generated by autoexplicit.sh
  40. 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> >&);
  41. #endif