CUDA Networks
matrix_constructor.cu
Go to the documentation of this file.
1 /**
2  * @file matrix_constructor.cu
3  * @brief Implementation of the Matrix class constructor.
4  */
5 #include "matrix.h"
6 #include <cuda_runtime.h>
7 
8 Matrix::Matrix(int rows, int cols) : rows(rows), cols(cols) {
9  // Allocate memory on the GPU for the matrix data
10  // The size is calculated as rows * cols * sizeof(double)
11  cudaMalloc(&d_data, rows * cols * sizeof(double));
12 }
Matrix(int rows, int cols)
Construct a new Matrix object.
Defines the Matrix class for GPU-accelerated matrix operations.