bridge/class-master/depend/pari/src/basemath/qfisom.c
/* the heart of the program: the recursion */
the heart of the program: the recursion
the heart of the program : the recursion
static long
iso(long step, GEN x, GEN C, struct qfauto *qf, struct qfauto *qff,
    struct fingerprint *fp, GEN G, struct qfcand *cand)
{
  int  i, Maxfail;
  GEN H;
  long dim = qf->dim;
  long found = 0;
  while (mael(C,step,1) != 0  &&  found == 0)
  {
    if (step < dim)
    {
      long nbc;
      x[step] = mael(C,step,1);
      nbc = qfisom_candidates(gel(C,step+1), step+1, x, qf, qff, fp, cand);
      if (nbc == fp->diag[step+1])
      {
        Maxfail = 0;
        for (i = 1; i <= step; ++i)
          if (fp->diag[i] > 1)
            Maxfail += 1;
        for (i = step+1; i <= dim; ++i)
          if (fp->diag[i] > 1)
            Maxfail += 2;
        H = isostab(x[step], G, qff->V, Maxfail,qff->p);
        found = iso(step+1, x, C, qf, qff, fp, H, cand);
      }
      if (found == 1)
        return 1;
      orbsubtract(gel(C,step), x, step-1, 1, G, qff->V, NULL);
    }
    else
    {
      x[dim] = mael(C,dim,1);
      found = 1;
    }
  }
  return found;
}
static long iso ( long step , GEN x , GEN C , struct qfauto * qf , struct qfauto * qff , struct fingerprint * fp , GEN G , struct qfcand * cand ) { int i , Maxfail ; GEN H ; long dim = qf -> dim ; long found = 0 ; while ( mael ( C , step , 1 ) != 0 && found == 0 ) { if ( step < dim ) { long nbc ; x [ step ] = mael ( C , step , 1 ) ; nbc = qfisom_candidates ( gel ( C , step + 1 ) , step + 1 , x , qf , qff , fp , cand ) ; if ( nbc == fp -> diag [ step + 1 ] ) { Maxfail = 0 ; for ( i = 1 ; i <= step ; ++ i ) if ( fp -> diag [ i ] > 1 ) Maxfail += 1 ; for ( i = step + 1 ; i <= dim ; ++ i ) if ( fp -> diag [ i ] > 1 ) Maxfail += 2 ; H = isostab ( x [ step ] , G , qff -> V , Maxfail , qff -> p ) ; found = iso ( step + 1 , x , C , qf , qff , fp , H , cand ) ; } if ( found == 1 ) return 1 ; orbsubtract ( gel ( C , step ) , x , step - 1 , 1 , G , qff -> V , NULL ) ; } else { x [ dim ] = mael ( C , dim , 1 ) ; found = 1 ; } } return found ; }
the heart of the program: the recursion
the heart of the program : the recursion
/* choose the image of the base-vector nr. step */ /* check whether x[0]...x[step] is a partial automorphism and compute the
         candidates for x[step+1] */ /* go deeper into the recursion */ /* determine the heuristic value of Maxfail for the break condition in
           isostab */ /* compute the stabilizer H of x[step] in G */ /* delete the orbit of the chosen vector from the list of candidates */ /* an isomorphism is found */