Changeset 2046 for trunk/gsdl


Ignore:
Timestamp:
2001-02-22T14:35:03+13:00 (23 years ago)
Author:
jrm21
Message:

Fixed bug that caused perf_hash to fail for lexicon of < 4 words.
Added a #define to increase size of n (for vertices in the graph) as we
need to allocate more memory somewhere else before calling tree_builder()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/packages/mg/lib/perf_hash.c

    r439 r2046  
    3030/*
    3131   $Log$
     32   Revision 1.2  2001/02/22 01:35:03  jrm21
     33   Fixed bug that caused perf_hash to fail for lexicon of < 4 words.
     34   Added a #define to increase size of n (for vertices in the graph) as we
     35   need to allocate more memory somewhere else before calling tree_builder()
     36
    3237   Revision 1.1  1999/08/10 21:16:57  sjboddie
    3338   renamed mg-1.3d directory mg
     
    8590static int MAX_N;
    8691
    87 
     92/* An arbitrary amount to add to both MAX_N and n for building tree/acyclic
     93   graph -- John McPherson - jrm21 (22-02-2001) */
     94#define MAX_N_HEADROOM  100
    8895
    8996
     
    342349  do
    343350    {
    344       *n = (int) (num * c + 1);
     351      /* Added variable - need to increase MAX_N on allocate as well */
     352      *n = (int) (num * c + MAX_N_HEADROOM); /* john mcpherson 22-02-2001 */
     353
    345354      /* initialize tables of random integers */
    346355      for (i = 0; i < MAX_CH; i++)
     
    770779  MAX_M = num + 1;
    771780
    772   MAX_N = MAX_M + MAX_M / 4;
     781  /* For extremely small lexicons (<4 words), this isn't good enough!
     782   -- John McPherson jrm21 22-02-2001 */
     783  /* MAX_N = MAX_M + MAX_M / 4; */
     784  MAX_N = (int)(ceil (1.25 * MAX_M));
     785  /* Add some space for "experimentation" of n in tree_builder() */
     786  MAX_N += MAX_N_HEADROOM;
    773787
    774788  if (allocate_memory () == -1)
Note: See TracChangeset for help on using the changeset viewer.