25 Matrix(
int rows,
int cols);
72 void print(
int decimals);
118 void preview_image(
int row_index,
int image_size_x,
int image_size_y)
const;
Represents a matrix with GPU-accelerated operations.
int get_rows() const
Get the number of rows in the matrix.
void divide_scalar(double scalar)
Divides all elements in the matrix by a scalar.
void read_csv(const char *filename)
Read data from a CSV file into the matrix.
Matrix sigmoid_derivative() const
Applies the derivative of the sigmoid activation function to the matrix.
void add_vector(const Vector &v)
Adds a vector to each column of the matrix.
Matrix sigmoid() const
Applies the sigmoid activation function to the matrix.
double * get_data() const
Get the raw data pointer of the matrix.
int get_cols() const
Get the number of columns in the matrix.
Matrix & operator=(const Matrix &other)
Copy assignment operator.
Matrix multiply_elementwise(const Matrix &other) const
Performs element-wise multiplication with another matrix.
void print(int decimals)
Print the matrix contents.
Vector argmax() const
Computes the argmax of each column in the matrix.
Matrix(int rows, int cols)
Construct a new Matrix object.
Matrix transpose() const
Transposes the matrix and returns a new Matrix object.
Matrix copy() const
Creates a deep copy of the matrix.
Matrix subtract(const Matrix &other) const
Subtracts another matrix from this matrix.
void read_csv_limited(const char *filename, int startRow, int endRow, int fileRows, int fileCols)
Read a subset of data from a CSV file into the matrix.
void initialize()
Initialize the matrix (typically sets all elements to zero)
~Matrix()
Destroy the Matrix object.
Matrix select_batch(int start_row, int end_row, int start_col, int end_col) const
Selects a subset of the matrix based on specified row and column ranges.
Matrix multiply(const Matrix &other) const
Multiplies this matrix with another matrix.
Matrix relu_derivative() const
Applies the derivative of the ReLU activation function to the matrix.
Matrix relu() const
Applies the ReLU activation function to the matrix.
void randomize()
Randomize the matrix elements with values between -0.5 and 0.5.
double sum() const
Sums all elements in the matrix.
void multiply_scalar(double scalar)
Multiplies all elements in the matrix by a scalar.
Matrix softmax() const
Applies the softmax function to the matrix column-wise.
void preview_image(int row_index, int image_size_x, int image_size_y) const
Preview a single image from the matrix.
Represents a vector with GPU-accelerated operations.
Defines the Vector class for GPU-accelerated vector operations.