@@ -63,38 +63,47 @@ namespace af
63
63
initEmptyArray (&arr, ty, d0, d1, d2, d3);
64
64
}
65
65
66
- template <typename T>
67
- array::array (const dim4 &dims, const T *ptr, af_source_t src, dim_type ngfor) : arr(0 ), isRef(false )
68
- {
69
- initDataArray<T>(&arr, ptr, src, dims[0 ], dims[1 ], dims[2 ], dims[3 ]);
70
- }
71
-
72
- template <typename T>
73
- array::array (dim_type d0, const T *ptr, af_source_t src, dim_type ngfor) : arr(0 ), isRef(false )
74
- {
75
- initDataArray<T>(&arr, ptr, src, d0);
76
- }
77
-
78
- template <typename T>
79
- array::array (dim_type d0, dim_type d1, const T *ptr,
80
- af_source_t src, dim_type ngfor) : arr(0 ), isRef(false )
81
- {
82
- initDataArray<T>(&arr, ptr, src, d0, d1);
83
- }
84
-
85
- template <typename T>
86
- array::array (dim_type d0, dim_type d1, dim_type d2, const T *ptr,
87
- af_source_t src, dim_type ngfor) : arr(0 ), isRef(false )
88
- {
89
- initDataArray<T>(&arr, ptr, src, d0, d1, d2);
90
- }
91
-
92
- template <typename T>
93
- array::array (dim_type d0, dim_type d1, dim_type d2, dim_type d3,
94
- const T *ptr, af_source_t src, dim_type ngfor) : arr(0 ), isRef(false )
95
- {
96
- initDataArray<T>(&arr, ptr, src, d0, d1, d2, d3);
97
- }
66
+ #define INSTANTIATE (T ) \
67
+ template <> AFAPI \
68
+ array::array (const dim4 &dims, const T *ptr, af_source_t src, dim_type ngfor) \
69
+ : arr(0 ), isRef(false ) \
70
+ { \
71
+ initDataArray<T>(&arr, ptr, src, dims[0 ], dims[1 ], dims[2 ], dims[3 ]); \
72
+ } \
73
+ template <> AFAPI \
74
+ array::array (dim_type d0, const T *ptr, af_source_t src, dim_type ngfor) \
75
+ : arr(0 ), isRef(false ) \
76
+ { \
77
+ initDataArray<T>(&arr, ptr, src, d0); \
78
+ } \
79
+ template <> AFAPI \
80
+ array::array (dim_type d0, dim_type d1, const T *ptr, af_source_t src, \
81
+ dim_type ngfor) : arr(0 ), isRef(false ) \
82
+ { \
83
+ initDataArray<T>(&arr, ptr, src, d0, d1); \
84
+ } \
85
+ template <> AFAPI \
86
+ array::array (dim_type d0, dim_type d1, dim_type d2, const T *ptr, \
87
+ af_source_t src, dim_type ngfor) : arr(0 ), isRef(false ) \
88
+ { \
89
+ initDataArray<T>(&arr, ptr, src, d0, d1, d2); \
90
+ } \
91
+ template <> AFAPI \
92
+ array::array (dim_type d0, dim_type d1, dim_type d2, dim_type d3, const T *ptr, \
93
+ af_source_t src, dim_type ngfor) : arr(0 ), isRef(false ) \
94
+ { \
95
+ initDataArray<T>(&arr, ptr, src, d0, d1, d2, d3); \
96
+ } \
97
+
98
+ INSTANTIATE (af_cdouble)
99
+ INSTANTIATE (af_cfloat)
100
+ INSTANTIATE (double )
101
+ INSTANTIATE (float )
102
+ INSTANTIATE (unsigned )
103
+ INSTANTIATE (int )
104
+ INSTANTIATE (unsigned char )
105
+ INSTANTIATE (char )
106
+ #undef INSTANTIATE
98
107
99
108
array::~array ()
100
109
{
@@ -376,27 +385,6 @@ namespace af
376
385
return *this ;
377
386
}
378
387
379
- #define INSTANTIATE (T ) \
380
- template array::array<T>(const dim4 &dims, const T *ptr, af_source_t src, dim_type ngfor);\
381
- template array::array<T>(dim_type d0, const T *ptr, af_source_t src, dim_type ngfor);\
382
- template array::array<T>(dim_type d0, dim_type d1, const T *ptr, af_source_t src, dim_type ngfor);\
383
- template array::array<T>(dim_type d0, dim_type d1, dim_type d2, const T *ptr, af_source_t src, dim_type ngfor);\
384
- template array::array<T>(dim_type d0, dim_type d1, dim_type d2, dim_type d3, const T *ptr, af_source_t src, dim_type ngfor);\
385
- template T *array::host<T>() const ;
386
-
387
-
388
- INSTANTIATE (af_cdouble)
389
- INSTANTIATE (af_cfloat)
390
- INSTANTIATE (double )
391
- INSTANTIATE (float )
392
- INSTANTIATE (unsigned )
393
- INSTANTIATE (int )
394
- INSTANTIATE (unsigned char )
395
- INSTANTIATE (char )
396
-
397
- #undef INSTANTIATE
398
-
399
-
400
388
// /////////////////////////////////////////////////////////////////////////
401
389
// Operator +=, -=, *=, /=
402
390
// /////////////////////////////////////////////////////////////////////////
0 commit comments