ViennaCL - The Vienna Computing Library  1.5.2
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-2014, Institute for Microelectronics,
6  Institute for Analysis and Scientific Computing,
7  TU Wien.
8  Portions of this software are copyright by UChicago Argonne, LLC.
9 
10  -----------------
11  ViennaCL - The Vienna Computing Library
12  -----------------
13 
14  Project Head: Karl Rupp rupp@iue.tuwien.ac.at
15 
16  (A list of authors and contributors can be found in the PDF manual)
17 
18  License: MIT (X11), see file LICENSE in the base directory
19 ============================================================================= */
20 
27 #include <iostream>
29 
30 #ifdef SMALL_SIZE
31 #define VIENNACL_AMG_MATRIXTYPE boost::numeric::ublas::matrix<ScalarType>
32 #else
33 #define VIENNACL_AMG_MATRIXTYPE MatrixType
34 #endif
35 
36 namespace viennacl
37 {
38  namespace linalg
39  {
40  namespace detail
41  {
42  namespace amg
43  {
44 
45 #ifdef VIENNACL_AMG_DEBUG
46  template <typename MatrixType>
47  void printmatrix(MatrixType & mat, int const value=-1)
48  {
49  typedef typename MatrixType::value_type ScalarType;
50  typedef typename VIENNACL_AMG_MATRIXTYPE::iterator1 InternalRowIterator;
51  typedef typename VIENNACL_AMG_MATRIXTYPE::iterator2 InternalColIterator;
52 
53  VIENNACL_AMG_MATRIXTYPE mat2 = mat;
54 
55  for (InternalRowIterator row_iter = mat2.begin1(); row_iter != mat2.end1(); ++row_iter)
56  {
57  for (InternalColIterator col_iter = row_iter.begin(); col_iter != row_iter.end(); ++col_iter)
58  {
59  std::cout << *col_iter << " ";
60  }
61  std::cout << std::endl;
62  }
63  std::cout << std::endl;
64  }
65 
66  template <typename VectorType>
67  void printvector(VectorType const & vec)
68  {
69  for (typename VectorType::const_iterator iter = vec.begin(); iter != vec.end(); ++iter)
70  {
71  std::cout << *iter << " ";
72  }
73  std::cout << std::endl;
74  }
75 #else
76  template <typename MatrixType>
77  void printmatrix(MatrixType &, int) {}
78 
79  template <typename VectorType>
80  void printvector(VectorType const &) {}
81 
82 #endif
83 
84 
85  }
86  }
87  }
88 }
89 #endif
A reader and writer for the matrix market format is implemented here.
void printmatrix(MatrixType &, int)
Definition: amg_debug.hpp:77
#define VIENNACL_AMG_MATRIXTYPE
Definition: amg_debug.hpp:33
void printvector(VectorType const &)
Definition: amg_debug.hpp:80