ViennaCL - The Vienna Computing Library  1.2.0
amg_debug.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_LINALG_DETAIL_AMG_AMG_DEBUG_HPP
2 #define VIENNACL_LINALG_DETAIL_AMG_AMG_DEBUG_HPP
3 
4 /* =========================================================================
5  Copyright (c) 2010-2011, Institute for Microelectronics,
6  Institute for Analysis and Scientific Computing,
7  TU Wien.
8 
9  -----------------
10  ViennaCL - The Vienna Computing Library
11  -----------------
12 
13  Project Head: Karl Rupp rupp@iue.tuwien.ac.at
14 
15  (A list of authors and contributors can be found in the PDF manual)
16 
17  License: MIT (X11), see file LICENSE in the base directory
18 ============================================================================= */
19 
26 #include <iostream>
28 
29 #ifdef SMALL_SIZE
30 #define VIENNACL_AMG_MATRIXTYPE boost::numeric::ublas::matrix<ScalarType>
31 #else
32 #define VIENNACL_AMG_MATRIXTYPE MatrixType
33 #endif
34 
35 namespace viennacl
36 {
37  namespace linalg
38  {
39  namespace detail
40  {
41  namespace amg
42  {
43 
44  template <typename MatrixType>
45  void printmatrix(MatrixType & mat, int const value=-1)
46  {
47  typedef typename MatrixType::value_type ScalarType;
48  typedef typename VIENNACL_AMG_MATRIXTYPE::iterator1 InternalRowIterator;
49  typedef typename VIENNACL_AMG_MATRIXTYPE::iterator2 InternalColIterator;
50 
51  #ifdef DEBUG
52  VIENNACL_AMG_MATRIXTYPE mat2 = mat;
53 
54  for (InternalRowIterator row_iter = mat2.begin1(); row_iter != mat2.end1(); ++row_iter)
55  {
56  for (InternalColIterator col_iter = row_iter.begin(); col_iter != row_iter.end(); ++col_iter)
57  {
58  std::cout << *col_iter << " ";
59  }
60  std::cout << std::endl;
61  }
62  std::cout << std::endl;
63  #endif
64  }
65 
66  template <typename VectorType>
67  void printvector(VectorType const & vec)
68  {
69  #ifdef DEBUGBENCH
70  for (typename VectorType::const_iterator iter = vec.begin(); iter != vec.end(); ++iter)
71  {
72  std::cout << *iter << " ";
73  }
74  std::cout << std::endl;
75  #endif
76  }
77 
78  }
79  }
80  }
81 }
82 #endif