예제 #1
0
RBase *constructRBase(
   PermGroup *const G,
   RefinementFamily *const RRR[],
   ReducChkFn *const isReducible[],
   SpecialRefinementDescriptor *const specialRefinement[],
   UnsignedS basicCellSize[],
   ExtraDomain *extra[] )
{
   Unsigned f, h, i, m, pt, sGenCount;
   unsigned long minPriority;
   UnsignedS k[10];
   SplitSize split;
   RefinementPriorityPair refPriPair;
   Refinement bestRefinement;
   RBase *AAA = newRBase( G->degree);
   UnsignedS *const startCell = AAA->PsiStack->startCell,
             *const pointList = AAA->PsiStack->pointList,
             *const omega = AAA->omega;
   Permutation *gen;
   THatWordType tHatWord;

   /* Set tHatWord to a trivial word. */
   tHatWord.invWord = malloc( 8 * sizeof(UnsignedS *) );
   tHatWord.revWord = malloc( 8 * sizeof(UnsignedS *) );
   tHatWord.invWord[0] = tHatWord.revWord[0] = NULL;


   /* Here we trim unnecessary strong generators if so requested. */
   for ( sGenCount = 0 , gen = G->generator ; gen ;
         gen = gen->next )
      ++sGenCount;
   if ( sGenCount > options.trimSGenSetToSize )
        removeRedunSGens( G, 1);

   /* Here we construct the complete orbit structure at the top level. */
   for ( m = 0 ; specialRefinement[m] ; ++m )
      constructAllOrbitInfo( specialRefinement[m]->leftGroup, 1);

   /* Figure 10, lines 3-5. Note newRBase above already initialized
      AAA->PsiStack. */
   for ( i = 0 ; specialRefinement[i] ; ++i )
      k[i] = 0;
   AAA->ell = 0;
   f = 0;
   AAA->n_[0] = 0;
   /* Array f_ not needed.
   AAA->f_[0] = 0;
   AAA->f_[1] = 0; */

      
   for ( m = 0 ; extra[m] ; ++m ) {
      extra[m]->cstExtraRBase( 0);
   }

   /* Figure 10, line 6. */
   for ( h = 1 ; h <= G->degree-1 ; ++ h ) {

      /* Figure 10, line 7. */
      for ( i = 0 , minPriority = IRREDUCIBLE ; isReducible[i] != NULL; ++i ) {
         if ( RRR[i]->refine == orbRefine ) {
            RRR[i]->familyParm_L[1].intParm = k[i] + 1;
            RRR[i]->familyParm_L[2].ptrParm = &tHatWord;
         }
         refPriPair = (isReducible[i])( RRR[i], AAA->PsiStack);
         if ( refPriPair.priority != IRREDUCIBLE && ( refPriPair.priority <
                                minPriority || minPriority == IRREDUCIBLE ) ) {
            minPriority = refPriPair.priority;
            bestRefinement = refPriPair.refn;
         }
      }
      if ( minPriority != IRREDUCIBLE )

         /* Figure 10, lines 8-9. */
         AAA->aAA[h] = bestRefinement;

      /* Figure 10, line 10. */
      else {

         /* Figure 10, lines 12-14.  Line 11 is omitted since an explicit
            representation of Pi is not maintained; note Pi_i = Psi_{n_{i+1}}.*/
         ++AAA->ell;
         AAA->n_[AAA->ell] = h;

         /* Figure 10, lines 15-17.  CAUTION: Note that the second and third
            lines below depend on the numbering of the refinement parameters
            in function pointStabRefine. */
         refPriPair = isPointStabReducible( &ptStabFamily,
                                            AAA->PsiStack, G, AAA, k[0]+1);
         AAA->alphaHat[AAA->ell] = refPriPair.refn.refnParm[0].intParm;
         AAA->p_[AAA->ell] = refPriPair.refn.refnParm[1].intParm;
         AAA->aAA[h] = refPriPair.refn;
         basicCellSize[AAA->ell] =
                 AAA->PsiStack->cellSize[ refPriPair.refn.refnParm[1].intParm ];
      }

      /* Figure 10, line 19. */
      if ( AAA->aAA[h].family->refine == orbRefine ) {
         for ( i = 0 ; specialRefinement[i]->leftGroup !=
               AAA->aAA[h].family->familyParm_L[0].ptrParm ; ++i )
            ;
         AAA->aAA[h].family->familyParm_L[1].intParm = k[i] + 1;
         AAA->aAA[h].family->familyParm_L[2].ptrParm = &tHatWord;
      }
      split = AAA->aAA[h].family->refine( AAA->aAA[h].family->familyParm_L,
                                          AAA->aAA[h].refnParm,
                                          AAA->PsiStack);

      /* Figure 10, lines 20-21. */
      AAA->a_[h] = split.newCellSize;
      AAA->b_[h] = AAA->PsiStack->parent[h+1];

      /* Figure 10, lines 22-27. */
      if ( split.newCellSize == 1 ) {
         omega[++f] = pointList[startCell[h+1]];
         for ( m = 0 ; specialRefinement[m] ; ++m )
            if ( !isFixedPointOf( specialRefinement[m]->leftGroup, k[m]+1,
                                  omega[f]) ) {
               ++k[m];
               insertBasePoint( specialRefinement[m]->leftGroup, k[m],
                                omega[f] );
               for ( sGenCount = 0 , gen = G->generator ; gen ;
                     gen = gen->next )
                  ++sGenCount;
               if ( sGenCount > options.trimSGenSetToSize )
                  removeRedunSGens( G, 1);
               constructAllOrbitInfo( specialRefinement[m]->leftGroup,
                                      k[m] + 1);
               if ( options.compress )
                  compressAtLevel( specialRefinement[m]->leftGroup, k[m]);
            }
      }
      if ( split.oldCellSize == 1 ) {
         omega[++f] = pointList[startCell[AAA->b_[h]]];
         for ( m = 0 ; specialRefinement[m] ; ++m )
            if ( !isFixedPointOf( specialRefinement[m]->leftGroup, k[m]+1,
                                  omega[f]) ) {
               ++k[m];
               insertBasePoint( specialRefinement[m]->leftGroup, k[m],
                                omega[f] );
               for ( sGenCount = 0 , gen = G->generator ; gen ;
                     gen = gen->next )
                  ++sGenCount;
               if ( sGenCount > options.trimSGenSetToSize )
                  removeRedunSGens( G, 1);
               constructAllOrbitInfo( specialRefinement[m]->leftGroup,
                                      k[m] + 1);
               if ( options.compress )
                  compressAtLevel( specialRefinement[m]->leftGroup, k[m]);
            }
      }
      
      for ( m = 0 ; extra[m] ; ++m ) {
         extra[m]->cstExtraRBase( h);
      }

      /* Figure 10, line 28. */
      /* Array f_ not needed.
      AAA->f_[h+1] = f;  */
   }

   /* Figure 10, line 30. */
   AAA->n_[AAA->ell+1] = G->degree;

   AAA->k = k[0];

   /* Create the inverse point list invOmega. */
   AAA->invOmega = allocIntArrayDegree();
   for ( pt = 1 ; pt <= G->degree ; ++pt )
      AAA->invOmega[omega[pt]] = pt;

   /* Add null terminator to alphaHat. */
   AAA->alphaHat[AAA->ell+1] = 0;

   /* Print summary information about R-Base if requested. */
   if ( options.inform )
      informRBase( G, AAA, basicCellSize);

   free(tHatWord.invWord);
   free(tHatWord.revWord);

   /* Return RRR-Base to caller. */
   return AAA;
}
예제 #2
0
uint8_t* Zip::compress(uint8_t* in, size_t inSize, size_t* outSize)
{
    return compressAtLevel(in, inSize, outSize, Z_DEFAULT_COMPRESSION);
}