/******************************************************************************* Title : Linear Network (Mapping) Inputs : 1. Input File Containing Training Data (Infile) 2. No. of Inputs (N) 3. No. of outputs (Nout) Outputs: Mapping Error at each node Notations Used: Nv --> No. of patterns N --> No. of inputs Nout --> No. of outputs x --> Input Vector xa --> Augmented input vector Wb --> I/P to O/P Weights / change: instead of Wo/ d --> Output threshold / change: instead of to/ ty --> Desired output y --> Actual output R --> Auto-correlation matrix C --> Cross-correlation matrix dmean --> desired mean dstd --> desired standard deviation ******************************************************************************** ! IMPORTANT: Significant changes have been made to the program. Have a thorough look at it. *******************************************************************************/ #include #include #include #define PI 3.1415926 #define dmean 0.0 #define dstd 0.5 int IX=3; int IY=4009; int IZ=234; void main(void) { char Infile[14]; FILE *ifs; int i, j; int Nout, N, Nv; float *x, *xa, *ty; double **R, **C; double **Wo, *to, **W; void CGrad(int ,double *, double **,double *); void error(int, int, char *, double **); float slete(float , float ); /* Getting relevant parameters from the user */ printf("Enter input file : "); gets(Infile); printf("Enter the No. of Inputs : "); scanf("%d",&N); printf("Enter the No. of outputs : "); scanf("%d",&Nout); /* Opening the input file in "read" mode */ ifs= fopen(Infile,"r"); /* Checking for the existance of the file */ if (ifs == NULL ) { perror(Infile); exit(1); } /* Allocating Memory dynamically*/ x= (float *)malloc(sizeof(float)*(N)); xa= (float *)malloc(sizeof(float)*(N+1)); ty= (float *)malloc(sizeof(float)*Nout ); to= (double *)malloc(sizeof(double)*Nout ); R= (double **)malloc(sizeof(double *)*(N+1)); C= (double **)malloc(sizeof(double *)*Nout); for (i=0;i numerator of B2 */ Num += p[l]*g[l]/-2.0; /* Den --> denominator of B2 */ for(m=0;m