From 0a0699aba70c04e3e6c5847b47cee75025e96255 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Sat, 15 Nov 2008 05:23:15 +0000 Subject: Use stdbool.h, bool, true, false instead of manually defining git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@60 0d43b9a7-5ab2-4d7b-af9d-f64450cef757 --- neural.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'neural.c') diff --git a/neural.c b/neural.c index c3fe5e5..cf03dac 100644 --- a/neural.c +++ b/neural.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -45,8 +46,6 @@ */ #define LOOP_MAX 500000L -#define T 1 /* TRUE */ -#define F 0 /* FALSE */ #define ERR -1 #define MAXPATS 10 /* max number of patterns in data file */ #define IN_X_SIZE 5 /* number of neurodes/row of input layer */ @@ -86,7 +85,7 @@ double avg_out_error[MAXPATS]; /* average error each pattern */ int iteration_count; /* number of passes thru network so far */ int numpats; /* number of patterns in data file */ int numpasses; /* number of training passes through data file */ -int learned; /* flag--if TRUE, network has learned all patterns */ +int learned; /* flag--if true, network has learned all patterns */ static clock_t DoNNetIteration(unsigned long nloops); static void do_mid_forward(int patt); @@ -122,7 +121,7 @@ DoNNET(void) /* const char* context="CPU:NNET"; */ /* Since we never fprintf errors here, we don't need this */ clock_t total_time = 0; int iterations = 0; - static int is_adjusted = FALSE; + static bool is_adjusted = false; static int loops = 1; /* @@ -147,8 +146,8 @@ DoNNET(void) /* ** See if we need to perform self adjustment loop. */ - if (is_adjusted == FALSE) { - is_adjusted = TRUE; + if (is_adjusted == false) { + is_adjusted = true; /* ** Do self-adjustment. This involves initializing the ** # of loops and increasing the loop count until we @@ -196,9 +195,9 @@ while(nloops--) randomize_wts(); zero_changes(); iteration_count=1; - learned = F; + learned = false; numpasses = 0; - while (learned == F) + while (!learned) { for (patt=0; patt= STOP) result = F; - if (tot_out_error[i] >= 16.0) error = T; + if (worst_error >= STOP) result = false; + if (tot_out_error[i] >= 16.0) error = true; } -if (error == T) result = ERR; +if (error) result = ERR; #ifdef DEBUG -- cgit v1.2.3