From 3bdd4c480791a2e9a1b753ae9e9948552a26af53 Mon Sep 17 00:00:00 2001 From: vikshar <77307545+domo5581@users.noreply.github.com> Date: Fri, 29 Nov 2024 12:30:05 -0600 Subject: [PATCH] fixes stuff --- snn.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/snn.c b/snn.c index 4e40ce6..c30e029 100644 --- a/snn.c +++ b/snn.c @@ -52,7 +52,11 @@ Layer* createlayer(Layer* lprev, Layer* lnext, int neurons, gsl_matrix* nvalues) self->weights = gsl_matrix_calloc(lnext->neurons, neurons); self->biases = gsl_matrix_calloc(lnext->neurons, 1); // make the matrix have uniform random values from -0.5 to 0.5 - gsl_matrix_set_all(self->weights, uniformrandom(-0.5, 0,5)); + for (unsigned int i = 0; i < self->weights->size1; ++i) { + for (unsigned int j = 0; j < self->weights->size2; ++j) { + gsl_matrix_set(self->weights, i, j, uniformrandom(-0.5, 0.5)); + } + } return self; } @@ -76,7 +80,7 @@ void forwardprop(Layer* layer) { } double matrixsum(gsl_matrix* matrix) { - double result; + double result = 0.0; for (unsigned int i = 0; i < matrix->size1; i++) { for (unsigned int j = 0; j < matrix->size2; j++) { result += gsl_matrix_get(matrix, i, j);