cheshirekow  v0.1.0
iostream.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Josh Bialkowski (jbialk@mit.edu)
3  *
4  * This file is part of mpblocks.
5  *
6  * mpblocks is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * mpblocks is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with mpblocks. If not, see <http://www.gnu.org/licenses/>.
18  */
27 #ifndef MPBLOCKS_CUDA_LINALG_IOSTREAM_H_
28 #define MPBLOCKS_CUDA_LINALG_IOSTREAM_H_
29 
30 #include <iostream>
31 #include <cstdio>
32 #include <iomanip>
33 
34 namespace mpblocks {
35 namespace cuda {
36 namespace linalg {
37 
38 template <typename Scalar, class Mat>
39 std::ostream& operator<<( std::ostream& out, RValue<Scalar,Mat> const& M)
40 {
41  for(int i=0; i < M.rows(); i++)
42  {
43  for(int j=0; j < M.cols(); j++)
44  {
45  out << std::setw(8)
46  << std::setiosflags(std::ios::fixed)
47  << std::setprecision(4) << M(i,j);
48  }
49  out << "\n";
50  }
51 
52  return out;
53 }
54 
55 
56 
57 
58 
59 
60 } // linalg
61 } // cuda
62 } // mpblocks
63 
64 
65 
66 
67 
68 
69 
70 
71 
72 #endif // IOSTREAM_H_