Changeset 26b68f in git


Ignore:
Timestamp:
Mar 5, 2010, 2:02:28 PM (14 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
78efe9f25ea57c6afdfe8736b026e6d074a3d9d3
Parents:
c1f5e3cc27d7059b5f61b1805f24638a0836a299
Message:
removed ref from nc_struct

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

Legend:

Unmodified
Added
Removed
  • kernel/gring.cc

    rc1f5e3c r26b68f  
    26712671// kills the nc extension of ring r
    26722672{
    2673   r->GetNC()->ref--;
    2674   if (r->GetNC()->ref >= 1) /* in use by somebody else */
    2675   {
    2676     r->GetNC() = NULL; // don't cleanup, just dereference
    2677     return;
    2678   }
    2679   /* otherwise kill the previous nc data */
    2680 
    2681   assume( r->GetNC()->ref == 0 );
    2682 
    26832673  if( r->GetNC()->GetGlobalMultiplier() != NULL )
    26842674  {
     
    27022692      for(j=i+1;j<=rN;j++)
    27032693      {
    2704         id_Delete((ideal *)&(r->GetNC()->MT[UPMATELEM(i,j,rN)]),r->GetNC()->basering);
     2694        id_Delete((ideal *)&(r->GetNC()->MT[UPMATELEM(i,j,rN)]),r);
    27052695      }
    27062696    }
    27072697    omFreeSize((ADDRESS)r->GetNC()->MT,rN*(rN-1)/2*sizeof(matrix));
    27082698    omFreeSize((ADDRESS)r->GetNC()->MTsize,rN*(rN-1)/2*sizeof(int));
    2709     id_Delete((ideal *)&(r->GetNC()->COM),r->GetNC()->basering);
    2710   }
    2711   id_Delete((ideal *)&(r->GetNC()->C),r->GetNC()->basering);
    2712   id_Delete((ideal *)&(r->GetNC()->D),r->GetNC()->basering);
     2699    id_Delete((ideal *)&(r->GetNC()->COM),r);
     2700  }
     2701  id_Delete((ideal *)&(r->GetNC()->C),r);
     2702  id_Delete((ideal *)&(r->GetNC()->D),r);
    27132703
    27142704  if( rIsSCA(r) && (r->GetNC()->SCAQuotient() != NULL) )
    27152705  {
    2716     id_Delete(&r->GetNC()->SCAQuotient(), r->GetNC()->basering); // Custom SCA destructor!!!
    2717   }
    2718 
    2719   r->GetNC()->basering->ref--;
    2720 
    2721   if ((r->GetNC()->basering->ref<=0)&&(r->GetNC()->basering->GetNC()==NULL))
    2722   {
    2723     WarnS("Killing a base ring!");
    2724 //    rWrite(r->GetNC()->basering);
    2725     rKill(r->GetNC()->basering);
    2726   }
     2706    id_Delete(&r->GetNC()->SCAQuotient(), r); // Custom SCA destructor!!!
     2707  }
     2708
    27272709
    27282710  nc_CleanUp(r);
     
    27322714////////////////////////////////////////////////////////////////////////////////////////////////
    27332715
    2734 // share the same nc-structure with a new copy ``res'' of ``r''.
    2735 // used by rCopy only.
    2736 // additionally inits multipication on ``res''!
    2737 // NOTE: update nc structure on res: share NC structure of r with res since they are the same!!!
    2738 // i.e. no data copy!!! Multiplications will be setuped as well!
    2739 inline
    2740 void nc_rCopy0(ring res, const ring r)
    2741 {
    2742   assume(rIsPluralRing(r));
    2743   assume( res != r );
    2744 
    2745   res->GetNC() = r->GetNC();
    2746   res->GetNC()->ref++;
    2747   nc_p_ProcsSet(res, res->p_Procs);
    2748 }
    2749 
    2750 
    2751 
    2752 
    2753 inline void nc_rClean0(ring r) // inverse to nc_rCopy0! ps: no real deletion!
    2754 {
    2755   assume(rIsPluralRing(r));
    2756 
    2757   r->GetNC()->ref--;
    2758   r->GetNC() = NULL;
    2759 // p_ProcsSet(res, r->p_Procs); // ???
    2760 }
    27612716
    27622717poly nc_p_CopyGet(poly a, const ring r)
     
    27732728    return(NULL);
    27742729  }
    2775   if (!rIsPluralRing(r)) return(p_Copy(a,r));
    2776   if (r==r->GetNC()->basering) return(p_Copy(a,r));
    2777   else
    2778   {
    2779     return(prCopyR_NoSort(a,r->GetNC()->basering,r));
    2780   }
     2730  return(p_Copy(a,r));
    27812731}
    27822732
     
    27952745  }
    27962746
    2797   if (!rIsPluralRing(r)) return(p_Copy(a,r));
    2798   if (r==r->GetNC()->basering) return(p_Copy(a,r));
    2799   else
    2800   {
    2801     return(prCopyR_NoSort(a,r,r->GetNC()->basering));
    2802   }
     2747  return(p_Copy(a,r));
    28032748}
    28042749
     
    29232868{
    29242869  assume( r->qideal == NULL ); // The basering must NOT be a qring!
    2925  
     2870
    29262871//  assume( curr != r );
    29272872  assume( rSamePolyRep(r, curr) );
     
    32083153  nc_new->IsSkewConstant = (IsSkewConstant?1:0);
    32093154
    3210   nc_new->ref = 1;
    3211   nc_new->basering = r; // !?
    3212 
    32133155  // Setup new NC structure!!!
    32143156  if (r->GetNC() != NULL)
     
    32593201    WeChangeRing = 1;
    32603202  }
    3261   assume( (currRing == r->GetNC()->basering)
    3262        || ((currRing->GetNC()!=NULL) && (currRing->GetNC()->basering==r->GetNC()->basering)) );   // otherwise we cannot work with all these matrices!
     3203  assume( (currRing == r)
     3204       && (currRing->GetNC()!=NULL) );   // otherwise we cannot work with all these matrices!
    32633205
    32643206  int i,j;
     
    32983240      p_SetExp(p,j,1,r);
    32993241      p_Setm(p,r);
    3300       p_Test(MATELEM(r->GetNC()->D,i,j),r->GetNC()->basering);
     3242      p_Test(MATELEM(r->GetNC()->D,i,j),r);
    33013243      q =  nc_p_CopyGet(MATELEM(r->GetNC()->D,i,j),r);
    33023244      p = p_Add_q(p,q,r);
  • kernel/ring.cc

    rc1f5e3c r26b68f  
    381381#ifndef NDEBUG
    382382      if(r->block0[l] == 0 )
    383         Print("::prefix");
     383        PrintS("::prefix");
    384384      else
    385385        Print("::suffix (sign: %d)", r->block0[l]);
     
    445445            Print("\n//    %s%s=",r->names[j-1],r->names[i-1]);
    446446            pl = MATELEM(r->GetNC()->MT[UPMATELEM(i,j,r->N)],1,1);
    447             p_Write0(pl, r->GetNC()->basering, r->GetNC()->basering);
     447            p_Write0(pl, r, r);
    448448          }
    449449        }
     
    454454    Print("\n//   noncommutative type:%d", (int)ncRingType(r));
    455455    Print("\n//      is skew constant:%d",r->GetNC()->IsSkewConstant);
    456     Print("\n//                 ncref:%d",r->GetNC()->ref);
    457     Print("\n//               commref:%d",r->ref);
    458     Print("\n//               baseref:%d",r->GetNC()->basering->ref);
    459456    if( rIsSCA(r) )
    460457    {
     
    17001697  }
    17011698  //memset: else res->qideal = NULL;
    1702 #ifdef HAVE_PLURAL
    17031699  //memset: res->GetNC() = NULL; // copy is purely commutative!!!
    1704 //  if (rIsPluralRing(r))
    1705 //    nc_rCopy0(res, r); // is this correct??? imho: no!
    1706 #endif
    17071700  return res;
    17081701}
     
    40344027//      for( int k = 0; k <= r->N; k++) if (r->typ[j].data.is.pVarOffset[k] != -1) Print("[%2d]: %04x; ", k, r->typ[j].data.is.pVarOffset[k]);
    40354028
    4036       Print("  limit %d\n",r->typ[j].data.is.limit); 
     4029      Print("  limit %d\n",r->typ[j].data.is.limit);
    40374030      #ifndef NDEBUG
    40384031      PrintS("  F: ");idShow(r->typ[j].data.is.F, r, r, 1);
     
    42144207    p_DebugPrint(F->m[j], r, r, 0);
    42154208#endif
    4216    
     4209
    42174210    for( poly p = F->m[j]; p != NULL; pIter(p) )
    4218     {     
     4211    {
    42194212      int c = p_GetComp(p, r);
    42204213
    42214214      if( c > MIN )
    42224215      {
    4223 #ifdef PDEBUG   
     4216#ifdef PDEBUG
    42244217        Print("gen[%d] -> gen(%d)\n", c, MIN + (*V)[ c - MIN - 1 ]);
    42254218#endif
    4226        
     4219
    42274220        p_SetComp( p, MIN + (*V)[ c - MIN - 1 ], r );
    42284221      }
    42294222    }
    4230 #ifdef PDEBUG   
     4223#ifdef PDEBUG
    42314224    Print("new F[%d]:", j);
    42324225    p_Test(F->m[j], r);
     
    43014294  rDebugPrint(currRing);
    43024295#endif
    4303   PrintS("\n");
     4296  PrintLn();
    43044297#endif
    43054298
     
    43174310  rDebugPrint(currRing);
    43184311#endif
    4319   PrintS("\n");
     4312  PrintLn();
    43204313#endif
    43214314  }
     
    43834376    rDebugPrint(r);
    43844377#endif
    4385     PrintS("\n");
     4378    PrintLn();
    43864379#endif
    43874380#endif
     
    44184411    rDebugPrint(r);
    44194412#endif
    4420     PrintS("\n");
     4413    PrintLn();
    44214414#endif
    44224415
     
    47484741  res->OrdSgn = 1;
    47494742  rComplete(res, 1);
     4743#ifdef HAVE_PLURAL
     4744  if (rIsPluralRing(r))
     4745  {
     4746    if ( nc_rComplete(r, res, false) ) // no qideal!
     4747    {
     4748#ifndef NDEBUG
     4749      WarnS("error in nc_rComplete");
     4750#endif
     4751    }
     4752  }
     4753#endif
    47504754  rChangeCurrRing(res);
    47514755  return res;
     
    47624766    rDebugPrint(r);
    47634767#endif
    4764     PrintS("\n");
     4768    PrintLn();
    47654769#endif
    47664770
     
    48244828    rDebugPrint(res);
    48254829#endif
    4826     PrintS("\n");
    4827 #endif
    4828 
    4829 
     4830    PrintLn();
     4831#endif
    48304832
    48314833#ifdef HAVE_PLURAL
     
    48524854    rDebugPrint(res);
    48534855#endif
    4854     PrintS("\n");
    4855 #endif
    4856 #endif
    4857 
     4856    PrintLn();
     4857#endif
     4858#endif
    48584859
    48594860    if (r->qideal!=NULL)
     
    48844885  return res;
    48854886}
    4886 
    4887 
    4888 
    4889 
    48904887
    48914888ring rCurrRingAssure_dp_S()
     
    51105107   if (rField_is_Ring_PtoM(r)) return n_Zpn;
    51115108   if (rField_is_Ring_2toM(r)) return  n_Z2n;
    5112   #endif         
     5109  #endif
    51135110
    51145111  return n_unknown;
     
    55415538    rChangeCurrRing(dest);
    55425539
    5543   const ring srcBase = src->GetNC()->basering;
     5540  const ring srcBase = src;
    55445541
    55455542  assume( nSetMap(srcBase) == nSetMap(currRing) ); // currRing is important here!
  • kernel/sca.cc

    rc1f5e3c r26b68f  
    8585
    8686////////////////////////////////////////////////////////////////////////////////////////////////////
    87 // Super Commutative Algebra extension by Oleksandr 
     87// Super Commutative Algebra extension by Oleksandr
    8888////////////////////////////////////////////////////////////////////////////////////////////////////
    8989
     
    193193    assume(tpower <= 1);
    194194#endif
    195    
     195
    196196    p_ExpVectorAdd(pMonomM, pMonomMM, rRing); // "exponents" are additive!!!
    197197
     
    305305      assume( iExp2 <= 1);
    306306#endif
    307      
     307
    308308      if( iExp2 != 0 )
    309309      {
     
    322322    assume(cpower <= 1);
    323323#endif
    324    
     324
    325325    poly pResult;
    326326    omTypeAllocBin(poly, pResult, rRing->PolyBin);
     
    12391239    completeReduce(strat); // ???
    12401240  }
    1241  
     1241
    12421242  /* release temp data-------------------------------- */
    12431243  exitBuchMora(strat);
     
    13181318
    13191319    PrintLn();
    1320    
     1320
    13211321    assureCurrentRing(rSaveRing);
    1322   } 
    1323 #endif
    1324  
     1322  }
     1323#endif
     1324
    13251325
    13261326  if(bCopy)
     
    13331333
    13341334  assume(!bCopy);
    1335    
     1335
    13361336  const int N = rG->N;
    13371337
     
    13621362
    13631363  const nc_struct* NC = rG->GetNC();
    1364   const ring rBase = NC->basering;
     1364  const ring rBase = rG; //NC->basering;
    13651365  const matrix C   = NC->C; // live in rBase!
    13661366  const matrix D   = NC->D; // live in rBase!
     
    13811381        return false;
    13821382      }
    1383      
    1384      
     1383
     1384
    13851385      assume(MATELEM(C,i,j) != NULL); // after CallPlural!
    13861386      number c = p_GetCoeff(MATELEM(C,i,j), rBase);
     
    14761476
    14771477  int b = N+1;
    1478   int e = -1; 
     1478  int e = -1;
    14791479
    14801480  if(rIsSCA(rG))
     
    14861486    Print("AltVars!?: [%d, %d]\n", b, e);
    14871487#endif
    1488    
    1489   }
    1490 
    1491  
     1488  }
     1489
    14921490  for ( int i = iAltVarStart; (i <= iAltVarEnd) && bSCA; i++ )
    14931491    if( (i < b) || (i > e) ) // otherwise it's ok since rG is an SCA!
     
    15111509
    15121510  assureCurrentRing(rSaveRing);
    1513  
     1511
    15141512  if(!bSCA) return false;
    15151513
     
    15321530  iiWriteMatrix((matrix)tempQ,"__",1);
    15331531#endif
    1534  
     1532
    15351533  idSkipZeroes( tempQ );
    15361534
     
    15391537  scaFirstAltVar( rGR, iAltVarStart );
    15401538  scaLastAltVar( rGR, iAltVarEnd );
    1541  
     1539
    15421540  if( idIs0(tempQ) )
    15431541    rGR->GetNC()->SCAQuotient() = NULL;
     
    15551553    PrintS("(NULL)\n");
    15561554#endif
    1557  
     1555
    15581556  return true;
    15591557}
     
    15891587    rGR->GetNC()->SCAQuotient() = tempQ;
    15901588
    1591  
     1589
    15921590  scaFirstAltVar( rGR, b );
    15931591  scaLastAltVar( rGR, e );
     
    16581656  PrintLn();
    16591657#endif
    1660  
     1658
    16611659
    16621660  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
     
    16801678  idPrint(tempQ);
    16811679#endif
    1682  
     1680
    16831681  strat->z2homog = id_IsSCAHomogeneous(tempF, NULL, NULL, currRing); // wCx == wCy == NULL!
    16841682   // redo no_prod_crit:
     
    16891687
    16901688
    1691  
     1689
    16921690#ifdef KDEBUG
    16931691  om_Opts.MinTrack = 5;
    16941692#endif
    1695  
     1693
    16961694  int   srmax, lrmax, red_result = 1;
    16971695  int   olddeg, reduc;
     
    17891787
    17901788              enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
    1791             }         
    1792 
    1793       }       
    1794 
    1795     }
    1796   }
    1797 
    1798  
    1799  
     1789            }
     1790      }
     1791    }
     1792  }
    18001793
    18011794  /* compute------------------------------------------------------- */
     
    20362029//     }
    20372030
    2038 
    2039    
    20402031#ifdef KDEBUG
    20412032//    memset(&(strat->P), 0, sizeof(strat->P));
     
    20582049  }
    20592050
    2060  
    20612051  /* release temp data-------------------------------- */
    20622052
     
    20642054
    20652055  id_Delete(&tempF, currRing);
    2066  
     2056
    20672057  if (TEST_OPT_WEIGHTM)
    20682058  {
     
    20782068
    20792069
    2080  
     2070
    20812071  if (tempQ!=NULL) updateResult(strat->Shdl,tempQ,strat);
    20822072
     
    20912081    strat->Shdl = erg;
    20922082  }
    2093  
    2094  
     2083
    20952084#if MYTEST
    20962085  PrintS("\n\n</sca_bba>\n\n");
    20972086#endif
    2098  
     2087
    20992088  return (strat->Shdl);
    21002089}
     
    22142203  int hilbcount=0;
    22152204
    2216  
     2205
    22172206  /*- compute-------------------------------------------*/
    22182207
     
    22272216
    22282217
    2229  
     2218
    22302219//  due to std( SB, p)
    22312220  if(TEST_OPT_SB_1)
     
    22752264
    22762265              if (strat->Ll>lrmax) lrmax = strat->Ll;
    2277             }         
    2278      
    2279       }     
    2280 
    2281     }
    2282   }
     2266            }
     2267      }
     2268
     2269    }
     2270  }
    22832271
    22842272
     
    28072795
    28082796// reduces ideal id modulo <y_i^2> , i = iFirstAltVar .. iLastAltVar
    2809 // returns the reduced ideal or zero ideal. 
     2797// returns the reduced ideal or zero ideal.
    28102798ideal id_KillSquares(const ideal id,
    28112799  const unsigned int iFirstAltVar, const unsigned int iLastAltVar,
  • kernel/structs.h

    rc1f5e3c r26b68f  
    446446struct nc_struct
    447447{
    448   short ref;
    449448  nc_type type;
    450   ring basering; // the ring C,D,.. live in (commutative ring with this NC structure!)
     449  //ring basering; // the ring C,D,.. live in (commutative ring with this NC structure!)
    451450
    452451  // initial data: square matrices rVar() x rVar()
Note: See TracChangeset for help on using the changeset viewer.