public LinearFunction(LagGraph lagGraph){
  if (lagGraph == null) {
    throw new NullPointerException("Lag graph must not be null.");
  }
  this.polynomialFunction=new PolynomialFunction(lagGraph);
  IndexedLagGraph connectivity=polynomialFunction.getIndexedLagGraph();
  for (int i=0; i < connectivity.getNumFactors(); i++) {
    List terms=new ArrayList();
    terms.add(new PolynomialTerm(0.0,new int[0]));
    int numParents=connectivity.getNumParents(i);
    for (int j=0; j < numParents; j++) {
      int[] vars=new int[]{j};
      terms.add(new PolynomialTerm(1.0 / (double)numParents,vars));
    }
    Polynomial p=new Polynomial(terms);
    polynomialFunction.setPolynomial(i,p);
  }
}

public LinearFunction ( LagGraph lagGraph ) { if ( lagGraph == null ) { throw new NullPointerException ( "Lag graph must not be null." ) ; } this . polynomialFunction = new PolynomialFunction ( lagGraph ) ; IndexedLagGraph connectivity = polynomialFunction . getIndexedLagGraph ( ) ; for ( int i = 0 ; i < connectivity . getNumFactors ( ) ; i ++ ) { List terms = new ArrayList ( ) ; terms . add ( new PolynomialTerm ( 0.0 , new int [ 0 ] ) ) ; int numParents = connectivity . getNumParents ( i ) ; for ( int j = 0 ; j < numParents ; j ++ ) { int [ ] vars = new int [ ] { j } ; terms . add ( new PolynomialTerm ( 1.0 / ( double ) numParents , vars ) ) ; } Polynomial p = new Polynomial ( terms ) ; polynomialFunction . setPolynomial ( i , p ) ; } }
constructs a polyomial function where each factor is given a zero polynomial .
