Changeset cf108d in git


Ignore:
Timestamp:
May 13, 2005, 5:18:52 PM (19 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
b6eb14fd348d7efc8e50676bd4a3f35a83516571
Parents:
a3f22cbee52ae2c26a1ce34153c4f67a6daeddd1
Message:
* hannes: weights for modulo/prune


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

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    ra3f22c rcf108d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: iparith.cc,v 1.359 2005-05-12 14:25:02 Singular Exp $ */
     4/* $Id: iparith.cc,v 1.360 2005-05-13 15:18:48 Singular Exp $ */
    55
    66/*
     
    19031903{
    19041904  assumeStdFlag(u);
    1905   intvec *module_w=(intvec*)atGet(u,"isHomog");
     1905  intvec *module_w=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
    19061906  intvec *iv=hFirstSeries((ideal)u->Data(),module_w,currQuotient);
    19071907  switch((int)v->Data())
     
    20152015static BOOLEAN jjMODULO(leftv res, leftv u, leftv v)
    20162016{
    2017   res->data = (char *)idModulo((ideal)u->Data(),(ideal)v->Data());
     2017  intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
     2018  tHomog hom=testHomog;
     2019  if (w_u!=NULL)
     2020  {
     2021    w_u=ivCopy(w_u);
     2022    hom=isHomog;
     2023  }
     2024  intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
     2025  if (w_v!=NULL)
     2026  {
     2027    w_v=ivCopy(w_v);
     2028    hom=isHomog;
     2029  }
     2030  if ((w_u!=NULL) && (w_v==NULL))
     2031    w_v=ivCopy(w_u);
     2032  if ((w_v!=NULL) && (w_u==NULL))
     2033    w_u=ivCopy(w_v);
     2034  ideal u_id=(ideal)u->Data();
     2035  ideal v_id=(ideal)v->Data();
     2036  if (w_u!=NULL)
     2037  {
     2038     if ((*w_u).compare((w_v))!=0)
     2039     {
     2040       WarnS("incompatible weights");
     2041       delete w_u; w_u=NULL;
     2042       hom=testHomog;
     2043     }
     2044     else
     2045     {
     2046       if ((!idHomModule(u_id,currQuotient,&w_v))
     2047       || (!idHomModule(v_id,currQuotient,&w_v)))
     2048       {
     2049         WarnS("wrong weights");
     2050         delete w_u; w_u=NULL;
     2051         hom=testHomog;
     2052       }
     2053     }
     2054  }
     2055  res->data = (char *)idModulo(u_id,v_id ,hom,&w_u);
     2056  if (w_u!=NULL)
     2057  {
     2058    atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
     2059  }
     2060  delete w_v;
    20182061  return FALSE;
    20192062}
     
    22502293    }
    22512294  }
     2295
    22522296  intvec *ww=NULL;
    22532297  int add_row_shift=0;
     
    22582302     (*ww) -= add_row_shift;
    22592303  }
     2304  else
     2305    idHomModule(u_id,currQuotient,&ww);
     2306  weights=ww;
    22602307
    22612308  if ((iiOp == RES_CMD) || (iiOp == MRES_CMD))
     
    23062353  r->list_length=wmaxl;
    23072354  res->data=(void *)r;
     2355  if ((r->weights!=NULL) && (r->weights[0]!=NULL))
     2356  {
     2357    intvec *w=ivCopy(r->weights[0]);
     2358    if (weights!=NULL) (*w) += add_row_shift;
     2359    atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
     2360    delete w;
     2361  }
     2362  else
     2363  {
     2364#if 0
     2365// need to set weights for ALL components (sres)
     2366    if (weights!=NULL)
     2367    {
     2368      atSet(res,omStrDup("isHomog"),ivCopy(weights),INTVEC_CMD);
     2369      r->weights = (intvec**)omAlloc0Bin(void_ptr_bin);
     2370      (r->weights)[0] = ivCopy(weights);
     2371    }
     2372#endif
     2373  }
    23082374  if (ww!=NULL) { delete ww; ww=NULL; }
    2309   if ((r->weights!=NULL) && (r->weights[0]!=NULL))
    2310   {
    2311     ww=ivCopy(r->weights[0]);
    2312     if (weights!=NULL) (*ww) += add_row_shift;
    2313     atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
    2314   }
    2315   else if (atGet(res,"isHomog",INTVEC_CMD)==NULL)
    2316   {
    2317     if (weights!=NULL)
    2318     {
    2319       atSet(res,omStrDup("isHomog"),ivCopy(weights),INTVEC_CMD);
    2320     }
    2321   }
    23222375  return FALSE;
    23232376}
     
    24372490{
    24382491  ideal result;
    2439   intvec *w=(intvec *)atGet(u,"isHomog");
     2492  intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
    24402493  tHomog hom=testHomog;
    24412494  if (w!=NULL)
     
    24552508  assumeStdFlag(u);
    24562509  ideal result;
    2457   intvec *w=(intvec *)atGet(u,"isHomog");
     2510  intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
    24582511  tHomog hom=testHomog;
    24592512  if (w!=NULL)
     
    30003053{
    30013054  assumeStdFlag(v);
    3002   intvec *module_w=(intvec*)atGet(v,"isHomog");
     3055  intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
    30033056  scDegree((ideal)v->Data(),module_w,currQuotient);
    30043057  return FALSE;
     
    31603213{
    31613214  assumeStdFlag(v);
    3162   intvec *w=(intvec*)atGet(v,"isHomog");
     3215  intvec *w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
    31633216  BOOLEAN delete_w=FALSE;
    31643217  ideal I=(ideal)v->Data();
     
    32073260{
    32083261  assumeStdFlag(v);
    3209   intvec *module_w=(intvec*)atGet(v,"isHomog");
     3262  intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
    32103263  //scHilbertPoly((ideal)v->Data(),currQuotient);
    32113264  hLookSeries((ideal)v->Data(),module_w,currQuotient);
     
    35423595static BOOLEAN jjPRUNE(leftv res, leftv v)
    35433596{
    3544   res->data = (char *)idMinEmbedding((ideal)v->Data());
     3597  intvec *w=ivCopy((intvec *)atGet(v,"isHomog",INTVEC_CMD));
     3598  intvec **ww=&w;
     3599  res->data = (char *)idMinEmbedding((ideal)v->Data(),FALSE,ww);
     3600  atSet(res,omStrDup("isHomog"),*ww,INTVEC_CMD);
    35453601  return FALSE;
    35463602}
     
    36293685{
    36303686  ideal result;
    3631   intvec *w=(intvec *)atGet(v,"isHomog");
     3687  intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
    36323688  tHomog hom=testHomog;
    36333689  if (w!=NULL)
     
    46544710{
    46554711  assumeStdFlag(u);
    4656   intvec *module_w=(intvec *)atGet(u,"isHomog");
     4712  intvec *module_w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
    46574713  intvec *wdegree=(intvec*)w->Data();
    46584714  if (wdegree->length()!=pVariables)
     
    50195075  if ((iiOp == RES_CMD) || (iiOp == MRES_CMD))
    50205076  {
    5021     intvec * iv=(intvec*)atGet(u,"isHomog");
     5077    intvec * iv=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
    50225078    if (iv!=NULL)
    50235079    {
     
    50545110{
    50555111  ideal result;
    5056   intvec *ww=(intvec *)atGet(u,"isHomog");
     5112  intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
    50575113  tHomog hom=testHomog;
    50585114  if (ww!=NULL)
  • Singular/ipprint.cc

    ra3f22c rcf108d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ipprint.cc,v 1.20 2001-03-27 17:12:54 Singular Exp $ */
     4/* $Id: ipprint.cc,v 1.21 2005-05-13 15:18:50 Singular Exp $ */
    55/*
    66* ABSTRACT: interpreter: printing
     
    286286{
    287287  int i,j;
    288   int row_shift=(int)atGet(u,"rowShift");
     288  int row_shift=(int)atGet(u,"rowShift",INT_CMD);
    289289  intvec * betti=(intvec *)u->Data();
    290290  // head line --------------------------------------------------------
  • kernel/ideals.cc

    ra3f22c rcf108d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ideals.cc,v 1.11 2005-04-25 18:15:23 Singular Exp $ */
     4/* $Id: ideals.cc,v 1.12 2005-05-13 15:18:52 Singular Exp $ */
    55/*
    66* ABSTRACT - all basic methods to manipulate ideals
     
    32233223* represents (h1+h2)/h2=h1/(h1 intersect h2)
    32243224*/
    3225 ideal idModulo (ideal h2,ideal h1)
    3226 {
     3225//ideal idModulo (ideal h2,ideal h1)
     3226ideal idModulo (ideal h2,ideal h1, tHomog hom, intvec ** w)
     3227{
     3228  intvec *wtmp=NULL;
     3229
    32273230  int i,j,k,rk,flength=0,slength,length;
    3228   intvec * w;
    32293231  poly p,q;
    32303232
     
    32403242  }
    32413243  ideal temp = idInit(IDELEMS(h2),length+IDELEMS(h2));
     3244  if ((w!=NULL)&&((*w)!=NULL))
     3245  {
     3246    //Print("input weights:");(*w)->show(1);PrintLn();
     3247    int d;
     3248    int k;
     3249    wtmp=new intvec(length+IDELEMS(h2));
     3250    for (i=0;i<length;i++)
     3251      ((*wtmp)[i])=(**w)[i];
     3252    for (i=0;i<IDELEMS(h2);i++)
     3253    {
     3254      d = pDeg(h2->m[i]);
     3255      k= pGetComp(h2->m[i]);
     3256      if (slength>0) k--;
     3257      d +=((**w)[k]);
     3258      ((*wtmp)[i+length]) = d;
     3259    }
     3260    //Print("weights:");wtmp->show(1);PrintLn();
     3261  }
    32423262  for (i=0;i<IDELEMS(h2);i++)
    32433263  {
     
    32873307
    32883308  idTest(s_temp);
    3289   ideal s_temp1 = kStd(s_temp,currQuotient,testHomog,&w,NULL,length);
    3290   if (w!=NULL) delete w;
     3309  ideal s_temp1 = kStd(s_temp,currQuotient,hom,&wtmp,NULL,length);
     3310
     3311  //if (wtmp!=NULL)  Print("output weights:");wtmp->show(1);PrintLn();
     3312  if ((w!=NULL) && (*w !=NULL) && (wtmp!=NULL))
     3313  {
     3314    delete *w;
     3315    *w=new intvec(IDELEMS(h2));
     3316    for (i=0;i<IDELEMS(h2);i++)
     3317      ((**w)[i])=(*wtmp)[i+length];
     3318  }
     3319  if (wtmp!=NULL) delete wtmp;
    32913320
    32923321  for (i=0;i<IDELEMS(s_temp1);i++)
     
    35603589* embedded  module (arg represents the quotient!)
    35613590*/
    3562 ideal idMinEmbedding(ideal arg,BOOLEAN inPlace)
     3591ideal idMinEmbedding(ideal arg,BOOLEAN inPlace, intvec **w)
    35633592{
    35643593  if (idIs0(arg)) return idInit(1,arg->rank);
     
    35733602    syGaussForOne(res,next_gen,next_comp,0,IDELEMS(res));
    35743603    idDeleteComp(res,next_comp);
     3604    if ((w !=NULL)&&(*w!=NULL))
     3605    {
     3606      intvec *wtmp=new intvec((*w)->length()-1);
     3607      int i;
     3608      for(i=0;i<next_comp-1;i++) (*wtmp)[i]=(**w)[i];
     3609      for(i=next_comp;i<(*w)->length();i++) (*wtmp)[i-1]=(**w)[i];
     3610      delete *w;
     3611      *w=wtmp;
     3612    }
    35753613  }
    35763614  idSkipZeroes(res);
  • kernel/ideals.h

    ra3f22c rcf108d  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: ideals.h,v 1.3 2005-03-14 16:17:07 Singular Exp $ */
     6/* $Id: ideals.h,v 1.4 2005-05-13 15:18:52 Singular Exp $ */
    77/*
    88* ABSTRACT - all basic methods to manipulate ideals
     
    115115ideal   idCompactify(ideal id);
    116116
    117 ideal idMinEmbedding(ideal arg,BOOLEAN inPlace=FALSE);
     117ideal idMinEmbedding(ideal arg,BOOLEAN inPlace=FALSE, intvec **w=NULL);
    118118
    119119ideal   idHead(ideal h);
     
    143143
    144144intvec *idSort(ideal id,BOOLEAN nolex=TRUE);
    145 ideal   idModulo (ideal h1,ideal h2);
     145ideal   idModulo (ideal h1,ideal h2, tHomog h=testHomog, intvec ** w=NULL);
    146146int     idElem(ideal F);
    147147matrix  idCoeffOfKBase(ideal arg, ideal kbase, poly how);
Note: See TracChangeset for help on using the changeset viewer.