curfil  ..
 All Classes Functions Variables Typedefs Friends Groups Pages
test_common.h
1 #ifndef CURFIL_TEST_COMMON_H
2 #define CURFIL_TEST_COMMON_H
3 
4 #include <cuv/ndarray.hpp>
5 
6 template<class W>
7 std::vector<const W*> getPointers(const std::vector<W>& v) {
8  std::vector<const W*> r(v.size());
9  for (size_t i = 0; i < v.size(); i++) {
10  r[i] = &v[i];
11  }
12  return r;
13 }
14 
15 template<class V>
16 bool operator==(const cuv::ndarray<V, cuv::host_memory_space>& a,
18 
19  if (a.ndim() != b.ndim()) {
20  return false;
21  }
22 
23  if (a.shape() != b.shape()) {
24  return false;
25  }
26 
27  for (size_t i = 0; i < a.size(); i++) {
28  if (a.ptr()[i] != b.ptr()[i]) {
29  return false;
30  }
31  }
32 
33  return true;
34 }
35 
36 #endif