bridge/class-master/depend/pari/src/modules/mpqs.c
/* sieve array constructor;  also allocates the candidates array, the
 * histograms, and temporary storage for relations under construction */
sieve array constructor;  also allocates the candidates array, the
histograms, and temporary storage for relations under construction
sieve array constructor ; also allocates the candidates array the histograms and temporary storage for relations under construction
static void
mpqs_sieve_array_ctor(mpqs_handle_t *h)
{
  long size = (h->M << 1) + 1;
  mpqs_int32_t size_of_FB = h->size_of_FB;
  h->sieve_array = (unsigned char *) pari_malloc(size * sizeof(unsigned char));
  h->sieve_array_end = h->sieve_array + size - 2;
  h->sieve_array_end[1] = 255; 
  h->candidates = (long *)pari_malloc(MPQS_CANDIDATE_ARRAY_SIZE * sizeof(long));
  if (size_of_FB > 60) size_of_FB = 60;
  h->relations = (char *) pari_malloc((8 + size_of_FB * 9) * sizeof(char));
  h->relaprimes = (long *) pari_malloc((size_of_FB << 1) * sizeof(long));
#ifdef MPQS_USE_HISTOGRAMS
  if (h->size_of_FB > MPQS_MIN_SIZE_FB_FOR_HISTO) {
    h->do_histograms = 1;
    h->histo_full = (long *) pari_calloc(128 * sizeof(long));
    h->histo_lprl = (long *) pari_calloc(128 * sizeof(long));
    h->histo_drop = (long *) pari_calloc(128 * sizeof(long));
  }
#endif
}
static void mpqs_sieve_array_ctor ( mpqs_handle_t * h ) { long size = ( h -> M << 1 ) + 1 ; mpqs_int32_t size_of_FB = h -> size_of_FB ; h -> sieve_array = ( unsigned char * ) pari_malloc ( size * sizeof ( unsigned char ) ) ; h -> sieve_array_end = h -> sieve_array + size - 2 ; h -> sieve_array_end [ 1 ] = 255 ; h -> candidates = ( long * ) pari_malloc ( MPQS_CANDIDATE_ARRAY_SIZE * sizeof ( long ) ) ; if ( size_of_FB > 60 ) size_of_FB = 60 ; h -> relations = ( char * ) pari_malloc ( ( 8 + size_of_FB * 9 ) * sizeof ( char ) ) ; h -> relaprimes = ( long * ) pari_malloc ( ( size_of_FB << 1 ) * sizeof ( long ) ) ; #ifdef MPQS_USE_HISTOGRAMS if ( h -> size_of_FB > MPQS_MIN_SIZE_FB_FOR_HISTO ) { h -> do_histograms = 1 ; h -> histo_full = ( long * ) pari_calloc ( 128 * sizeof ( long ) ) ; h -> histo_lprl = ( long * ) pari_calloc ( 128 * sizeof ( long ) ) ; h -> histo_drop = ( long * ) pari_calloc ( 128 * sizeof ( long ) ) ; } #endif }
sieve array constructor;  also allocates the candidates array, the
 histograms, and temporary storage for relations under construction
sieve array constructor ; also allocates the candidates array the histograms and temporary storage for relations under construction
/* sentinel */ /* Room needed for string representation of a relation - worst case:
   * + leading " 1 1"
   * + trailing " 0\n" with final NUL character
   * + in between up to size_of_FB pairs each consisting of an exponent, a
   *   subscript into FB, and two spaces.
   * Subscripts into FB fit into 5 digits, and exponents fit into 3 digits
   * with room to spare -- anything needing 3 or more digits for the
   * subscript must come with an exponent of at most 2 digits. Moreover the
   * product of the first 58 primes is larger than 10^110  (and the righthand
   * sides of proto-relations are much smaller than kN: on the order of
   * M*sqrt(kN)),  so there cannot be more than 60 pairs in all, even if
   * size_of_FB > 10^5. --GN */ /* whereas mpqs_self_init() uses size_of_FB+1, we just use the size as
   * it is, not counting FB[1], to start off the following estimate */ /* and for tracking which primes occur in the current relation: */ /* histograms to be used only when kN isn't very small */