/*
1-hidden layer only
if use elliott's function, define in the main code:
   #define sig(x) x/(1.0 + fabs(x))
   #define dsig(x) (1.0 - fabs(x))* (1.0 - fabs(x))
 
if use logistic function, define in the main code:
   #define sig(x) 1/(1.0 + exp(-x))
   #define dsig(x) (x - x*x)
*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include <math.h>
#include "nrutil.h"
#include <stdio.h>
#define sig(x) x/(1.0 + fabs(x))


void matvec();
void vecmat();

void feedf1(w0,w1,x,y,x1)
 
/* feedforward for net
w0: weight matrix from 0th layer, PxNP1
w1: weight matrix from 1st layer, RxPP1
x: input
x1: output of hidden layer
y: output of output layer
*/
 
float **w0,**w1,*x,*y,*x1;
{
 
  int i;
  float *s1;
  extern int NP1,P,PP1,Q,R;
  s1  =  vector(1,P);

  x[NP1] =1.0;
  x1[PP1] =1.0;

  matvec(w0,x,s1,P,NP1);
  for(i = 1;i <= P;i++)
    x1[i] = sig(s1[i]);
/* x1[PP1] is a constant used for bias weight  */
 
  matvec(w1,x1,y,R,PP1);

  free_vector(s1,1,P);
}




