@@ -75,7 +75,7 @@ namespace librapid {
75
75
public:
76
76
using PtrType = T *;
77
77
78
- CudaRef (const PtrType & ptr, size_t offset) : m_ptr(ptr), m_offset(offset) {}
78
+ CudaRef (PtrType ptr, size_t offset) : m_ptr(ptr), m_offset(offset) {}
79
79
80
80
LIBRAPID_ALWAYS_INLINE CudaRef &operator =(const T &val) {
81
81
cudaSafeCall (cudaMemcpyAsync (
@@ -161,22 +161,18 @@ namespace librapid {
161
161
162
162
// / Create a CudaStorage object from an std::initializer_list
163
163
// / \param list Initializer list of elements
164
- template <typename V>
165
- LIBRAPID_ALWAYS_INLINE CudaStorage (const std::initializer_list<V> &list);
164
+ LIBRAPID_ALWAYS_INLINE CudaStorage (const std::initializer_list<Scalar> &list);
166
165
167
166
// / Create a CudaStorage object from an std::vector of values
168
167
// / \param vec The vector to fill with
169
- template <typename V>
170
- LIBRAPID_ALWAYS_INLINE explicit CudaStorage (const std::vector<V> &vec);
168
+ LIBRAPID_ALWAYS_INLINE explicit CudaStorage (const std::vector<Scalar> &vec);
171
169
172
170
template <typename ShapeType>
173
171
static ShapeType defaultShape ();
174
172
175
- template <typename V>
176
- static CudaStorage fromData (const std::initializer_list<V> &vec);
173
+ static CudaStorage fromData (const std::initializer_list<Scalar> &vec);
177
174
178
- template <typename V>
179
- static CudaStorage fromData (const std::vector<V> &vec);
175
+ static CudaStorage fromData (const std::vector<Scalar> &vec);
180
176
181
177
// / Assignment operator for a CudaStorage object
182
178
// / \param other CudaStorage object to copy
@@ -237,16 +233,6 @@ namespace librapid {
237
233
template <typename P>
238
234
LIBRAPID_ALWAYS_INLINE void initData (P begin, P end);
239
235
240
- // / Resize the Storage Object to \p newSize elements, retaining existing
241
- // / data.
242
- // / \param newSize New size of the Storage object
243
- LIBRAPID_ALWAYS_INLINE void resizeImpl (SizeType newSize, int );
244
-
245
- // / Resize the Storage object to \p newSize elements. Note this does not
246
- // / initialize the new elements or maintain existing data.
247
- // / \param newSize New size of the Storage object
248
- LIBRAPID_ALWAYS_INLINE void resizeImpl (SizeType newSize);
249
-
250
236
Pointer m_begin = nullptr ;
251
237
size_t m_size;
252
238
bool m_ownsData = true ;
@@ -332,21 +318,19 @@ namespace librapid {
332
318
}
333
319
334
320
template <typename T>
335
- template <typename V>
336
- CudaStorage<T>::CudaStorage(const std::initializer_list<V> &list) :
321
+ CudaStorage<T>::CudaStorage(const std::initializer_list<T> &list) :
337
322
m_size (list.size()), m_begin(detail::cudaSafeAllocate<T>(list.size())),
338
323
m_ownsData(true ) {
339
324
cudaSafeCall (cudaMemcpyAsync (
340
325
m_begin, list.begin (), sizeof (T) * m_size, cudaMemcpyHostToDevice, global::cudaStream));
341
326
}
342
327
343
328
template <typename T>
344
- template <typename V>
345
- CudaStorage<T>::CudaStorage(const std::vector<V> &list) :
329
+ CudaStorage<T>::CudaStorage(const std::vector<T> &list) :
346
330
m_size (list.size()), m_begin(detail::cudaSafeAllocate<T>(list.size())),
347
331
m_ownsData(true ) {
348
332
cudaSafeCall (cudaMemcpyAsync (
349
- m_begin, list. begin () , sizeof (T) * m_size, cudaMemcpyHostToDevice, global::cudaStream));
333
+ m_begin, & list[ 0 ] , sizeof (T) * m_size, cudaMemcpyHostToDevice, global::cudaStream));
350
334
}
351
335
352
336
template <typename T>
@@ -356,17 +340,15 @@ namespace librapid {
356
340
}
357
341
358
342
template <typename T>
359
- template <typename V>
360
- auto CudaStorage<T>::fromData(const std::initializer_list<V> &list) -> CudaStorage {
343
+ auto CudaStorage<T>::fromData(const std::initializer_list<T> &list) -> CudaStorage {
361
344
CudaStorage ret;
362
345
// ret.initData(list.begin(), list.end());
363
- ret.initData (static_cast <const V *>(list.begin ()), static_cast <const V *>(list.end ()));
346
+ ret.initData (static_cast <const T *>(list.begin ()), static_cast <const T *>(list.end ()));
364
347
return ret;
365
348
}
366
349
367
350
template <typename T>
368
- template <typename V>
369
- auto CudaStorage<T>::fromData(const std::vector<V> &vec) -> CudaStorage {
351
+ auto CudaStorage<T>::fromData(const std::vector<T> &vec) -> CudaStorage {
370
352
CudaStorage ret;
371
353
// ret.initData(vec.begin(), vec.end());
372
354
ret.initData (&vec[0 ], &vec[0 ] + vec.size ());
0 commit comments