Changeset 9d3636 in git


Ignore:
Timestamp:
Feb 11, 2003, 5:28:51 PM (21 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
0191db90f1b4ad6d544bae570504054ff0db0eaf
Parents:
2d5452f3d3805a37d772af1fae5d485b759089df
Message:
*hannes: SW_NTL_SORT


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

Legend:

Unmodified
Added
Removed
  • factory/NTLconvert.cc

    r2d5452 r9d3636  
    1 /* $Id: NTLconvert.cc,v 1.5 2003-02-04 16:24:59 Singular Exp $ */
     1/* $Id: NTLconvert.cc,v 1.6 2003-02-11 16:28:48 Singular Exp $ */
    22#include <config.h>
    33
     
    292292}
    293293
     294static int
     295NTLcmpCF( const CFFactor & f, const CFFactor & g )
     296{
     297  if (f.exp() > g.exp()) return 1;
     298  if (f.exp() < g.exp()) return 0;
     299  if (f.factor() > g.factor()) return 1;
     300  return 0;
     301}
     302
    294303////////////////////////////////////////////////////////////////////////////////
    295304// NAME: convertNTLvec_pair_ZZpX_long2FacCFFList                              //
     
    326335  // so it is omitted
    327336
    328   // Start by appending the multiplicity
    329   if (!IsOne(multi))
    330     rueckgabe.append(CFFactor(CanonicalForm(to_long(rep(multi))),1));
    331337
    332338  // Go through the vector e and compute the CFFList
     
    336342    rueckgabe.append(CFFactor(convertNTLZZpX2CF(e[i].a,x),e[i].b));
    337343  }
    338 
     344  if(isOn(SW_USE_NTL_SORT)) rueckgabe.sort(NTLcmpCF);
     345  // the multiplicity at pos 1
     346  if (!IsOne(multi))
     347    rueckgabe.insert(CFFactor(CanonicalForm(to_long(rep(multi))),1));
    339348  return rueckgabe;
    340349}
     
    394403    rueckgabe.append(CFFactor(bigone,exponent));
    395404  }
    396 
     405  if(isOn(SW_USE_NTL_SORT)) rueckgabe.sort(NTLcmpCF);
    397406  return rueckgabe;
    398407}
     
    607616
    608617
    609   // Start by appending the multiplicity
    610 
    611   //if (!IsOne(multi))
    612     rueckgabe.append(CFFactor(convertZZ2CF(multi),1));
    613 
    614618  // Go through the vector e and build up the CFFList
    615619  // As usual bigone summarizes the result
     
    634638    rueckgabe.append(CFFactor(bigone,exponent));
    635639  }
     640  if(isOn(SW_USE_NTL_SORT)) rueckgabe.sort(NTLcmpCF);
     641  // the multiplicity at pos 1
     642  //if (!IsOne(multi))
     643    rueckgabe.insert(CFFactor(convertZZ2CF(multi),1));
     644
    636645  //return the converted list
    637646  return rueckgabe;
     
    690699  //important for the factorization, but nevertheless would take computing time, so it is omitted
    691700
    692 
    693   // Start by appending the multiplicity
    694   if (!IsOne(multi))
    695     rueckgabe.append(CFFactor(convertNTLZZpE2CF(multi,alpha),1));
    696 
    697 
    698701  // Go through the vector e and build up the CFFList
    699702  // As usual bigone summarizes the result during every loop
     
    720723      }
    721724    }
    722 
    723725    //append the computed polynomials together with its exponent to the CFFList
    724726    rueckgabe.append(CFFactor(bigone,exponent));
    725 
    726   }
     727  }
     728  if(isOn(SW_USE_NTL_SORT)) rueckgabe.sort(NTLcmpCF);
     729  // Start by appending the multiplicity
     730  if (!IsOne(multi))
     731    rueckgabe.insert(CFFactor(convertNTLZZpE2CF(multi,alpha),1));
     732
    727733  //return the computed CFFList
    728734  return rueckgabe;
     
    788794  for (int i=e.length()-1;i>=0;i--)
    789795  {
    790      bigone=0;
    791 
    792      polynom=e[i].a;
    793      exponent=e[i].b;
    794 
    795      for (int j=0;j<deg(polynom)+1;j++)
    796      {
    797        if (IsOne(coeff(polynom,j)))
    798        {
    799          bigone+=power(x,j);
    800        }
    801        else
    802        {
    803          CanonicalForm coefficient=convertNTLGF2E2CF(coeff(polynom,j),alpha);
    804          if (coeff(polynom,j)!=0)
    805          {
    806            bigone += (power(x,j)*coefficient);
    807          }
    808        }
    809      }
    810 
    811      // append the computed polynomial together with its multiplicity
    812      rueckgabe.append(CFFactor(bigone,exponent));
    813 
    814    }
    815    // return the computed CFFList
     796    bigone=0;
     797
     798    polynom=e[i].a;
     799    exponent=e[i].b;
     800
     801    for (int j=0;j<deg(polynom)+1;j++)
     802    {
     803      if (IsOne(coeff(polynom,j)))
     804      {
     805        bigone+=power(x,j);
     806      }
     807      else
     808      {
     809        CanonicalForm coefficient=convertNTLGF2E2CF(coeff(polynom,j),alpha);
     810        if (coeff(polynom,j)!=0)
     811        {
     812          bigone += (power(x,j)*coefficient);
     813        }
     814      }
     815    }
     816
     817    // append the computed polynomial together with its multiplicity
     818    rueckgabe.append(CFFactor(bigone,exponent));
     819
     820  }
     821  if(isOn(SW_USE_NTL_SORT)) rueckgabe.sort(NTLcmpCF);
     822  // return the computed CFFList
    816823  return rueckgabe;
    817824}
     
    852859  return result;
    853860}
    854 
    855 
    856861#endif
  • factory/cf_defs.h

    r2d5452 r9d3636  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: cf_defs.h,v 1.8 2002-07-30 15:23:15 Singular Exp $ */
     2/* $Id: cf_defs.h,v 1.9 2003-02-11 16:28:50 Singular Exp $ */
    33
    44#ifndef INCL_CF_DEFS_H
     
    3737const int SW_USE_NTL=8;
    3838const int SW_USE_NTL_GCD=9;
     39const int SW_USE_NTL_SORT=10;
    3940//}}}
    4041
  • factory/templates/ftmpl_list.cc

    r2d5452 r9d3636  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: ftmpl_list.cc,v 1.7 1998-03-10 14:51:32 schmidt Exp $ */
     2/* $Id: ftmpl_list.cc,v 1.8 2003-02-11 16:28:51 Singular Exp $ */
    33
    44#include <factoryconf.h>
     
    311311{
    312312    if ( first != last ) {
    313         int swap = 1;
    314         while ( swap ) {
     313        int swap;
     314        do {
    315315            swap = 0;
    316316            ListItem<T> *cur = first;
     
    324324                cur = cur->next;
    325325            }
    326         }
     326        } while (swap);
    327327    }
    328328}
Note: See TracChangeset for help on using the changeset viewer.