Changeset a09a42 in git for kernel/kstd2.cc


Ignore:
Timestamp:
Jan 16, 2006, 3:02:52 PM (18 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
ce89df54a95c17d936886fb9f5a3c977f877d690
Parents:
e6e28e89e44a9e577c2fdbae4479e7ab4a01d1ca
Message:
*hannes: memeory leaks, formatting


git-svn-id: file:///usr/local/Singular/svn/trunk@8906 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/kstd2.cc

    re6e28e8 ra09a42  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd2.cc,v 1.6 2006-01-16 03:27:10 wienand Exp $ */
     4/* $Id: kstd2.cc,v 1.7 2006-01-16 14:02:51 Singular Exp $ */
    55/*
    66*  ABSTRACT -  Kernel: alg. of Buchberger
     
    164164*/
    165165
    166 long factorial(long arg) {
    167    long tmp = 1;
    168    for (int i = 2; i < arg + 1; i++) {
     166long factorial(long arg)
     167{
     168   long tmp = 1; arg++;
     169   for (int i = 2; i < arg; i++)
     170   {
    169171     tmp = tmp * i;
    170172   }
     
    172174}
    173175
    174 poly kFindZeroPoly(poly input_p, ring leadRing, ring tailRing) {
     176poly kFindZeroPoly(poly input_p, ring leadRing, ring tailRing)
     177{
    175178  // m = currRing->ch
    176179
     
    185188  long k = 1;
    186189
    187   while (a%2 == 0) {
     190  while (a%2 == 0)
     191  {
    188192    a = a / 2;
    189193    a_ind2++;
    190194  }
    191195
    192   for (int i = 1; i <= leadRing->N; i++) {
     196  for (int i = 1; i <= leadRing->N; i++)
     197  {
    193198    a = factorial(pGetExp(p, i));
    194199    k = k * a;
    195     while (a%2 == 0) {
     200    while (a%2 == 0)
     201    {
    196202      a = a / 2;
    197203      k_ind2++;
     
    202208  number tmp1;
    203209  poly tmp2, tmp3;
    204   if (leadRing->ch <= k_ind2 + a_ind2) {
     210  if (leadRing->ch <= k_ind2 + a_ind2)
     211  {
    205212    zeroPoly = p_ISet(a, tailRing);
    206     for (int i = 1; i <= leadRing->N; i++) {
    207       for (long j = 1; j <= pGetExp(p, i); j++) {
     213    for (int i = 1; i <= leadRing->N; i++)
     214    {
     215      for (long j = 1; j <= pGetExp(p, i); j++)
     216      {
    208217        tmp1 = nInit(j);
    209218        tmp2 = p_ISet(1, tailRing);
    210219        p_SetExp(tmp2, i, 1, tailRing);
    211220        p_Setm(tmp2, tailRing);
    212         if (nIsZero(tmp1)) {
     221        if (nIsZero(tmp1))
     222        {
    213223          zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
    214224        }
    215         else {
     225        else
     226        {
    216227          tmp3 = p_ISet((long) tmp1, tailRing);
    217228          zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp2, tmp3, tailRing), tailRing);
     
    221232    zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
    222233    tmp2 = pISet(a);
    223     for (int i = 1; i <= leadRing->N; i++) {
     234    for (int i = 1; i <= leadRing->N; i++)
     235    {
    224236      pSetExp(tmp2, i, pGetExp(p, i));
    225237    }
     
    228240    return tmp2;
    229241  }
    230   if (leadRing->ch - k_ind2 <= a_ind2) {
    231     PrintS("Case not implented yet !!!"); PrintLn();
    232     PrintS("But it should not mae any difference."); PrintLn();
     242  if (leadRing->ch - k_ind2 <= a_ind2)
     243  {
     244    PrintS("Case not implented yet !!!\n");
     245    PrintS("But it should not mae any difference.\n");
    233246    return zeroPoly;
    234247  }
     
    236249}
    237250
    238 poly kFindDivisibleByZeroPoly(LObject* h) {
     251poly kFindDivisibleByZeroPoly(LObject* h)
     252{
    239253  return kFindZeroPoly(h->GetLmCurrRing(), currRing, h->tailRing);
    240254}
    241255
     256#ifdef HAVE_RING2TOM
    242257/*2
    243258*  reduction procedure for the ring Z/2^m
     
    253268  poly zeroPoly;
    254269
    255 #ifdef HAVE_RING2TOM
     270//#ifdef HAVE_RING2TOM
    256271  h->SetpFDeg();
    257272  assume(h->pFDeg() == h->FDeg);
    258   if (h->pFDeg() != h->FDeg) {
     273  if (h->pFDeg() != h->FDeg)
     274  {
    259275    Print("h->pFDeg()=%d =!= h->FDeg=%d\n", h->pFDeg(), h->FDeg);
    260276  }
    261277  long reddeg = h->SetpFDeg();
    262 #else
    263   assume(h->pFDeg() == h->FDeg);
    264   long reddeg = h->GetpFDeg();
    265 #endif
     278//#else
     279//  assume(h->pFDeg() == h->FDeg);
     280//  long reddeg = h->GetpFDeg();
     281//#endif
    266282
    267283  h->SetShortExpVector();
     
    269285  {
    270286    zeroPoly = kFindDivisibleByZeroPoly(h);
    271     if (zeroPoly != NULL) {
     287    if (zeroPoly != NULL)
     288    {
    272289#ifdef KDEBUG
    273290      if (TEST_OPT_DEBUG)
     
    288305      j = strat->tl;
    289306    }
    290     else {
     307    else
     308    {
    291309      j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h);
    292310      if (j < 0) return 1;
     
    359377  }
    360378}
     379#endif
    361380#endif
    362381
Note: See TracChangeset for help on using the changeset viewer.