plot_vector.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef IGL_PLOT_VECTOR_H
  2. #define IGL_PLOT_VECTOR_H
  3. #include <iostream>
  4. namespace igl
  5. {
  6. // Not clear what these are supposed to be doing. Currently they print
  7. // vectors to standard error...
  8. template <typename T>
  9. inline void plot_vector( std::vector<T>& v);
  10. template <typename T>
  11. inline void plot_vector( std::vector< std::vector<T> >& v);
  12. template <typename T>
  13. inline void plot_vector( std::vector< std::vector< std::vector<T> > >& v);
  14. }
  15. // Implementation
  16. template <typename T>
  17. inline void igl::plot_vector( std::vector<T>& v)
  18. {
  19. for (int i=0; i<v.size(); ++i)
  20. std::cerr << v[i] << " ";
  21. std::cerr << std::endl;
  22. }
  23. template <typename T>
  24. inline void igl::plot_vector( std::vector< std::vector<T> >& v)
  25. {
  26. for (int i=0; i<v.size(); ++i)
  27. {
  28. std::cerr << i << ": ";
  29. for (int j=0; j<v[i].size(); ++j)
  30. std::cerr << v[i][j] << " ";
  31. std::cerr << std::endl;
  32. }
  33. }
  34. template <typename T>
  35. inline void igl::plot_vector( std::vector< std::vector< std::vector<T> > >& v)
  36. {
  37. for (int m=0; m<v.size(); ++m)
  38. {
  39. std::cerr << "Matrix " << m << std::endl;
  40. for (int i=0; i<v[m].size(); ++i)
  41. {
  42. std::cerr << i << ": ";
  43. for (int j=0; j<v[m][i].size(); ++j)
  44. std::cerr << v[m][i][j] << " ";
  45. std::cerr << std::endl;
  46. }
  47. std::cerr << "---- end " << m << std::endl;
  48. }
  49. }
  50. #endif