GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
1/**************************************************************************23util0.c4Colin Ramsay ([email protected])520 Dec 0067ADVANCED COSET ENUMERATOR, Version 3.00189Copyright 200010Centre for Discrete Mathematics and Computing,11Department of Mathematics and12Department of Computer Science & Electrical Engineering,13The University of Queensland, QLD 4072.14(http://staff.itee.uq.edu.au/havas)1516These are some utilities for Level 0 of ACE.1718**************************************************************************/1920#include "al0.h"2122/******************************************************************23We seem to need sys/types.h & time.h (for the system call time()).24On other flavours of Unix, we might need sys/time.h.25******************************************************************/2627#include <sys/types.h>28#include <time.h>2930/******************************************************************31char *al0_date(void)3233Gets the system date/time, and converts it to ASCII string. Note34that this includes a trailing '\n'.35******************************************************************/3637char *al0_date(void)38{39time_t t = time(NULL);40return ctime(&t);41}4243/******************************************************************44double al0_clock(void)4546clock() returns the actual cpu time used, in seconds, since this47process started. It's equivalent to the `user' time in the `time'48system command. Type clock_t is usually defined as a (signed)49long, but seems to actually be a 32-bit unsigned - we try our best50to preserve all information over a variety of machines! Note that5164-bit machines may sign extend, hence the truncation.52CLOCKS_PER_SEC (usually 1000000, but may be 100 on a PC) converts53clock() to seconds. Note that, even if CLOCKS_PER_SECOND > 100,54resolution may only be 10mS (i.e., 100Hz system clock).55******************************************************************/5657double al0_clock(void)58{59unsigned long ulc = 0xffffffffUL & (unsigned long)clock();6061return (double)ulc/(double)CLOCKS_PER_SEC;62}6364/******************************************************************65double al0_diff(double c1, double c2)6667We assume that c1/c2 are values from al0_clock(). This routine68finds the difference between two times, by assuming that either 069or 1 `overflow' has taken place. double's are used for all timing70to allow (long) times to be properly processed. Provided that the71run is `short' (w.r.t. to the normal rollover interval of 71m35s)72or that progress messages are output `frequently', then the73difference will be correct. On long runs with few messages, then74the difference may be incorrect.75******************************************************************/767778double al0_diff(double c1, double c2)79{80double clkroll = ((double)65536*(double)65536)/(double)CLOCKS_PER_SEC;8182if (c2 >= c1)83{ return (c2-c1); }84else85{ return (clkroll - c1 + c2); }86}8788/******************************************************************89void al0_init(void)9091One-off initialisation of the Level 0 stuff. Ensures a valid92initial state, and sets defaults (default setting is roughly93equivalent to the "def" option of Level 2). Does _not_ allocate /94free memory, so it's up to the user (in practice, usually the Level951 wrapper routines) to make sure memory's allocated and to properly96free it to prevent memory leakage. It's not really necessary to97set _everything_ here, but we do anyway, since we adhere to the98P^3 Principle (ie, paranoia prevents problems)!99******************************************************************/100101void al0_init(void)102{103fop = stdout;104fip = stdin;105setvbuf(stdout, NULL, _IOLBF, 0); /* line buffer o/p */106107begintime = endtime = deltatime = totaltime = 0.0;108msgctrl = msghol = FALSE;109msgincr = msgnext = -1;110111mendel = FALSE;112rfill = TRUE;113pcomp = FALSE;114115maxrow = 0;116rfactor = 200;117cfactor = 1000;118comppc = 10;119nrinsgp = 0;120lahead = 1;121122tlimit = -1;123hlimit = -1;124llimit = lcount = 0;125126nalive = maxcos = totcos = 1;127128chead = ctail = 0;129130pdefn = pdsiz = 0;131ffactor = 0.0;132pdqcol = pdqrow = NULL;133toppd = botpd = 0;134135dedsiz = 0;136dedrow = dedcol = NULL;137topded = -1;138dedmode = 0;139disded = FALSE;140141edp = edpbeg = edpend = NULL;142143ncol = 0;144colptr = NULL;145col1ptr = col2ptr = NULL;146invcol = NULL;147148ndrel = 0;149relind = relexp = rellen = relators = NULL;150151nsgpg = 0;152subggen = subgindex = subglength = NULL;153sgdone = FALSE;154155knr = knh = 1;156nextdf = 2;157}158159/******************************************************************160Logic al0_compact(void)161162Remove unused rows from the coset table, by closing up all used163rows to the front. (This is _not_ the same as putting the table164into its canonic form!) To maintain data-structure consistency,165the pdq is cleared & any stored deductions/coincidences should be166discarded. The pdq entries don't matter, but throwing away167unprocessed deductions or coincidences is _not_ a good thing. It168is the _caller's_ responsibility to ensure that this routine isn't169called when there are outstanding deductions/coincidences or, if170it is, that `appropriate' action is taken. We return TRUE if we171actually did any compaction, else FALSE.172173In fact, we fully process all coincidences immediately. So,174outside of the coincidence processing routine, the coinc queue is175always empty. Since al0_compact isn't called during coincidence176handling, we're ok there. As for deductions, we _could_ work thro177the queue repeatedly as we compact, resetting the stored coset178numbers to their adjusted values, but we don't (v. expensive). We179just throw any outstanding deductions away, noting this in disded.180We worry later (if we get a finite result) about whether or not we181have to do any extra work to check whether this cavalier attitude182was `justified'.183184Note that this routine is called `on-the-fly' by some of the Level1852 options. It can also be called directly by the rec[over] option.186******************************************************************/187188Logic al0_compact(void)189{190int i, j, irow, col;191int knra, knha;192193/* Table is already compact, do nothing. */194if (nalive == nextdf-1)195{ return(FALSE); }196197/* Clear any preferred definitions on their queue. */198toppd = botpd = 0;199200/* Throw away (after logging) any outstanding deductions. */201if (topded >= 0)202{203disded = TRUE;204topded = -1;205}206207/* Zero the counters for knr/knh adjustment. Note that we can't adjust208these as we go, since it's their _original_ values which are relevant. */209210knra = knha = 0;211212/* Set irow to the lowest redundant coset (which is _never_ #1). */213214for (irow = 2; irow < nextdf; irow++)215{216if (COL1(irow) < 0)217{ break; }218}219220/* Compact the coset table. */221222for (i = irow; i < nextdf; i++)223{224if (COL1(i) < 0)225{226if (i <= knr)227{ knra++; }228if (i <= knh)229{ knha++; }230}231else232{ /* Convert row i to row irow. */233for (col = 1; col <= ncol; col++)234{235if ((j = CT(i, col)) != 0)236{237if (j == i)238{ j = irow; }239else240{ CT(j, invcol[col]) = irow; }241}242CT(irow, col) = j;243}244irow++;245}246}247248knr -= knra; /* Adjust counters */249knh -= knha;250251nextdf = irow; /* 1st unused row */252253return(TRUE);254}255256/******************************************************************257Logic al0_stdct(void)258259This companion programme to _compact() puts the table into standard260form. This form is based on the order of the generators in the261table, but is otherwise fixed for a given group/subgroup; it's262independant of the details of an enumeration. It allows canonic263rep'ves to be picked off by back-tracing (see al1_bldrep()). We264chose _not_ to combine _stdct() & _compact() into one routine,265since the core enumerator may compact (more than once) & we don't266want to impact it's speed with `unnecessary' work. After an267enumeration completes, a single call of _compact() & then of268_stdct() gives a hole-free, standardised table. We can standardise269holey-tables, but the result is only unique up to the set of coset270labels in use.271272Similar remarks to those in _compact() regarding pdefns, dedns,273coincs, etc., etc. apply here. We return true if we actually274change anything, else false. We do the work in two stages, since275we want to avoid (possibly) throwing away dedns if we can avoid it.276Note that we have to do some work even if the table is already277standardised, since there is no quick way to check this. However,278the termination condition is next=nextdf, and this occurs generally279before we scan up to row=nextdf,280******************************************************************/281282Logic al0_stdct(void)283{284int row, col, cos, next, icol, iicol, c1, c2, c3, c4;285286/* Init next to 1st non-redundant coset > 1 */287288next = 1;289do290{ next++; }291while (next < nextdf && COL1(next) < 0);292293if (next == nextdf)294{ return(FALSE); } /* table is in standard form */295296/* Find 1st non-std entry, if it exists */297298for (row = 1; row < nextdf; row++)299{300if (COL1(row) >= 0)301{302for (col = 1; col <= ncol; col++)303{304if ((cos = CT(row,col)) > 0)305{306if (cos < next)307{ ; } /* ok */308else if (cos == next)309{ /* new next value; maybe finish */310do311{ next++; }312while (next < nextdf && COL1(next) < 0);313if (next == nextdf)314{ return(FALSE); }315}316else317{ goto non_std; } /* table is non-std */318}319}320}321}322323return(FALSE); /* Table is standard. Never get here ?! */324325non_std:326327/* Table is non-std, so we'll be changing it. Clear the preferred328definition queue, and throw away (after logging) any outstanding329deductions. */330331toppd = botpd = 0;332333if (topded >= 0)334{335disded = TRUE;336topded = -1;337}338339/* Now work through the table, standardising it. For simplicity, we340`continue' the loops used above, restarting the inner (column) loop. */341342for ( ; row < nextdf; row++)343{344if (COL1(row) >= 0)345{346for (col = 1; col <= ncol; col++)347{348if ((cos = CT(row,col)) > 0)349{350if (cos < next)351{ ; }352else if (cos == next)353{354do355{ next++; }356while (next < nextdf && COL1(next) < 0);357if (next == nextdf)358{ return(TRUE); }359}360else361{362/* At this point, cos > next and we have to swap these rows.363Note that all entries in rows <row are <next, and will not be364effected. We process x/X pairs in one hit (to prevent any365nasties), so we skip over any 2nd (in order) occurrence of a366generator. Warning: trying to understand this code can cause367wetware malfunction! */368369for (icol = 1; icol <= ncol; icol++)370{371iicol = invcol[icol];372373if (icol < iicol)374{375c1 = CT(next,icol);376if (c1 == next)377{ c1 = cos; }378else if (c1 == cos)379{ c1 = next; }380381c2 = CT(cos,icol);382if (c2 == next)383{ c2 = cos; }384else if (c2 == cos)385{ c2 = next; }386387c3 = CT(next,iicol);388if (c3 == next)389{ c3 = cos; }390else if (c3 == cos)391{ c3 = next; }392393c4 = CT(cos,iicol);394if (c4 == next)395{ c4 = cos; }396else if (c4 == cos)397{ c4 = next; }398399CT(next,icol) = c2;400if (c2 != 0)401{ CT(c2,iicol) = next; }402403CT(cos,icol) = c1;404if (c1 != 0)405{ CT(c1,iicol) = cos; }406407CT(next,iicol) = c4;408if (c4 != 0)409{ CT(c4,icol) = next; }410411CT(cos,iicol) = c3;412if (c3 != 0)413{ CT(c3,icol) = cos; }414}415else if (icol == iicol)416{417c1 = CT(next,icol);418if (c1 == next)419{ c1 = cos; }420else if (c1 == cos)421{ c1 = next; }422423c2 = CT(cos,icol);424if (c2 == next)425{ c2 = cos; }426else if (c2 == cos)427{ c2 = next; }428429CT(next,icol) = c2;430if (c2 != 0)431{ CT(c2,icol) = next; }432433CT(cos,icol) = c1;434if (c1 != 0)435{ CT(c1,icol) = cos; }436}437}438439do440{ next++; }441while (next < nextdf && COL1(next) < 0);442if (next == nextdf)443{ return(TRUE); }444}445}446}447}448}449450return(TRUE);451}452453/******************************************************************454double al0_nholes(void)455456On flute, this processes `active' rows at ~ 5.10^6 entries/sec.457Note the use of knh to cut down the amount of work as much as458possible. Can be called by the TBA option of Level 2? Worst-case459complexity, in terms of the number of table accesses, is r(c+1);460where r/c are the number of rows/cols in the table.461462Warning: possible int overflow of k for large tables.463******************************************************************/464465double al0_nholes(void)466{467int i,j,k;468469k = 0;470for (i = knh; i < nextdf; i++)471{472if (COL1(i) >= 0)473{474for (j = 1; j <= ncol; j++)475{476if (CT(i,j) == 0)477{ k++; }478}479}480}481482return( (100.0*(double)k) / ((double)ncol*(double)nalive) );483}484485/******************************************************************486void al0_upknh(void)487488Counts knh up to the next incomplete row, skipping redundants. We489either bail out at an empty table slot, or reach nextdf. During an490enumeration knh is maintained by C-style, due to its overloaded491meaning (ie, knh & knc). If we can't guarantee that the table is492hole-free in an R-style finite result, we have to run this check to493make sure. Worst-case complexity is r(c+1).494495Note: this should not be called carelessly during an enumeration,496since it is important that knh-based C-style hole filling &497deduction stacking / processing are done together, due to the498overloading of knh's meaning & the fact that it triggers a finite499result if it hits nextdf. This should really only be called when500we _know_ we have a finite result (to check whether the table is501hole-free), or when we _know_ that all definitions have been502applied (perhaps in a C-style lookahead).503******************************************************************/504505void al0_upknh(void)506{507int col;508509for ( ; knh < nextdf; knh++)510{511if (COL1(knh) >= 0)512{513for (col = 1; col <= ncol; col++)514{515if (CT(knh,col) == 0)516{ return; }517}518}519}520}521522/******************************************************************523void al0_dedn(int cos, int gen)524525Handling the deduction stack is a pain. The best option, in many526cases, seems to be to throw deductions away if we get too many at527any one time (where `too many' can be quite `small', eg, <1000),528and run an "RA:" or a "CL:" check. However, dedmode #4 (which is529the default) allows a special stack-handling function to be called530if we try to stack a deduction & can't.531532Currently, in this mode our aim is _never_ to lose any deductions,533so we expand the stack space to accomodate the new element. We534take the opportunity to eliminate redundancies from the stack. The535code is essentially that used in dedmod #2 in _coinc() (which536emulates ACE2).537538Note the messaging code, since we're interested in what the stack539actually `looks' like when it overflows! Some ad hoc tests show540that redundancies are common (in collapses). Duplicates (incl.541`inverted' duplicates) are not, and it's expensive to process542these, so we don't bother trying to track them.543544Warning: this is the _only_ place in the core enumerator where we545make a system call (apart from o/p & date calls; if these fail546we've got real problems), and it's one which could fail. There is547_no_ mechanism in ACE Level 0 for handling these sorts of errors,548so we do the best we can to recover. Note also that there is no549cap on the amount of space which we'll (try to) allocate; so this550could all come crashing down in a heap!551******************************************************************/552553void al0_dedn(int cos, int gen)554{555int i,j;556int dead = 0;557558dedsiz *= 2; /* Best way to go? */559if ( (dedrow = (int *)realloc(dedrow, dedsiz*sizeof(int))) == NULL ||560(dedcol = (int *)realloc(dedcol, dedsiz*sizeof(int))) == NULL )561{562/* Our attempt to allocate more space failed, and we lost the existing563stack. Print out a nasty message (if messaging is on), and tidy up.564Note that the enumerator works correctly with dedsiz=0, but discards565_all_ deductions (& does so forever, since 2*0 = 0!). */566567if (dedrow != NULL)568{ free(dedrow); }569if (dedcol != NULL)570{ free(dedcol); }571dedsiz = 0;572topded = -1;573disded = TRUE;574575if (msgctrl)576{ fprintf(fop, "DS: Unable to grow, all deductions discarded\n"); }577578return;579}580581/* Is is actually _worth_ doing this? In a big collapse, the proportion582of coinc dedns can be high; but these are skipped over when encountered583in _cdefn(), so why go to the expense of a (linear) pass & data move. It584might keep the stack size down and prevent one doubling, so we have a585time vs mempry trade-off (maybe). We could also be cleverer, and move586non-redundants from the top to redundant slots at the bottom, cutting the587number of data moves. */588589j = -1;590i = 0;591while (i <= topded && COL1(dedrow[i]) >= 0)592{ j++; i++; }593for ( ; i <= topded; i++)594{595if (COL1(dedrow[i]) >= 0)596{597dedrow[++j] = dedrow[i];598dedcol[j] = dedcol[i];599}600else601{ dead++; } /* Track no. redundancies discarded. */602}603topded = j;604605/* Now add the original cause of the problem. There's no need to check606for an overflow, since we're guaranteed to have enough space at this607point. Note however that we do need to take care to update sdmax608correctly if the stats package is on. */609610dedrow[++topded] = cos;611dedcol[topded] = gen;612#ifdef AL0_STAT613if (topded >= sdmax)614{ sdmax = topded+1; }615#endif616617if (msgctrl)618{619msgnext = msgincr;620ETINT;621fprintf(fop, "DS: a=%d r=%d h=%d n=%d;", nalive, knr, knh, nextdf);622MSGMID;623fprintf(fop, " s=%d d=%d c=%d\n", dedsiz, topded+1, dead);624BTINT;625}626}627628/******************************************************************629void al0_dump(Logic allofit)630631Dump out the internals of Level 0 of ACE, working through al0.h632more or less in order. We could do more here in terms of pretty-633printing the data; or we could introduce further arguments634controlling the level of detail; or we could incorporate checks for635consistency; or ensure that this is only called when there's valid636data; or ... These are left as exercises for the reader; the637output is intended for debugging, and obscurity & information638overload are part of the game!639******************************************************************/640641void al0_dump(Logic allofit)642{643int i,j;644645fprintf(fop, " #---- %s: Level 0 Dump ----\n", ACE_VER);646647/* FILE *fop, *fip; */648if (allofit)649{650if (fop == NULL)651{ fprintf(fop, "fop=NULL"); }652else if (fop == stdout)653{ fprintf(fop, "fop=stdout"); }654else if (fop == stderr)655{ fprintf(fop, "fop=stderr"); }656else657{ fprintf(fop, "fop=(something)"); }658if (fip == NULL)659{ fprintf(fop, " fip=NULL\n"); }660else if (fip == stdin)661{ fprintf(fop, " fip=stdin\n"); }662else663{ fprintf(fop, " fop=(something)\n"); }664}665666/* double begintime, endtime, deltatime, totaltime; */667if (allofit)668{669fprintf(fop,670"begintime=%4.2f endtime=%4.2f deltatime=%4.2f totaltime=%4.2f\n",671begintime, endtime, deltatime, totaltime);672}673674/* msgctrl, msghol, msgincr, msgnext; */675fprintf(fop, "msgctrl=%d msghol=%d msgincr=%d msgnext=%d\n",676msgctrl, msghol, msgincr, msgnext);677678/* Logic mendel, rfill, pcomp; */679fprintf(fop, "mendel=%d rfill=%d pcomp=%d\n", mendel, rfill, pcomp);680681/* int maxrow, rfactor, cfactor, comppc, nrinspg, lahead; */682fprintf(fop, "maxrow=%d rfactor=%d cfactor=%d\n",683maxrow, rfactor, cfactor);684fprintf(fop, "comppc=%d nrinsgp=%d lahead=%d\n",685comppc, nrinsgp, lahead);686687/* int tlimit, hlimit, llimit, lcount */688fprintf(fop, "tlimit=%d hlimit=%d llimit=%d lcount=%d\n",689tlimit, hlimit, llimit, lcount);690691/* int nalive, maxcos, totcos; */692fprintf(fop, "nalive=%d maxcos=%d totcos=%d\n", nalive, maxcos, totcos);693694/* int chead, ctail; + coincidence queue */695fprintf(fop, "chead=%d ctail=%d", chead, ctail);696if (chead == 0)697{ fprintf(fop, " (empty)\n"); }698else if (chead == ctail)699{ fprintf(fop, " (%d->%d (+%d))\n",700chead, -COL1(chead), COL2(chead)); }701else702{ fprintf(fop, " (%d->%d (+%d) ... %d->%d (+%d))\n", chead,703-COL1(chead), COL2(chead), ctail, -COL1(ctail), COL2(ctail)); }704705/* int pdefn, ffactor, pdsiz; */706fprintf(fop, "pdefn=%d ffactor=%3.1f pdsiz=%d\n", pdefn, ffactor, pdsiz);707708/* int toppd, botpd; + int pdqcol[], pdqrow[]; */709fprintf(fop, "toppd=%d botpd=%d", toppd, botpd);710if (toppd == botpd)711{ fprintf(fop, " (empty)\n"); }712else713{ fprintf(fop, " (pdqrow/col=%d.%d ...)\n",714pdqrow[toppd], pdqcol[toppd]); }715716/* int dedsiz, topded, disded, dedmode; + int *dedrow, *dedcol; */717fprintf(fop, "dedmode=%d dedsiz=%d disded=%d topded=%d",718dedmode, dedsiz, disded, topded);719if (topded < 0)720{ fprintf(fop, " (empty)\n"); }721else722{ fprintf(fop, " (... dedrow/col=%d.%d)\n",723dedrow[topded], dedcol[topded]); }724725/* int *edp, *edpbeg, *edpend; */726if (allofit)727{728if (edp == NULL)729{ fprintf(fop, "edp=NULL\n"); }730else731{732fprintf(fop, "edpbeg edpend edp[]\n");733for (i = 1; i <= ncol; i++)734{735if (edpbeg[i] >= 0)736{737fprintf(fop, "%5d %5d ", edpbeg[i], edpend[i]);738for (j = edpbeg[i]; j <= edpend[i]; j++, j++)739{ fprintf(fop, " %d(%d)", edp[j], edp[j+1]); }740}741else742{ fprintf(fop, "%5d %5d -", edpbeg[i], edpend[i]);}743fprintf(fop, "\n");744}745}746}747748/* int ncol, **colptr (+ col1ptr/col2ptr ?), *invcol; */749if (allofit)750{751fprintf(fop, "ncol=%d\n", ncol);752if (colptr == NULL)753{ fprintf(fop, "colptr=NULL\n"); }754else755{756fprintf(fop, " invcol[] ");757for (i = 1; i <= ncol; i++)758{ fprintf(fop, " %4d", invcol[i]); }759fprintf(fop, "\n");760761fprintf(fop, " colptr[][1] ");762for (i = 1; i <= ncol; i++)763{ fprintf(fop, " %4d", colptr[i][1]); }764fprintf(fop, "\n");765766fprintf(fop, " CT(2,) ");767for (i = 1; i <= ncol; i++)768{ fprintf(fop, " %4d", CT(2,i)); }769fprintf(fop, "\n");770}771}772else773{ fprintf(fop, "ncol=%d", ncol); }774775/* int ndrel, *relind, *relexp, *rellen, *relators; */776if (allofit)777{778fprintf(fop, "ndrel=%d\n", ndrel);779if (relators == NULL)780{ fprintf(fop, "relators=NULL\n"); }781else782{783fprintf(fop, " rellen relexp relind relators[]\n");784for (i = 1; i <= ndrel; i++)785{786fprintf(fop, " %5d %5d %5d ", rellen[i], relexp[i], relind[i]);787for (j = relind[i]; j < relind[i]+rellen[i]; j++)788{ fprintf(fop, " %d", relators[j]); }789fprintf(fop, " ");790for ( ; j < relind[i]+2*rellen[i]; j++)791{ fprintf(fop, " %d", relators[j]); }792fprintf(fop, "\n");793}794}795}796else797{ fprintf(fop, " ndrel=%d", ndrel); }798799/* int nsgpg, *subggen, *subgindex, *subglength, sgdone; */800if (allofit)801{802fprintf(fop, "nsgpg=%d sgdone=%d\n", nsgpg, sgdone);803if (subggen == NULL)804{ fprintf(fop, "subggen=NULL\n"); }805else806{807fprintf(fop, " subglength subgindex subggen[]\n");808for (i = 1; i <= nsgpg; i++)809{810fprintf(fop, " %8d %7d ", subglength[i], subgindex[i]);811for (j = subgindex[i]; j < subgindex[i]+subglength[i]; j++)812{ fprintf(fop, " %d", subggen[j]); }813fprintf(fop, "\n");814}815}816}817else818{ fprintf(fop, " nsgpg=%d sgdone=%d\n", nsgpg, sgdone); }819820/* int knr, knh, nextdf; */821fprintf(fop, "knr=%d knh=%d nextdf=%d\n",822knr, knh, nextdf);823824fprintf(fop, " #---------------------------------\n");825}826827/******************************************************************828void al0_rslt(int rslt)829830Pretty-print the result of a run, and some gross statistics.831******************************************************************/832833void al0_rslt(int rslt)834{835if (rslt >= 1)836{837fprintf(fop, "INDEX = %d", rslt);838fprintf(fop, " (a=%d r=%d h=%d n=%d; l=%d c=%4.2f; m=%d t=%d)\n",839nalive, knr, knh, nextdf, lcount, totaltime, maxcos, totcos);840}841else842{843switch(rslt)844{845case -4097: fprintf(fop, "BAD FINITE RESULT"); break;846case -4096: fprintf(fop, "BAD MACHINE STATE"); break;847case -514: fprintf(fop, "INVALID MODE/STYLE"); break;848case -513: fprintf(fop, "INVALID STYLE"); break;849case -512: fprintf(fop, "INVALID MODE"); break;850case -260: fprintf(fop, "SG PHASE OVERFLOW"); break;851case -259: fprintf(fop, "ITERATION LIMIT"); break;852case -258: fprintf(fop, "TIME LIMT"); break;853case -257: fprintf(fop, "HOLE LIMIT"); break;854case -256: fprintf(fop, "INCOMPLETE TABLE"); break;855case 0: fprintf(fop, "OVERFLOW"); break;856default: fprintf(fop, "UNKNOWN ERROR (%d)", rslt); break;857}858859if (rslt <= -512)860{ fprintf(fop, "\n"); }861else862{863fprintf(fop, " (a=%d r=%d h=%d n=%d;", nalive, knr, knh, nextdf);864if (msghol)865{ fprintf(fop, " h=%4.2f%%", al0_nholes()); }866fprintf(fop, " l=%d c=%4.2f;", lcount, totaltime);867fprintf(fop, " m=%d t=%d)\n", maxcos, totcos);868}869}870}871872#ifdef AL0_STAT873874/******************************************************************875void al0_statinit(void)876877Initialise the stats package for this call to al0_enum().878******************************************************************/879880void al0_statinit(void)881{882cdcoinc = rdcoinc = apcoinc = rlcoinc = clcoinc = 0;883xcols12 = xcoinc = qcoinc = 0;884xsave12 = s12dup = s12new = 0;885xcrep = crepred = crepwrk = 0;886xcomp = compwrk = 0;887xsaved = sdmax = sdoflow = 0;888xapply = apdedn = apdefn = 0;889rldedn = cldedn = 0;890xrdefn = rddedn = rddefn = rdfill = 0;891xcdefn = cddproc = cdddedn = cddedn = cdgap = cdidefn = 0;892cdidedn = cdpdl = cdpof = cdpdead = cdpdefn = cddefn = 0;893}894895/******************************************************************896void al0_statdump(void)897898Dump the stats for latest call to al0_enum().899******************************************************************/900901void al0_statdump(void)902{903fprintf(fop, " #- %s: Level 0 Statistics -\n", ACE_VER);904905fprintf(fop, "cdcoinc=%d rdcoinc=%d apcoinc=%d rlcoinc=%d clcoinc=%d\n",906cdcoinc, rdcoinc, apcoinc, rlcoinc, clcoinc);907fprintf(fop, " xcoinc=%d xcols12=%d qcoinc=%d\n",908xcoinc, xcols12, qcoinc);909fprintf(fop, " xsave12=%d s12dup=%d s12new=%d\n",910xsave12, s12dup, s12new);911fprintf(fop, " xcrep=%d crepred=%d crepwrk=%d xcomp=%d compwrk=%d\n",912xcrep, crepred, crepwrk, xcomp, compwrk);913fprintf(fop, "xsaved=%d sdmax=%d sdoflow=%d\n", xsaved, sdmax, sdoflow);914fprintf(fop, "xapply=%d apdedn=%d apdefn=%d\n", xapply, apdedn, apdefn);915fprintf(fop, "rldedn=%d cldedn=%d\n", rldedn, cldedn);916fprintf(fop, "xrdefn=%d rddedn=%d rddefn=%d rdfill=%d\n",917xrdefn, rddedn, rddefn, rdfill);918fprintf(fop, "xcdefn=%d cddproc=%d cdddedn=%d cddedn=%d\n",919xcdefn, cddproc, cdddedn, cddedn);920fprintf(fop, " cdgap=%d cdidefn=%d cdidedn=%d cdpdl=%d cdpof=%d\n",921cdgap, cdidefn, cdidedn, cdpdl, cdpof);922fprintf(fop, " cdpdead=%d cdpdefn=%d cddefn=%d\n",923cdpdead, cdpdefn, cddefn);924925fprintf(fop, " #---------------------------------\n");926}927928#endif929930931932