#ifndef _NEURON_UTIL_H_ #define _NEURON_UTIL_H #include "general.h" /* Definition of a neuron */ /* Among the members of the following structure, */ /* Ninp strands for a number of input from neurons. */ struct NEURON { double output; /* Output values of this neuron */ int Ninp; /* Number of input neurons */ double *inp_wgt; /* array of input weights */ struct NEURON **inp_neuron; /* the pointer to the input neurons */ double (*output_func)(); /* the pointer to the output function */ double (*Doutput_func)(); /* the pointer to the differenctial above */ }; typedef struct NEURON neuron; /* McCallogh and Pitts' formal neuron */ double formal_f(double state); /* Logistic function $f(x)=1/(1+ exp(-x))$ */ double logistic_f(double state); double Dlogistic_f(double state); /* Hyperbolic function $f(x)= 1/2 * ( tanh(x) + 1) */ double hyperbolic_f(double state); double Dhyperbolic_f(double state); /* liner output function */ double liner_f(double state); double Dliner_f(double state); /* initialize a neuron which has N inputs */ void initialize_neuron(neuron *a, int N, double (*output_func)(), double (*Doutput_func)()); /* copy whole contents from a to b */ void copy_neuron(neuron *a, neuron *b); void calc_neuron (neuron *a); void update_wgt(neuron *a, double error); #endif /* !_NEURON_UTIL_H */