cheshirekow  v0.1.0
StreamAssignment.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_STREAMASSIGNMENT_H_
28 #define MPBLOCKS_CUDA_LINALG_STREAMASSIGNMENT_H_
29 
30 #include <iostream>
31 #include <cassert>
32 
33 namespace mpblocks {
34 namespace cuda {
35 namespace linalg {
36 
37 
38 
40 template <class Mat>
42 {
43  public:
45 
46  private:
47  Mat& m_mat;
48  unsigned int m_i;
49 
50  public:
52  StreamAssignment( Mat& M ):
53  m_mat(M),
54  m_i(0)
55  {}
56 
57  template <typename Format_t>
59  Stream_t& operator<<( Format_t x )
60  {
61  m_mat[m_i++] = x;
62  return *this;
63  }
64 
65  template <typename Format_t>
67  Stream_t& operator,( Format_t x )
68  {
69  m_mat[m_i++] = x;
70  return *this;
71  }
72 };
73 
74 
75 
76 
77 
78 
79 
80 
81 } // linalg
82 } // cuda
83 } // mpblocks
84 
85 
86 
87 
88 
89 #endif // LINALG_H_
__device__ __host__ Stream_t & operator<<(Format_t x)
__device__ __host__ StreamAssignment(Mat &M)
__device__ __host__ Stream_t & operator,(Format_t x)
#define __device__
Definition: fakecuda.h:34
#define __host__
Definition: fakecuda.h:37