Changeset 3aab7b in git


Ignore:
Timestamp:
Jun 25, 2008, 5:37:25 PM (16 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
19d1fac34461d4e329153e0e8bc2a41090b7e60e
Parents:
17c0fde8f413be9755c6ad3adfaf7e2c678775dc
Message:
*hannes: rAssure_Tdegree and opt.


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

Legend:

Unmodified
Added
Removed
  • kernel/ring.cc

    r17c0fd r3aab7b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ring.cc,v 1.84 2008-06-19 12:39:56 wienand Exp $ */
     4/* $Id: ring.cc,v 1.85 2008-06-25 15:37:25 Singular Exp $ */
    55
    66/*
     
    10581058#ifdef HAVE_PLURAL
    10591059      && !rIsPluralRing(r1) && !rIsPluralRing(r2)
    1060 #endif     
     1060#endif
    10611061     )
    10621062  {
     
    11901190    {
    11911191      int b=rBlocks(r1);
    1192  
     1192
    11931193      tmpR.order=(int*)omAlloc0(b*sizeof(int));
    11941194      tmpR.block0=(int*)omAlloc0(b*sizeof(int));
     
    13131313      idTest((ideal)D);
    13141314
    1315  
     1315
    13161316      for (i=1; i<= rVar(R2); i++)
    13171317        for (j=i+1; j<=rVar(R2); j++)
     
    13391339
    13401340      Print("\nRefs: R1: %d, R2: %d\n", R1->GetNC()->ref, R2->GetNC()->ref);
    1341      
    1342 #endif
    1343 #endif
    1344 
    1345          
     1341
     1342#endif
     1343#endif
     1344
     1345
    13461346      rDelete(R1);
    13471347      rDelete(R2);
     
    13551355      rChangeCurrRing(old_ring);
    13561356    }
    1357  
     1357
    13581358  }
    13591359#endif
     
    24452445  res->GetNC() = NULL;
    24462446#endif
    2447  
     2447
    24482448  // res->qideal, res->idroot ???
    24492449  res->wvhdl=wvhdl;
     
    24962496      WarnS("error in nc_rComplete");
    24972497      // cleanup?
    2498      
     2498
    24992499//      rDelete(res);
    25002500//      return r;
     
    25042504  }
    25052505#endif
    2506  
     2506
    25072507  return res;
    25082508}
     
    25162516  res->GetNC() = NULL;
    25172517#endif
    2518  
     2518
    25192519  /*weights: entries for 3 blocks: NULL*/
    25202520  res->wvhdl = (int **)omAlloc0(3 * sizeof(int_ptr));
     
    25872587#ifdef HAVE_PLURAL
    25882588    res->GetNC() = NULL;
    2589 #endif   
     2589#endif
    25902590    // res->qideal, res->idroot ???
    25912591    res->wvhdl=wvhdl;
     
    36933693#endif
    36943694#endif
    3695    
     3695
    36963696
    36973697    if (old_ring->qideal != NULL)
     
    37043704      if( rIsPluralRing(r) )
    37053705        nc_SetupQuotient(r);
    3706 #endif     
     3706#endif
    37073707    }
    37083708  }
     
    37183718#endif
    37193719#endif
    3720      
     3720
    37213721  return r;
    37223722}
     
    37293729  int j;
    37303730
    3731   res->order=(int *)omAlloc0((i+1)*sizeof(int));
    3732   for(j=i;j>0;j--) res->order[j]=r->order[j-1];
    3733   res->order[0]=ringorder_s;
    3734 
     3731  res->order=(int *)omAlloc((i+1)*sizeof(int));
    37353732  res->block0=(int *)omAlloc0((i+1)*sizeof(int));
    3736   for(j=i;j>0;j--) res->block0[j]=r->block0[j-1];
    3737 
    37383733  res->block1=(int *)omAlloc0((i+1)*sizeof(int));
    3739   for(j=i;j>0;j--) res->block1[j]=r->block1[j-1];
    3740 
    37413734  int ** wvhdl =(int **)omAlloc0((i+1)*sizeof(int**));
    37423735  for(j=i;j>0;j--)
    37433736  {
     3737    res->order[j]=r->order[j-1];
     3738    res->block0[j]=r->block0[j-1];
     3739    res->block1[j]=r->block1[j-1];
    37443740    if (r->wvhdl[j-1] != NULL)
    37453741    {
     
    37473743    }
    37483744  }
     3745  res->order[0]=ringorder_s;
     3746
    37493747  res->wvhdl = wvhdl;
    37503748
     
    37683766    }
    37693767#endif
    3770    
    3771   }
     3768
     3769  }
     3770  return res;
     3771}
     3772
     3773ring rAssure_TDeg(ring r, int start_var, int end_var, int &pos)
     3774{
     3775  int i;
     3776  for(i=r->OrdSize;i>=0;i--)
     3777  {
     3778    if ((r->typ[i].ord_typ==ro_dp)
     3779    && (r->typ[i].data.dp.start==start_var)
     3780    && (r->typ[i].data.dp.end==end_var))
     3781    {
     3782      pos=r->typ[i].data.dp.place;
     3783      return r;
     3784    }
     3785  }
     3786  ring res=rCopy0(r, FALSE, FALSE);
     3787  i=rBlocks(r);
     3788  int j;
     3789
     3790  res->order=(int *)omMemDup(r->order);
     3791  res->block0=(int *)omMemDup(r->block0);
     3792  res->block1=(int *)omMemDup(r->block1);
     3793  int ** wvhdl =(int **)omAlloc0(i*sizeof(int**));
     3794  for(j=i-1;j>=0;j--)
     3795  {
     3796    if (r->wvhdl[j] != NULL)
     3797    {
     3798      wvhdl[j] = (int*) omMemDup(r->wvhdl[j-1]);
     3799    }
     3800  }
     3801  res->wvhdl = wvhdl;
     3802
     3803  res->ExpL_Size=r->ExpL_Size+1; // one word more in each monom
     3804  res->CmpL_Size=r->CmpL_Size;
     3805  res->PolyBin=omGetSpecBin(POLYSIZE + (res->ExpL_Size)*sizeof(long));
     3806  res->ordsgn=(long *)omAlloc0(res->ExpL_Size*sizeof(long));
     3807  for(j=0;j<r->CmpL_Size;j++)
     3808  {
     3809    res->ordsgn[j] = r->ordsgn[j];
     3810  }
     3811  res->OrdSize=r->OrdSize+1;   // one block more for pSetm
     3812  res->typ=(sro_ord*)omAlloc(res->OrdSize*sizeof(sro_ord));
     3813  if (r->typ!=NULL)
     3814    memcpy(res->typ,r->typ,r->OrdSize*sizeof(sro_ord));
     3815  // the additionla block for pSetm: total degree at the last word
     3816  // but not included in the compare part
     3817  res->typ[res->OrdSize].ord_typ=ro_dp;
     3818  res->typ[res->OrdSize].data.dp.start=start_var;
     3819  res->typ[res->OrdSize].data.dp.end=end_var;
     3820  res->typ[res->OrdSize].data.dp.place=res->ExpL_Size-1;
     3821  pos=res->ExpL_Size-1;
     3822#ifdef HAVE_PLURAL
     3823  if (rIsPluralRing(res))
     3824  {
     3825    if ( nc_rComplete(r, res, false) ) // no qideal!
     3826    {
     3827      WarnS("error in nc_rComplete");
     3828    // just go on..
     3829    }
     3830  }
     3831#endif
    37723832  return res;
    37733833}
     
    37783838  int i=0;
    37793839  do
    3780   { 
     3840  {
    37813841     if (r->order[i] == ringorder_c ||
    37823842        r->order[i] == ringorder_C) return r;
     
    37873847  //WarnS("re-creating ring with comps");
    37883848  last_block=i-1;
    3789  
     3849
    37903850  ring new_r = rCopy0(r, FALSE, FALSE);
    37913851  i+=2;
     
    38063866  last_block++;
    38073867  new_r->order[last_block]=ringorder_C;
    3808   new_r->block0[last_block]=0;
    3809   new_r->block1[last_block]=0;
     3868  //new_r->block0[last_block]=0;
     3869  //new_r->block1[last_block]=0;
    38103870  //new_r->wvhdl[last_block]=NULL;
    38113871
     
    38273887  }
    38283888#endif
    3829  
     3889
    38303890  return new_r;
    38313891}
     
    38813941        }
    38823942#endif
    3883        
     3943
    38843944      }
    38853945      return new_r;
     
    39303990    }
    39313991#endif
    3932    
     3992
    39333993    rChangeCurrRing(new_r);
    39343994    if (old_r->qideal != NULL)
     
    39414001        nc_SetupQuotient( new_r );
    39424002#endif
    3943      
     4003
    39444004    }
    39454005    rTest(new_r);
     
    41714231  ring save = currRing;
    41724232  rChangeCurrRing(src);
    4173  
     4233
    41744234  ring r = rCopy0(src,TRUE); /* TRUE for copy the qideal */
    41754235  /*  rChangeCurrRing(r); */
     
    43824442  rComplete(r);
    43834443
    4384  
     4444
    43854445#ifdef RDEBUG
    43864446  //   rDebugPrint(r);
     
    43884448#endif
    43894449
    4390   rChangeCurrRing(r); 
     4450  rChangeCurrRing(r);
    43914451
    43924452#ifdef HAVE_PLURAL
     
    43954455  {
    43964456    assume( currRing == r);
    4397    
     4457
    43984458    int *perm       = (int *)omAlloc0((rVar(r)+1)*sizeof(int));
    43994459    int *par_perm   = NULL;
     
    44344494    omFreeSize((ADDRESS)perm,(rVar(r)+1)*sizeof(int));
    44354495
    4436     rChangeCurrRing(save); 
    4437  
     4496    rChangeCurrRing(save);
     4497
    44384498  }
    44394499#endif /* HAVE_PLURAL */
     
    44724532
    44734533#ifdef HAVE_PLURAL
    4474 BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient) 
     4534BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
    44754535/* returns TRUE is there were errors */
    44764536/* dest is actualy equals src with the different ordering */
     
    44814541// ring created by dirty hack (without nc_CallPlural)
    44824542
    4483   assume(!rIsPluralRing(dest)); // destination must be a newly constructed commutative ring 
     4543  assume(!rIsPluralRing(dest)); // destination must be a newly constructed commutative ring
    44844544
    44854545  if (!rIsPluralRing(src))
     
    44984558
    44994559  const ring srcBase = src->GetNC()->basering;
    4500  
     4560
    45014561  assume( nSetMap(srcBase) == nSetMap(currRing) ); // currRing is important here!
    4502  
     4562
    45034563  matrix C = mpNew(N,N); // ring independent
    45044564  matrix D = mpNew(N,N);
     
    45204580      MATELEM(C,i,j) = p;
    45214581      if (MATELEM(D0,i,j) != NULL)
    4522         MATELEM(D,i,j) = prCopyR(MATELEM(D0,i,j), srcBase, dest); // ? 
     4582        MATELEM(D,i,j) = prCopyR(MATELEM(D0,i,j), srcBase, dest); // ?
    45234583    }
    45244584  }
    45254585  /* One must test C and D _only_ in r->GetNC()->basering!!! not in r!!! */
    4526  
     4586
    45274587  idTest((ideal)C); // in dest!
    45284588  idTest((ideal)D);
     
    45304590  if (nc_CallPlural(C, D, NULL, NULL, dest, bSetupQuotient, false, true, dest)) // also takes care about quotient ideal
    45314591  {
    4532     //WarnS("Error transferring non-commutative structure"); 
     4592    //WarnS("Error transferring non-commutative structure");
    45334593    // error message should be in the interpreter interface
    45344594
     
    45384598    if (currRing != save)
    45394599       rChangeCurrRing(save);
    4540    
     4600
    45414601    return TRUE;
    45424602  }
    4543  
     4603
    45444604//  mpDelete(&C, dest); // used by nc_CallPlural!
    45454605//  mpDelete(&D, dest);
     
    45474607  if (dest != save)
    45484608    rChangeCurrRing(save);
    4549  
     4609
    45504610  return FALSE;
    45514611}
Note: See TracChangeset for help on using the changeset viewer.