CUDA Networks
src
linear_algebra
vector_copy.cu
Go to the documentation of this file.
1
/**
2
* @file vector_copy.cu
3
* @brief Implementation of the copy method for vectors.
4
*/
5
6
#include "
vector.h
"
7
#include <cuda_runtime.h>
8
9
/**
10
* @brief Creates a deep copy of the vector.
11
* @return A new Vector object with the same content as the original.
12
*/
13
Vector
Vector::copy
()
const
{
14
// Create a new vector with the same number of rows
15
Vector
result(rows);
16
17
// Copy the data from the current vector to the new vector
18
cudaMemcpy(result.d_data, d_data, rows *
sizeof
(
double
), cudaMemcpyDeviceToDevice);
19
20
// Return the new vector
21
return
result;
22
}
Vector
Represents a vector with GPU-accelerated operations.
Definition:
vector.h:13
Vector::copy
Vector copy() const
Creates a deep copy of the vector.
Definition:
vector_copy.cu:13
vector.h
Defines the Vector class for GPU-accelerated vector operations.
Generated by
1.9.1