| 322 | } |
| 323 | |
| 324 | void copy( |
| 325 | const std::shared_ptr<Array>& dst, |
| 326 | const std::shared_ptr<const Array>& src) { |
| 327 | if (dst->shape().size() != src->shape().size()) { |
| 328 | throw std::runtime_error("Array::copy: src and dst sizes must match"); |
| 329 | } |
| 330 | if (dst->itemsize() != src->itemsize()) { |
| 331 | throw std::runtime_error("Array::copy: src and dst itemsize must match"); |
| 332 | } |
| 333 | |
| 334 | size_t size = src->size() * src->itemsize(); |
| 335 | memcpy(dst->data(), src->data(), size); |
| 336 | } |
| 337 | |
| 338 | template <class T> |
| 339 | void array_copy_linear_to_strided( |