[math] adding matrix_zero method
This commit is contained in:
@@ -32,6 +32,10 @@ inline void matrix_init_values(matrix_t *self, double *values) {
|
|||||||
memcpy(self->values, values, num_values * sizeof(double));
|
memcpy(self->values, values, num_values * sizeof(double));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void matrix_zero(matrix_t *self) {
|
||||||
|
memset(self->values, 0, self->m * self->n * sizeof(double));
|
||||||
|
}
|
||||||
|
|
||||||
inline void matrix_set(matrix_t *self, double value) {
|
inline void matrix_set(matrix_t *self, double value) {
|
||||||
double_array_set(self->values, self->m * self->n, value);
|
double_array_set(self->values, self->m * self->n, value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ matrix_t *matrix_copy(matrix_t *self);
|
|||||||
|
|
||||||
void matrix_init_values(matrix_t *self, double *values);
|
void matrix_init_values(matrix_t *self, double *values);
|
||||||
void matrix_set(matrix_t *self, double value);
|
void matrix_set(matrix_t *self, double value);
|
||||||
|
void matrix_zero(matrix_t *self);
|
||||||
void matrix_set_row(matrix_t *self, size_t index, double *row);
|
void matrix_set_row(matrix_t *self, size_t index, double *row);
|
||||||
void matrix_set_scalar(matrix_t *self, size_t row_index, size_t col_index, double value);
|
void matrix_set_scalar(matrix_t *self, size_t row_index, size_t col_index, double value);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user