CUDA Networks
|
Represents a vector with GPU-accelerated operations. More...
#include <vector.h>
Public Member Functions | |
Vector (int rows) | |
Construct a new Vector object. More... | |
~Vector () | |
Destroy the Vector object. More... | |
void | initialize () |
Initialize the vector (typically sets all elements to zero) More... | |
void | randomize () |
Randomize the vector elements with values between -0.5 and 0.5. More... | |
void | print (int decimals) |
Print the vector contents. More... | |
int | get_rows () const |
Get the number of elements in the vector. More... | |
double * | get_data () const |
Get the raw data pointer of the vector. More... | |
Vector | copy () const |
Creates a deep copy of the vector. More... | |
void | multiply_scalar (double scalar) |
Multiplies all elements in the vector by a scalar. More... | |
void | divide_scalar (double scalar) |
Divides all elements in the vector by a scalar. More... | |
void | subtract_scalar (double scalar) |
Subtracts a scalar value from all elements in the vector. More... | |
Vector::Vector | ( | int | rows | ) |
Construct a new Vector object.
rows | Number of elements in the vector |
Definition at line 8 of file vector_constructor.cu.
Vector::~Vector | ( | ) |
Destroy the Vector object.
Definition at line 8 of file vector_destructor.cu.
Vector Vector::copy | ( | ) | const |
Creates a deep copy of the vector.
Definition at line 13 of file vector_copy.cu.
void Vector::divide_scalar | ( | double | scalar | ) |
Divides all elements in the vector by a scalar.
scalar | The scalar to divide by. |
std::invalid_argument | if scalar is exactly zero. |
Definition at line 47 of file vector_divide_scalar.cu.
double * Vector::get_data | ( | ) | const |
Get the raw data pointer of the vector.
Definition at line 7 of file vector_get_data.cu.
int Vector::get_rows | ( | ) | const |
Get the number of elements in the vector.
Definition at line 7 of file vector_get_rows.cu.
void Vector::initialize | ( | ) |
Initialize the vector (typically sets all elements to zero)
Definition at line 8 of file vector_initialize.cu.
void Vector::multiply_scalar | ( | double | scalar | ) |
Multiplies all elements in the vector by a scalar.
scalar | The scalar to multiply by. |
Definition at line 41 of file vector_multiply_scalar.cu.
void Vector::print | ( | int | decimals | ) |
Print the vector contents.
decimals | Number of decimal places to display |
Definition at line 11 of file vector_print.cu.
void Vector::randomize | ( | ) |
Randomize the vector elements with values between -0.5 and 0.5.
Fills the vector with random values between -0.5 and 0.5.
Definition at line 37 of file vector_randomize.cu.
void Vector::subtract_scalar | ( | double | scalar | ) |
Subtracts a scalar value from all elements in the vector.
scalar | The scalar value to subtract. |
Definition at line 41 of file vector_subtract_scalar.cu.