/*************************************************************************
 Unsets network (initialize it to smallest network possible
 *************************************************************************/
 private static void unsetensemble(ref mlpe.mlpensemble ensemble)
 {
     mlpe.mlpecreate0(1, 1, 1, ref ensemble);
 }
 /*************************************************************************
 Network creation
 *************************************************************************/
 private static void createensemble(ref mlpe.mlpensemble ensemble,
     int nkind,
     double a1,
     double a2,
     int nin,
     int nhid1,
     int nhid2,
     int nout,
     int ec)
 {
     System.Diagnostics.Debug.Assert(nin>0 & nhid1>=0 & nhid2>=0 & nout>0, "CreateNetwork error");
     System.Diagnostics.Debug.Assert(nhid1!=0 | nhid2==0, "CreateNetwork error");
     System.Diagnostics.Debug.Assert(nkind!=1 | nout>=2, "CreateNetwork error");
     if( nhid1==0 )
     {
         
         //
         // No hidden layers
         //
         if( nkind==0 )
         {
             mlpe.mlpecreate0(nin, nout, ec, ref ensemble);
         }
         else
         {
             if( nkind==1 )
             {
                 mlpe.mlpecreatec0(nin, nout, ec, ref ensemble);
             }
             else
             {
                 if( nkind==2 )
                 {
                     mlpe.mlpecreateb0(nin, nout, a1, a2, ec, ref ensemble);
                 }
                 else
                 {
                     if( nkind==3 )
                     {
                         mlpe.mlpecreater0(nin, nout, a1, a2, ec, ref ensemble);
                     }
                 }
             }
         }
         return;
     }
     if( nhid2==0 )
     {
         
         //
         // One hidden layer
         //
         if( nkind==0 )
         {
             mlpe.mlpecreate1(nin, nhid1, nout, ec, ref ensemble);
         }
         else
         {
             if( nkind==1 )
             {
                 mlpe.mlpecreatec1(nin, nhid1, nout, ec, ref ensemble);
             }
             else
             {
                 if( nkind==2 )
                 {
                     mlpe.mlpecreateb1(nin, nhid1, nout, a1, a2, ec, ref ensemble);
                 }
                 else
                 {
                     if( nkind==3 )
                     {
                         mlpe.mlpecreater1(nin, nhid1, nout, a1, a2, ec, ref ensemble);
                     }
                 }
             }
         }
         return;
     }
     
     //
     // Two hidden layers
     //
     if( nkind==0 )
     {
         mlpe.mlpecreate2(nin, nhid1, nhid2, nout, ec, ref ensemble);
     }
     else
     {
         if( nkind==1 )
         {
             mlpe.mlpecreatec2(nin, nhid1, nhid2, nout, ec, ref ensemble);
         }
         else
         {
             if( nkind==2 )
             {
                 mlpe.mlpecreateb2(nin, nhid1, nhid2, nout, a1, a2, ec, ref ensemble);
             }
             else
             {
                 if( nkind==3 )
                 {
                     mlpe.mlpecreater2(nin, nhid1, nhid2, nout, a1, a2, ec, ref ensemble);
                 }
             }
         }
     }
 }