Changeset df3483a in git


Ignore:
Timestamp:
Apr 30, 1998, 5:27:25 PM (26 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
24189c4982473a71947501ca9125a109ab40e937
Parents:
1d142c32d3b504db8d82f4aa3104fb6643914101
Message:
* small change in structure of spolyloop


git-svn-id: file:///usr/local/Singular/svn/trunk@1568 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/spSpolyLoop.cc

    r1d142c rdf3483a  
    3333{
    3434  poly a = monom,                         // collects the result
    35        b = pNew(),                        // stores a1*monom
     35       b = NULL,                        // stores a1*monom
    3636       c;                                 // used for temporary storage
    3737  number tm   = pGetCoeff(monom),         // coefficient of monom
     
    4242  if (a2==NULL) goto Finish; // we are done if a2 is 0
    4343
     44  b = pNew();
    4445  pCopyAddFast0(b, a1, monom);  // now a2 != NULL -- set up b
    4546
     
    6667    nDelete(&tb);
    6768    pIter(a1);
    68     if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?
     69    if (a1 == NULL || a2 == NULL) goto Finish; // are we done ?
    6970    pCopyAddFast0(b, a1, monom); // No! So, get new b = a1*monom
    7071    goto Top;
     
    8384      a = pNext(a) = b;       // append b to result and advance a1
    8485      pIter(a1);
     86      if (a1 == NULL) // are we done?
     87      {
     88        b = NULL;
     89        goto Finish;
     90      }
    8591      b = pNew();
    86       if (a1 == NULL) goto Finish; // are we done?
    8792      pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom
    8893      goto Top;
     
    95100     spGMultCopyX(a1, monom, a, tneg, spNoether);
    96101   nDelete(&tneg);
    97    pFree1(b);
     102   if (b != NULL) pFree1(b);
    98103}
    99104
  • Singular/spSpolyLoop.inc

    r1d142c rdf3483a  
    77{
    88  poly a = monom,                         // collects the result
    9        b = pNew(),                        // stores a1*monom
    10        c;                                 // used for temporary storage
    11   number tm   = pGetCoeff(monom),         // coefficient of monom
    12          tneg = npNegM(tm),        // - (coefficient of monom)
    13          tb;                              // used for tm*coeff(a1)
    14   Order_t order;                          // used for homog case
    15 
    16   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     9       b = NULL,                          // stores a1*monom
     10       c;                                 // used for temporary storage
     11  number tm   = pGetCoeff(monom),         // coefficient of monom
     12         tneg = npNegM(tm),        // - (coefficient of monom)
     13         tb;                              // used for tm*coeff(a1)
     14  Order_t order;                          // used for homog case
     15
     16  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     17  b = pNew();   
    1718
    1819  ;              // inits order for homog case
     
    6768      a = pNext(a) = b;       // append b to result and advance a1
    6869      pIter(a1);
    69       b = pNew();
    70       if (a1 == NULL) goto Finish; // are we done?
     70      if (a1 == NULL)         // are we done?
     71      {
     72        b = pNew();
     73        goto Finish;
     74      }
     75      b = pNew();
    7176      pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom
    7277      goto Top;
     
    8085     spMultCopyX(a1, monom, a, tneg, spNoether);
    8186   ;
    82    pFree1(b);
     87   if (b != NULL) pFree1(b);
    8388}
    8489static void spSpolyLoop_chMODP_otCOMPEXP_homGEN_nwODD
     
    8691{
    8792  poly a = monom,                         // collects the result
    88        b = pNew(),                        // stores a1*monom
    89        c;                                 // used for temporary storage
    90   number tm   = pGetCoeff(monom),         // coefficient of monom
    91          tneg = npNegM(tm),        // - (coefficient of monom)
    92          tb;                              // used for tm*coeff(a1)
    93   Order_t order;                          // used for homog case
    94 
    95   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     93       b = NULL,                          // stores a1*monom
     94       c;                                 // used for temporary storage
     95  number tm   = pGetCoeff(monom),         // coefficient of monom
     96         tneg = npNegM(tm),        // - (coefficient of monom)
     97         tb;                              // used for tm*coeff(a1)
     98  Order_t order;                          // used for homog case
     99
     100  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     101  b = pNew();   
    96102
    97103  ;              // inits order for homog case
     
    146152      a = pNext(a) = b;       // append b to result and advance a1
    147153      pIter(a1);
    148       b = pNew();
    149       if (a1 == NULL) goto Finish; // are we done?
     154      if (a1 == NULL)         // are we done?
     155      {
     156        b = pNew();
     157        goto Finish;
     158      }
     159      b = pNew();
    150160      pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom
    151161      goto Top;
     
    159169     spMultCopyX(a1, monom, a, tneg, spNoether);
    160170   ;
    161    pFree1(b);
     171   if (b != NULL) pFree1(b);
    162172}
    163173static void spSpolyLoop_chMODP_otCOMPEXP_homGEN_nwONE
     
    165175{
    166176  poly a = monom,                         // collects the result
    167        b = pNew(),                        // stores a1*monom
    168        c;                                 // used for temporary storage
    169   number tm   = pGetCoeff(monom),         // coefficient of monom
    170          tneg = npNegM(tm),        // - (coefficient of monom)
    171          tb;                              // used for tm*coeff(a1)
    172   Order_t order;                          // used for homog case
    173 
    174   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     177       b = NULL,                          // stores a1*monom
     178       c;                                 // used for temporary storage
     179  number tm   = pGetCoeff(monom),         // coefficient of monom
     180         tneg = npNegM(tm),        // - (coefficient of monom)
     181         tb;                              // used for tm*coeff(a1)
     182  Order_t order;                          // used for homog case
     183
     184  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     185  b = pNew();   
    175186
    176187  ;              // inits order for homog case
     
    225236      a = pNext(a) = b;       // append b to result and advance a1
    226237      pIter(a1);
    227       b = pNew();
    228       if (a1 == NULL) goto Finish; // are we done?
     238      if (a1 == NULL)         // are we done?
     239      {
     240        b = pNew();
     241        goto Finish;
     242      }
     243      b = pNew();
    229244      pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom
    230245      goto Top;
     
    238253     spMultCopyX(a1, monom, a, tneg, spNoether);
    239254   ;
    240    pFree1(b);
     255   if (b != NULL) pFree1(b);
    241256}
    242257static void spSpolyLoop_chMODP_otCOMPEXP_homGEN_nwTWO
     
    244259{
    245260  poly a = monom,                         // collects the result
    246        b = pNew(),                        // stores a1*monom
    247        c;                                 // used for temporary storage
    248   number tm   = pGetCoeff(monom),         // coefficient of monom
    249          tneg = npNegM(tm),        // - (coefficient of monom)
    250          tb;                              // used for tm*coeff(a1)
    251   Order_t order;                          // used for homog case
    252 
    253   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     261       b = NULL,                          // stores a1*monom
     262       c;                                 // used for temporary storage
     263  number tm   = pGetCoeff(monom),         // coefficient of monom
     264         tneg = npNegM(tm),        // - (coefficient of monom)
     265         tb;                              // used for tm*coeff(a1)
     266  Order_t order;                          // used for homog case
     267
     268  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     269  b = pNew();   
    254270
    255271  ;              // inits order for homog case
     
    304320      a = pNext(a) = b;       // append b to result and advance a1
    305321      pIter(a1);
    306       b = pNew();
    307       if (a1 == NULL) goto Finish; // are we done?
     322      if (a1 == NULL)         // are we done?
     323      {
     324        b = pNew();
     325        goto Finish;
     326      }
     327      b = pNew();
    308328      pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom
    309329      goto Top;
     
    317337     spMultCopyX(a1, monom, a, tneg, spNoether);
    318338   ;
    319    pFree1(b);
     339   if (b != NULL) pFree1(b);
    320340}
    321341static void spSpolyLoop_chMODP_otCOMPEXP_homYES_nwEVEN
     
    323343{
    324344  poly a = monom,                         // collects the result
    325        b = pNew(),                        // stores a1*monom
    326        c;                                 // used for temporary storage
    327   number tm   = pGetCoeff(monom),         // coefficient of monom
    328          tneg = npNegM(tm),        // - (coefficient of monom)
    329          tb;                              // used for tm*coeff(a1)
    330   Order_t order;                          // used for homog case
    331 
    332   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     345       b = NULL,                          // stores a1*monom
     346       c;                                 // used for temporary storage
     347  number tm   = pGetCoeff(monom),         // coefficient of monom
     348         tneg = npNegM(tm),        // - (coefficient of monom)
     349         tb;                              // used for tm*coeff(a1)
     350  Order_t order;                          // used for homog case
     351
     352  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     353  b = pNew();   
    333354
    334355  order = a2->Order;              // inits order for homog case
     
    381402      a = pNext(a) = b;       // append b to result and advance a1
    382403      pIter(a1);
    383       b = pNew();
    384       if (a1 == NULL) goto Finish; // are we done?
     404      if (a1 == NULL)         // are we done?
     405      {
     406        b = pNew();
     407        goto Finish;
     408      }
     409      b = pNew();
    385410      pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom
    386411      goto Top;
     
    394419     spMultCopyX(a1, monom, a, tneg, spNoether);
    395420   ;
    396    pFree1(b);
     421   if (b != NULL) pFree1(b);
    397422}
    398423static void spSpolyLoop_chMODP_otCOMPEXP_homYES_nwODD
     
    400425{
    401426  poly a = monom,                         // collects the result
    402        b = pNew(),                        // stores a1*monom
    403        c;                                 // used for temporary storage
    404   number tm   = pGetCoeff(monom),         // coefficient of monom
    405          tneg = npNegM(tm),        // - (coefficient of monom)
    406          tb;                              // used for tm*coeff(a1)
    407   Order_t order;                          // used for homog case
    408 
    409   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     427       b = NULL,                          // stores a1*monom
     428       c;                                 // used for temporary storage
     429  number tm   = pGetCoeff(monom),         // coefficient of monom
     430         tneg = npNegM(tm),        // - (coefficient of monom)
     431         tb;                              // used for tm*coeff(a1)
     432  Order_t order;                          // used for homog case
     433
     434  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     435  b = pNew();   
    410436
    411437  order = a2->Order;              // inits order for homog case
     
    458484      a = pNext(a) = b;       // append b to result and advance a1
    459485      pIter(a1);
    460       b = pNew();
    461       if (a1 == NULL) goto Finish; // are we done?
     486      if (a1 == NULL)         // are we done?
     487      {
     488        b = pNew();
     489        goto Finish;
     490      }
     491      b = pNew();
    462492      pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom
    463493      goto Top;
     
    471501     spMultCopyX(a1, monom, a, tneg, spNoether);
    472502   ;
    473    pFree1(b);
     503   if (b != NULL) pFree1(b);
    474504}
    475505static void spSpolyLoop_chMODP_otCOMPEXP_homYES_nwONE
     
    477507{
    478508  poly a = monom,                         // collects the result
    479        b = pNew(),                        // stores a1*monom
    480        c;                                 // used for temporary storage
    481   number tm   = pGetCoeff(monom),         // coefficient of monom
    482          tneg = npNegM(tm),        // - (coefficient of monom)
    483          tb;                              // used for tm*coeff(a1)
    484   Order_t order;                          // used for homog case
    485 
    486   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     509       b = NULL,                          // stores a1*monom
     510       c;                                 // used for temporary storage
     511  number tm   = pGetCoeff(monom),         // coefficient of monom
     512         tneg = npNegM(tm),        // - (coefficient of monom)
     513         tb;                              // used for tm*coeff(a1)
     514  Order_t order;                          // used for homog case
     515
     516  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     517  b = pNew();   
    487518
    488519  order = a2->Order;              // inits order for homog case
     
    535566      a = pNext(a) = b;       // append b to result and advance a1
    536567      pIter(a1);
    537       b = pNew();
    538       if (a1 == NULL) goto Finish; // are we done?
     568      if (a1 == NULL)         // are we done?
     569      {
     570        b = pNew();
     571        goto Finish;
     572      }
     573      b = pNew();
    539574      pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom
    540575      goto Top;
     
    548583     spMultCopyX(a1, monom, a, tneg, spNoether);
    549584   ;
    550    pFree1(b);
     585   if (b != NULL) pFree1(b);
    551586}
    552587static void spSpolyLoop_chMODP_otCOMPEXP_homYES_nwTWO
     
    554589{
    555590  poly a = monom,                         // collects the result
    556        b = pNew(),                        // stores a1*monom
    557        c;                                 // used for temporary storage
    558   number tm   = pGetCoeff(monom),         // coefficient of monom
    559          tneg = npNegM(tm),        // - (coefficient of monom)
    560          tb;                              // used for tm*coeff(a1)
    561   Order_t order;                          // used for homog case
    562 
    563   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     591       b = NULL,                          // stores a1*monom
     592       c;                                 // used for temporary storage
     593  number tm   = pGetCoeff(monom),         // coefficient of monom
     594         tneg = npNegM(tm),        // - (coefficient of monom)
     595         tb;                              // used for tm*coeff(a1)
     596  Order_t order;                          // used for homog case
     597
     598  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     599  b = pNew();   
    564600
    565601  order = a2->Order;              // inits order for homog case
     
    612648      a = pNext(a) = b;       // append b to result and advance a1
    613649      pIter(a1);
    614       b = pNew();
    615       if (a1 == NULL) goto Finish; // are we done?
     650      if (a1 == NULL)         // are we done?
     651      {
     652        b = pNew();
     653        goto Finish;
     654      }
     655      b = pNew();
    616656      pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom
    617657      goto Top;
     
    625665     spMultCopyX(a1, monom, a, tneg, spNoether);
    626666   ;
    627    pFree1(b);
     667   if (b != NULL) pFree1(b);
    628668}
    629669static void spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwEVEN
     
    631671{
    632672  poly a = monom,                         // collects the result
    633        b = pNew(),                        // stores a1*monom
    634        c;                                 // used for temporary storage
    635   number tm   = pGetCoeff(monom),         // coefficient of monom
    636          tneg = npNegM(tm),        // - (coefficient of monom)
    637          tb;                              // used for tm*coeff(a1)
    638   Order_t order;                          // used for homog case
    639 
    640   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     673       b = NULL,                          // stores a1*monom
     674       c;                                 // used for temporary storage
     675  number tm   = pGetCoeff(monom),         // coefficient of monom
     676         tneg = npNegM(tm),        // - (coefficient of monom)
     677         tb;                              // used for tm*coeff(a1)
     678  Order_t order;                          // used for homog case
     679
     680  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     681  b = pNew();   
    641682
    642683  ;              // inits order for homog case
     
    689730      a = pNext(a) = b;       // append b to result and advance a1
    690731      pIter(a1);
    691       b = pNew();
    692       if (a1 == NULL) goto Finish; // are we done?
     732      if (a1 == NULL)         // are we done?
     733      {
     734        b = pNew();
     735        goto Finish;
     736      }
     737      b = pNew();
    693738      pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom
    694739      goto Top;
     
    702747     spMultCopyX(a1, monom, a, tneg, spNoether);
    703748   ;
    704    pFree1(b);
     749   if (b != NULL) pFree1(b);
    705750}
    706751static void spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwODD
     
    708753{
    709754  poly a = monom,                         // collects the result
    710        b = pNew(),                        // stores a1*monom
    711        c;                                 // used for temporary storage
    712   number tm   = pGetCoeff(monom),         // coefficient of monom
    713          tneg = npNegM(tm),        // - (coefficient of monom)
    714          tb;                              // used for tm*coeff(a1)
    715   Order_t order;                          // used for homog case
    716 
    717   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     755       b = NULL,                          // stores a1*monom
     756       c;                                 // used for temporary storage
     757  number tm   = pGetCoeff(monom),         // coefficient of monom
     758         tneg = npNegM(tm),        // - (coefficient of monom)
     759         tb;                              // used for tm*coeff(a1)
     760  Order_t order;                          // used for homog case
     761
     762  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     763  b = pNew();   
    718764
    719765  ;              // inits order for homog case
     
    766812      a = pNext(a) = b;       // append b to result and advance a1
    767813      pIter(a1);
    768       b = pNew();
    769       if (a1 == NULL) goto Finish; // are we done?
     814      if (a1 == NULL)         // are we done?
     815      {
     816        b = pNew();
     817        goto Finish;
     818      }
     819      b = pNew();
    770820      pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom
    771821      goto Top;
     
    779829     spMultCopyX(a1, monom, a, tneg, spNoether);
    780830   ;
    781    pFree1(b);
     831   if (b != NULL) pFree1(b);
    782832}
    783833static void spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwONE
     
    785835{
    786836  poly a = monom,                         // collects the result
    787        b = pNew(),                        // stores a1*monom
    788        c;                                 // used for temporary storage
    789   number tm   = pGetCoeff(monom),         // coefficient of monom
    790          tneg = npNegM(tm),        // - (coefficient of monom)
    791          tb;                              // used for tm*coeff(a1)
    792   Order_t order;                          // used for homog case
    793 
    794   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     837       b = NULL,                          // stores a1*monom
     838       c;                                 // used for temporary storage
     839  number tm   = pGetCoeff(monom),         // coefficient of monom
     840         tneg = npNegM(tm),        // - (coefficient of monom)
     841         tb;                              // used for tm*coeff(a1)
     842  Order_t order;                          // used for homog case
     843
     844  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     845  b = pNew();   
    795846
    796847  ;              // inits order for homog case
     
    843894      a = pNext(a) = b;       // append b to result and advance a1
    844895      pIter(a1);
    845       b = pNew();
    846       if (a1 == NULL) goto Finish; // are we done?
     896      if (a1 == NULL)         // are we done?
     897      {
     898        b = pNew();
     899        goto Finish;
     900      }
     901      b = pNew();
    847902      pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom
    848903      goto Top;
     
    856911     spMultCopyX(a1, monom, a, tneg, spNoether);
    857912   ;
    858    pFree1(b);
     913   if (b != NULL) pFree1(b);
    859914}
    860915static void spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwTWO
     
    862917{
    863918  poly a = monom,                         // collects the result
    864        b = pNew(),                        // stores a1*monom
    865        c;                                 // used for temporary storage
    866   number tm   = pGetCoeff(monom),         // coefficient of monom
    867          tneg = npNegM(tm),        // - (coefficient of monom)
    868          tb;                              // used for tm*coeff(a1)
    869   Order_t order;                          // used for homog case
    870 
    871   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     919       b = NULL,                          // stores a1*monom
     920       c;                                 // used for temporary storage
     921  number tm   = pGetCoeff(monom),         // coefficient of monom
     922         tneg = npNegM(tm),        // - (coefficient of monom)
     923         tb;                              // used for tm*coeff(a1)
     924  Order_t order;                          // used for homog case
     925
     926  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     927  b = pNew();   
    872928
    873929  ;              // inits order for homog case
     
    920976      a = pNext(a) = b;       // append b to result and advance a1
    921977      pIter(a1);
    922       b = pNew();
    923       if (a1 == NULL) goto Finish; // are we done?
     978      if (a1 == NULL)         // are we done?
     979      {
     980        b = pNew();
     981        goto Finish;
     982      }
     983      b = pNew();
    924984      pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom
    925985      goto Top;
     
    933993     spMultCopyX(a1, monom, a, tneg, spNoether);
    934994   ;
    935    pFree1(b);
     995   if (b != NULL) pFree1(b);
    936996}
    937997static void spSpolyLoop_chMODP_otEXPCOMP_homYES_nwEVEN
     
    939999{
    9401000  poly a = monom,                         // collects the result
    941        b = pNew(),                        // stores a1*monom
    942        c;                                 // used for temporary storage
    943   number tm   = pGetCoeff(monom),         // coefficient of monom
    944          tneg = npNegM(tm),        // - (coefficient of monom)
    945          tb;                              // used for tm*coeff(a1)
    946   Order_t order;                          // used for homog case
    947 
    948   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1001       b = NULL,                          // stores a1*monom
     1002       c;                                 // used for temporary storage
     1003  number tm   = pGetCoeff(monom),         // coefficient of monom
     1004         tneg = npNegM(tm),        // - (coefficient of monom)
     1005         tb;                              // used for tm*coeff(a1)
     1006  Order_t order;                          // used for homog case
     1007
     1008  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1009  b = pNew();   
    9491010
    9501011  order = a2->Order;              // inits order for homog case
     
    9951056      a = pNext(a) = b;       // append b to result and advance a1
    9961057      pIter(a1);
    997       b = pNew();
    998       if (a1 == NULL) goto Finish; // are we done?
     1058      if (a1 == NULL)         // are we done?
     1059      {
     1060        b = pNew();
     1061        goto Finish;
     1062      }
     1063      b = pNew();
    9991064      pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom
    10001065      goto Top;
     
    10081073     spMultCopyX(a1, monom, a, tneg, spNoether);
    10091074   ;
    1010    pFree1(b);
     1075   if (b != NULL) pFree1(b);
    10111076}
    10121077static void spSpolyLoop_chMODP_otEXPCOMP_homYES_nwODD
     
    10141079{
    10151080  poly a = monom,                         // collects the result
    1016        b = pNew(),                        // stores a1*monom
    1017        c;                                 // used for temporary storage
    1018   number tm   = pGetCoeff(monom),         // coefficient of monom
    1019          tneg = npNegM(tm),        // - (coefficient of monom)
    1020          tb;                              // used for tm*coeff(a1)
    1021   Order_t order;                          // used for homog case
    1022 
    1023   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1081       b = NULL,                          // stores a1*monom
     1082       c;                                 // used for temporary storage
     1083  number tm   = pGetCoeff(monom),         // coefficient of monom
     1084         tneg = npNegM(tm),        // - (coefficient of monom)
     1085         tb;                              // used for tm*coeff(a1)
     1086  Order_t order;                          // used for homog case
     1087
     1088  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1089  b = pNew();   
    10241090
    10251091  order = a2->Order;              // inits order for homog case
     
    10701136      a = pNext(a) = b;       // append b to result and advance a1
    10711137      pIter(a1);
    1072       b = pNew();
    1073       if (a1 == NULL) goto Finish; // are we done?
     1138      if (a1 == NULL)         // are we done?
     1139      {
     1140        b = pNew();
     1141        goto Finish;
     1142      }
     1143      b = pNew();
    10741144      pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom
    10751145      goto Top;
     
    10831153     spMultCopyX(a1, monom, a, tneg, spNoether);
    10841154   ;
    1085    pFree1(b);
     1155   if (b != NULL) pFree1(b);
    10861156}
    10871157static void spSpolyLoop_chMODP_otEXPCOMP_homYES_nwONE
     
    10891159{
    10901160  poly a = monom,                         // collects the result
    1091        b = pNew(),                        // stores a1*monom
    1092        c;                                 // used for temporary storage
    1093   number tm   = pGetCoeff(monom),         // coefficient of monom
    1094          tneg = npNegM(tm),        // - (coefficient of monom)
    1095          tb;                              // used for tm*coeff(a1)
    1096   Order_t order;                          // used for homog case
    1097 
    1098   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1161       b = NULL,                          // stores a1*monom
     1162       c;                                 // used for temporary storage
     1163  number tm   = pGetCoeff(monom),         // coefficient of monom
     1164         tneg = npNegM(tm),        // - (coefficient of monom)
     1165         tb;                              // used for tm*coeff(a1)
     1166  Order_t order;                          // used for homog case
     1167
     1168  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1169  b = pNew();   
    10991170
    11001171  order = a2->Order;              // inits order for homog case
     
    11451216      a = pNext(a) = b;       // append b to result and advance a1
    11461217      pIter(a1);
    1147       b = pNew();
    1148       if (a1 == NULL) goto Finish; // are we done?
     1218      if (a1 == NULL)         // are we done?
     1219      {
     1220        b = pNew();
     1221        goto Finish;
     1222      }
     1223      b = pNew();
    11491224      pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom
    11501225      goto Top;
     
    11581233     spMultCopyX(a1, monom, a, tneg, spNoether);
    11591234   ;
    1160    pFree1(b);
     1235   if (b != NULL) pFree1(b);
    11611236}
    11621237static void spSpolyLoop_chMODP_otEXPCOMP_homYES_nwTWO
     
    11641239{
    11651240  poly a = monom,                         // collects the result
    1166        b = pNew(),                        // stores a1*monom
    1167        c;                                 // used for temporary storage
    1168   number tm   = pGetCoeff(monom),         // coefficient of monom
    1169          tneg = npNegM(tm),        // - (coefficient of monom)
    1170          tb;                              // used for tm*coeff(a1)
    1171   Order_t order;                          // used for homog case
    1172 
    1173   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1241       b = NULL,                          // stores a1*monom
     1242       c;                                 // used for temporary storage
     1243  number tm   = pGetCoeff(monom),         // coefficient of monom
     1244         tneg = npNegM(tm),        // - (coefficient of monom)
     1245         tb;                              // used for tm*coeff(a1)
     1246  Order_t order;                          // used for homog case
     1247
     1248  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1249  b = pNew();   
    11741250
    11751251  order = a2->Order;              // inits order for homog case
     
    12201296      a = pNext(a) = b;       // append b to result and advance a1
    12211297      pIter(a1);
    1222       b = pNew();
    1223       if (a1 == NULL) goto Finish; // are we done?
     1298      if (a1 == NULL)         // are we done?
     1299      {
     1300        b = pNew();
     1301        goto Finish;
     1302      }
     1303      b = pNew();
    12241304      pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom
    12251305      goto Top;
     
    12331313     spMultCopyX(a1, monom, a, tneg, spNoether);
    12341314   ;
    1235    pFree1(b);
     1315   if (b != NULL) pFree1(b);
    12361316}
    12371317static void spSpolyLoop_chMODP_otEXP_homGEN_nwEVEN
     
    12391319{
    12401320  poly a = monom,                         // collects the result
    1241        b = pNew(),                        // stores a1*monom
    1242        c;                                 // used for temporary storage
    1243   number tm   = pGetCoeff(monom),         // coefficient of monom
    1244          tneg = npNegM(tm),        // - (coefficient of monom)
    1245          tb;                              // used for tm*coeff(a1)
    1246   Order_t order;                          // used for homog case
    1247 
    1248   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1321       b = NULL,                          // stores a1*monom
     1322       c;                                 // used for temporary storage
     1323  number tm   = pGetCoeff(monom),         // coefficient of monom
     1324         tneg = npNegM(tm),        // - (coefficient of monom)
     1325         tb;                              // used for tm*coeff(a1)
     1326  Order_t order;                          // used for homog case
     1327
     1328  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1329  b = pNew();   
    12491330
    12501331  ;              // inits order for homog case
     
    12971378      a = pNext(a) = b;       // append b to result and advance a1
    12981379      pIter(a1);
    1299       b = pNew();
    1300       if (a1 == NULL) goto Finish; // are we done?
     1380      if (a1 == NULL)         // are we done?
     1381      {
     1382        b = pNew();
     1383        goto Finish;
     1384      }
     1385      b = pNew();
    13011386      pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom
    13021387      goto Top;
     
    13101395     spMultCopyX(a1, monom, a, tneg, spNoether);
    13111396   ;
    1312    pFree1(b);
     1397   if (b != NULL) pFree1(b);
    13131398}
    13141399static void spSpolyLoop_chMODP_otEXP_homGEN_nwODD
     
    13161401{
    13171402  poly a = monom,                         // collects the result
    1318        b = pNew(),                        // stores a1*monom
    1319        c;                                 // used for temporary storage
    1320   number tm   = pGetCoeff(monom),         // coefficient of monom
    1321          tneg = npNegM(tm),        // - (coefficient of monom)
    1322          tb;                              // used for tm*coeff(a1)
    1323   Order_t order;                          // used for homog case
    1324 
    1325   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1403       b = NULL,                          // stores a1*monom
     1404       c;                                 // used for temporary storage
     1405  number tm   = pGetCoeff(monom),         // coefficient of monom
     1406         tneg = npNegM(tm),        // - (coefficient of monom)
     1407         tb;                              // used for tm*coeff(a1)
     1408  Order_t order;                          // used for homog case
     1409
     1410  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1411  b = pNew();   
    13261412
    13271413  ;              // inits order for homog case
     
    13741460      a = pNext(a) = b;       // append b to result and advance a1
    13751461      pIter(a1);
    1376       b = pNew();
    1377       if (a1 == NULL) goto Finish; // are we done?
     1462      if (a1 == NULL)         // are we done?
     1463      {
     1464        b = pNew();
     1465        goto Finish;
     1466      }
     1467      b = pNew();
    13781468      pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom
    13791469      goto Top;
     
    13871477     spMultCopyX(a1, monom, a, tneg, spNoether);
    13881478   ;
    1389    pFree1(b);
     1479   if (b != NULL) pFree1(b);
    13901480}
    13911481static void spSpolyLoop_chMODP_otEXP_homGEN_nwONE
     
    13931483{
    13941484  poly a = monom,                         // collects the result
    1395        b = pNew(),                        // stores a1*monom
    1396        c;                                 // used for temporary storage
    1397   number tm   = pGetCoeff(monom),         // coefficient of monom
    1398          tneg = npNegM(tm),        // - (coefficient of monom)
    1399          tb;                              // used for tm*coeff(a1)
    1400   Order_t order;                          // used for homog case
    1401 
    1402   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1485       b = NULL,                          // stores a1*monom
     1486       c;                                 // used for temporary storage
     1487  number tm   = pGetCoeff(monom),         // coefficient of monom
     1488         tneg = npNegM(tm),        // - (coefficient of monom)
     1489         tb;                              // used for tm*coeff(a1)
     1490  Order_t order;                          // used for homog case
     1491
     1492  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1493  b = pNew();   
    14031494
    14041495  ;              // inits order for homog case
     
    14511542      a = pNext(a) = b;       // append b to result and advance a1
    14521543      pIter(a1);
    1453       b = pNew();
    1454       if (a1 == NULL) goto Finish; // are we done?
     1544      if (a1 == NULL)         // are we done?
     1545      {
     1546        b = pNew();
     1547        goto Finish;
     1548      }
     1549      b = pNew();
    14551550      pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom
    14561551      goto Top;
     
    14641559     spMultCopyX(a1, monom, a, tneg, spNoether);
    14651560   ;
    1466    pFree1(b);
     1561   if (b != NULL) pFree1(b);
    14671562}
    14681563static void spSpolyLoop_chMODP_otEXP_homGEN_nwTWO
     
    14701565{
    14711566  poly a = monom,                         // collects the result
    1472        b = pNew(),                        // stores a1*monom
    1473        c;                                 // used for temporary storage
    1474   number tm   = pGetCoeff(monom),         // coefficient of monom
    1475          tneg = npNegM(tm),        // - (coefficient of monom)
    1476          tb;                              // used for tm*coeff(a1)
    1477   Order_t order;                          // used for homog case
    1478 
    1479   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1567       b = NULL,                          // stores a1*monom
     1568       c;                                 // used for temporary storage
     1569  number tm   = pGetCoeff(monom),         // coefficient of monom
     1570         tneg = npNegM(tm),        // - (coefficient of monom)
     1571         tb;                              // used for tm*coeff(a1)
     1572  Order_t order;                          // used for homog case
     1573
     1574  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1575  b = pNew();   
    14801576
    14811577  ;              // inits order for homog case
     
    15281624      a = pNext(a) = b;       // append b to result and advance a1
    15291625      pIter(a1);
    1530       b = pNew();
    1531       if (a1 == NULL) goto Finish; // are we done?
     1626      if (a1 == NULL)         // are we done?
     1627      {
     1628        b = pNew();
     1629        goto Finish;
     1630      }
     1631      b = pNew();
    15321632      pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom
    15331633      goto Top;
     
    15411641     spMultCopyX(a1, monom, a, tneg, spNoether);
    15421642   ;
    1543    pFree1(b);
     1643   if (b != NULL) pFree1(b);
    15441644}
    15451645static void spSpolyLoop_chMODP_otEXP_homYES_nwEVEN
     
    15471647{
    15481648  poly a = monom,                         // collects the result
    1549        b = pNew(),                        // stores a1*monom
    1550        c;                                 // used for temporary storage
    1551   number tm   = pGetCoeff(monom),         // coefficient of monom
    1552          tneg = npNegM(tm),        // - (coefficient of monom)
    1553          tb;                              // used for tm*coeff(a1)
    1554   Order_t order;                          // used for homog case
    1555 
    1556   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1649       b = NULL,                          // stores a1*monom
     1650       c;                                 // used for temporary storage
     1651  number tm   = pGetCoeff(monom),         // coefficient of monom
     1652         tneg = npNegM(tm),        // - (coefficient of monom)
     1653         tb;                              // used for tm*coeff(a1)
     1654  Order_t order;                          // used for homog case
     1655
     1656  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1657  b = pNew();   
    15571658
    15581659  order = a2->Order;              // inits order for homog case
     
    16031704      a = pNext(a) = b;       // append b to result and advance a1
    16041705      pIter(a1);
    1605       b = pNew();
    1606       if (a1 == NULL) goto Finish; // are we done?
     1706      if (a1 == NULL)         // are we done?
     1707      {
     1708        b = pNew();
     1709        goto Finish;
     1710      }
     1711      b = pNew();
    16071712      pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom
    16081713      goto Top;
     
    16161721     spMultCopyX(a1, monom, a, tneg, spNoether);
    16171722   ;
    1618    pFree1(b);
     1723   if (b != NULL) pFree1(b);
    16191724}
    16201725static void spSpolyLoop_chMODP_otEXP_homYES_nwODD
     
    16221727{
    16231728  poly a = monom,                         // collects the result
    1624        b = pNew(),                        // stores a1*monom
    1625        c;                                 // used for temporary storage
    1626   number tm   = pGetCoeff(monom),         // coefficient of monom
    1627          tneg = npNegM(tm),        // - (coefficient of monom)
    1628          tb;                              // used for tm*coeff(a1)
    1629   Order_t order;                          // used for homog case
    1630 
    1631   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1729       b = NULL,                          // stores a1*monom
     1730       c;                                 // used for temporary storage
     1731  number tm   = pGetCoeff(monom),         // coefficient of monom
     1732         tneg = npNegM(tm),        // - (coefficient of monom)
     1733         tb;                              // used for tm*coeff(a1)
     1734  Order_t order;                          // used for homog case
     1735
     1736  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1737  b = pNew();   
    16321738
    16331739  order = a2->Order;              // inits order for homog case
     
    16781784      a = pNext(a) = b;       // append b to result and advance a1
    16791785      pIter(a1);
    1680       b = pNew();
    1681       if (a1 == NULL) goto Finish; // are we done?
     1786      if (a1 == NULL)         // are we done?
     1787      {
     1788        b = pNew();
     1789        goto Finish;
     1790      }
     1791      b = pNew();
    16821792      pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom
    16831793      goto Top;
     
    16911801     spMultCopyX(a1, monom, a, tneg, spNoether);
    16921802   ;
    1693    pFree1(b);
     1803   if (b != NULL) pFree1(b);
    16941804}
    16951805static void spSpolyLoop_chMODP_otEXP_homYES_nwONE
     
    16971807{
    16981808  poly a = monom,                         // collects the result
    1699        b = pNew(),                        // stores a1*monom
    1700        c;                                 // used for temporary storage
    1701   number tm   = pGetCoeff(monom),         // coefficient of monom
    1702          tneg = npNegM(tm),        // - (coefficient of monom)
    1703          tb;                              // used for tm*coeff(a1)
    1704   Order_t order;                          // used for homog case
    1705 
    1706   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1809       b = NULL,                          // stores a1*monom
     1810       c;                                 // used for temporary storage
     1811  number tm   = pGetCoeff(monom),         // coefficient of monom
     1812         tneg = npNegM(tm),        // - (coefficient of monom)
     1813         tb;                              // used for tm*coeff(a1)
     1814  Order_t order;                          // used for homog case
     1815
     1816  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1817  b = pNew();   
    17071818
    17081819  order = a2->Order;              // inits order for homog case
     
    17531864      a = pNext(a) = b;       // append b to result and advance a1
    17541865      pIter(a1);
    1755       b = pNew();
    1756       if (a1 == NULL) goto Finish; // are we done?
     1866      if (a1 == NULL)         // are we done?
     1867      {
     1868        b = pNew();
     1869        goto Finish;
     1870      }
     1871      b = pNew();
    17571872      pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom
    17581873      goto Top;
     
    17661881     spMultCopyX(a1, monom, a, tneg, spNoether);
    17671882   ;
    1768    pFree1(b);
     1883   if (b != NULL) pFree1(b);
    17691884}
    17701885static void spSpolyLoop_chMODP_otEXP_homYES_nwTWO
     
    17721887{
    17731888  poly a = monom,                         // collects the result
    1774        b = pNew(),                        // stores a1*monom
    1775        c;                                 // used for temporary storage
    1776   number tm   = pGetCoeff(monom),         // coefficient of monom
    1777          tneg = npNegM(tm),        // - (coefficient of monom)
    1778          tb;                              // used for tm*coeff(a1)
    1779   Order_t order;                          // used for homog case
    1780 
    1781   if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1889       b = NULL,                          // stores a1*monom
     1890       c;                                 // used for temporary storage
     1891  number tm   = pGetCoeff(monom),         // coefficient of monom
     1892         tneg = npNegM(tm),        // - (coefficient of monom)
     1893         tb;                              // used for tm*coeff(a1)
     1894  Order_t order;                          // used for homog case
     1895
     1896  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     1897  b = pNew();   
    17821898
    17831899  order = a2->Order;              // inits order for homog case
     
    18281944      a = pNext(a) = b;       // append b to result and advance a1
    18291945      pIter(a1);
    1830       b = pNew();
    1831       if (a1 == NULL) goto Finish; // are we done?
     1946      if (a1 == NULL)         // are we done?
     1947      {
     1948        b = pNew();
     1949        goto Finish;
     1950      }
     1951      b = pNew();
    18321952      pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom
    18331953      goto Top;
     
    18411961     spMultCopyX(a1, monom, a, tneg, spNoether);
    18421962   ;
    1843    pFree1(b);
     1963   if (b != NULL) pFree1(b);
    18441964}
    18451965static spSpolyLoopProc spGetSpolyLoop(Characteristics ch,OrderingTypes ot,Homogs hom,NumWords nw)
  • Singular/spSpolyLoop.pl

    r1d142c rdf3483a  
    11#!/usr/local/bin/perl
    22###########################################################################
    3 # $Id: spSpolyLoop.pl,v 1.6 1998-04-06 17:59:36 obachman Exp $
     3# $Id: spSpolyLoop.pl,v 1.7 1998-04-30 15:27:25 obachman Exp $
    44
    55###########################################################################
     
    250250{
    251251  poly a = monom,                         // collects the result
    252        b = pNew(),                        // stores a1*monom
     252       b = NULL,                          // stores a1*monom
    253253       c;                                 // used for temporary storage
    254254  number tm   = pGetCoeff(monom),         // coefficient of monom
     
    258258
    259259  if (a2==NULL) goto Finish;              // we are done if a2 is 0
     260  b = pNew();   
    260261
    261262  CALL_INITORDER(order, a2);              // inits order for homog case
     
    306307      a = pNext(a) = b;       // append b to result and advance a1
    307308      pIter(a1);
     309      if (a1 == NULL)         // are we done?
     310      {
     311        b = pNew();
     312        goto Finish;
     313      }
    308314      b = pNew();
    309       if (a1 == NULL) goto Finish; // are we done?
    310315      CALL_PCOPYADDFAST(b, a1, monom, order); // No! So, update b = a1*monom
    311316      goto Top;
     
    319324     CALL_MULTCOPYX(a1, monom, a, tneg, spNoether);
    320325   CALL_NDELETE("&tneg");
    321    pFree1(b);
     326   if (b != NULL) pFree1(b);
    322327}
    323328
     
    427432      $res = $res."NonZeroTestA($d, pOrdSgn, goto NotEqual);\n";
    428433    }
    429     $nw = &GetNumWords($argv);
    430     $rargv =  $rargv."_".$nw;
    431     $res = join("_", $res, pMonComp, $ot, $nw);
    432     if ($nw eq "nwONE" || $nw eq "nwTWO")
    433     {
    434       $res = $res."($p1, $p2, $d, NonZeroA($d, pLexSgn, goto NotEqual ), goto Equal);"
    435     }
    436     else
    437     {
    438       $res = $res."($p1, $p2, pVariables1W, $d, NonZeroA($d, pLexSgn, goto NotEqual ), goto Equal);";
    439     }
     434#     $rargv =  $rargv."_nwGEN";
     435#     $res = join("_", $res, pMonComp, $ot, "nwGEN");
     436#     $res = $res."($p1, $p2, pVariables1W, $d, NonZeroA($d, pLexSgn, goto NotEqual ), goto Equal);";
     437     $nw = &GetNumWords($argv);
     438     $rargv =  $rargv."_".$nw;
     439     $res = join("_", $res, pMonComp, $ot, $nw);
     440     if ($nw eq "nwONE" || $nw eq "nwTWO")
     441     {
     442       $res = $res."($p1, $p2, $d, NonZeroA($d, pLexSgn, goto NotEqual ), goto Equal);"
     443     }
     444     else
     445     {
     446       $res = $res."($p1, $p2, pVariables1W, $d, NonZeroA($d, pLexSgn, goto NotEqual ), goto Equal);";
     447     }
    440448    return $res;
    441449  }
Note: See TracChangeset for help on using the changeset viewer.