ViennaCL - The Vienna Computing Library: viennacl/linalg/detail/amg/amg_debug.hpp Source File

ViennaCL - The Vienna Computing Library 1.6.2 Free open-source GPU-accelerated linear algebra and solver library. |

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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>
28 #include "viennacl/io/matrix_market.hpp"
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 MatrixT>
47 void printmatrix(MatrixT & mat, int const value=-1)
48 {
49 typedef typename MatrixT::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 VectorT>
67 void printvector(VectorT const & vec)
68 {
69 for (typename VectorT::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 MatrixT>
77 void printmatrix(MatrixT &, int) {}
78
79 template<typename VectorT>
80 void printvector(VectorT const &) {}
81
82 #endif
83
84
85 }
86 }
87 }
88 }
89 #endif
matrix_market.hpp
A reader and writer for the matrix market format is implemented here.
VIENNACL_AMG_MATRIXTYPE
#define VIENNACL_AMG_MATRIXTYPE
Definition: amg_debug.hpp:33
viennacl::linalg::detail::amg::printvector
void printvector(VectorT const &)
Definition: amg_debug.hpp:80
ScalarType
float ScalarType
Definition: fft_1d.cpp:42
viennacl::linalg::detail::amg::printmatrix
void printmatrix(MatrixT &, int)
Definition: amg_debug.hpp:77