ViennaCL - The Vienna Computing Library  1.5.2
viennacl/linalg/detail/amg/amg_debug.hpp
Go to the documentation of this file.
00001 #ifndef VIENNACL_LINALG_DETAIL_AMG_AMG_DEBUG_HPP
00002 #define VIENNACL_LINALG_DETAIL_AMG_AMG_DEBUG_HPP
00003 
00004 /* =========================================================================
00005    Copyright (c) 2010-2014, Institute for Microelectronics,
00006                             Institute for Analysis and Scientific Computing,
00007                             TU Wien.
00008    Portions of this software are copyright by UChicago Argonne, LLC.
00009 
00010                             -----------------
00011                   ViennaCL - The Vienna Computing Library
00012                             -----------------
00013 
00014    Project Head:    Karl Rupp                   rupp@iue.tuwien.ac.at
00015 
00016    (A list of authors and contributors can be found in the PDF manual)
00017 
00018    License:         MIT (X11), see file LICENSE in the base directory
00019 ============================================================================= */
00020 
00027 #include <iostream>
00028 #include "viennacl/io/matrix_market.hpp"
00029 
00030 #ifdef SMALL_SIZE
00031 #define VIENNACL_AMG_MATRIXTYPE boost::numeric::ublas::matrix<ScalarType>
00032 #else
00033 #define VIENNACL_AMG_MATRIXTYPE MatrixType
00034 #endif
00035 
00036 namespace viennacl
00037 {
00038   namespace linalg
00039   {
00040     namespace detail
00041     {
00042       namespace amg
00043       {
00044 
00045 #ifdef VIENNACL_AMG_DEBUG
00046         template <typename MatrixType>
00047         void printmatrix(MatrixType & mat, int const value=-1)
00048         {
00049           typedef typename MatrixType::value_type ScalarType;
00050           typedef typename VIENNACL_AMG_MATRIXTYPE::iterator1 InternalRowIterator;
00051           typedef typename VIENNACL_AMG_MATRIXTYPE::iterator2 InternalColIterator;
00052 
00053           VIENNACL_AMG_MATRIXTYPE mat2 = mat;
00054 
00055           for (InternalRowIterator row_iter = mat2.begin1(); row_iter != mat2.end1(); ++row_iter)
00056           {
00057             for (InternalColIterator col_iter = row_iter.begin(); col_iter != row_iter.end(); ++col_iter)
00058             {
00059               std::cout << *col_iter << " ";
00060             }
00061             std::cout << std::endl;
00062           }
00063           std::cout << std::endl;
00064         }
00065 
00066         template <typename VectorType>
00067         void printvector(VectorType const & vec)
00068         {
00069           for (typename VectorType::const_iterator iter = vec.begin(); iter != vec.end(); ++iter)
00070           {
00071             std::cout << *iter << " ";
00072           }
00073           std::cout << std::endl;
00074         }
00075 #else
00076         template <typename MatrixType>
00077         void printmatrix(MatrixType &, int) {}
00078 
00079         template <typename VectorType>
00080         void printvector(VectorType const &) {}
00081 
00082 #endif
00083 
00084 
00085       }
00086     }
00087   }
00088 }
00089 #endif