Changeset 26b68f in git
- Timestamp:
- Mar 5, 2010, 2:02:28 PM (13 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- 78efe9f25ea57c6afdfe8736b026e6d074a3d9d3
- Parents:
- c1f5e3cc27d7059b5f61b1805f24638a0836a299
- Location:
- kernel
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gring.cc
rc1f5e3c r26b68f 2671 2671 // kills the nc extension of ring r 2672 2672 { 2673 r->GetNC()->ref--;2674 if (r->GetNC()->ref >= 1) /* in use by somebody else */2675 {2676 r->GetNC() = NULL; // don't cleanup, just dereference2677 return;2678 }2679 /* otherwise kill the previous nc data */2680 2681 assume( r->GetNC()->ref == 0 );2682 2683 2673 if( r->GetNC()->GetGlobalMultiplier() != NULL ) 2684 2674 { … … 2702 2692 for(j=i+1;j<=rN;j++) 2703 2693 { 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); 2705 2695 } 2706 2696 } 2707 2697 omFreeSize((ADDRESS)r->GetNC()->MT,rN*(rN-1)/2*sizeof(matrix)); 2708 2698 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); 2713 2703 2714 2704 if( rIsSCA(r) && (r->GetNC()->SCAQuotient() != NULL) ) 2715 2705 { 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 2727 2709 2728 2710 nc_CleanUp(r); … … 2732 2714 //////////////////////////////////////////////////////////////////////////////////////////////// 2733 2715 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 inline2740 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 }2761 2716 2762 2717 poly nc_p_CopyGet(poly a, const ring r) … … 2773 2728 return(NULL); 2774 2729 } 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)); 2781 2731 } 2782 2732 … … 2795 2745 } 2796 2746 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)); 2803 2748 } 2804 2749 … … 2923 2868 { 2924 2869 assume( r->qideal == NULL ); // The basering must NOT be a qring! 2925 2870 2926 2871 // assume( curr != r ); 2927 2872 assume( rSamePolyRep(r, curr) ); … … 3208 3153 nc_new->IsSkewConstant = (IsSkewConstant?1:0); 3209 3154 3210 nc_new->ref = 1;3211 nc_new->basering = r; // !?3212 3213 3155 // Setup new NC structure!!! 3214 3156 if (r->GetNC() != NULL) … … 3259 3201 WeChangeRing = 1; 3260 3202 } 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! 3263 3205 3264 3206 int i,j; … … 3298 3240 p_SetExp(p,j,1,r); 3299 3241 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); 3301 3243 q = nc_p_CopyGet(MATELEM(r->GetNC()->D,i,j),r); 3302 3244 p = p_Add_q(p,q,r); -
kernel/ring.cc
rc1f5e3c r26b68f 381 381 #ifndef NDEBUG 382 382 if(r->block0[l] == 0 ) 383 Print ("::prefix");383 PrintS("::prefix"); 384 384 else 385 385 Print("::suffix (sign: %d)", r->block0[l]); … … 445 445 Print("\n// %s%s=",r->names[j-1],r->names[i-1]); 446 446 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); 448 448 } 449 449 } … … 454 454 Print("\n// noncommutative type:%d", (int)ncRingType(r)); 455 455 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);459 456 if( rIsSCA(r) ) 460 457 { … … 1700 1697 } 1701 1698 //memset: else res->qideal = NULL; 1702 #ifdef HAVE_PLURAL1703 1699 //memset: res->GetNC() = NULL; // copy is purely commutative!!! 1704 // if (rIsPluralRing(r))1705 // nc_rCopy0(res, r); // is this correct??? imho: no!1706 #endif1707 1700 return res; 1708 1701 } … … 4034 4027 // 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]); 4035 4028 4036 Print(" limit %d\n",r->typ[j].data.is.limit); 4029 Print(" limit %d\n",r->typ[j].data.is.limit); 4037 4030 #ifndef NDEBUG 4038 4031 PrintS(" F: ");idShow(r->typ[j].data.is.F, r, r, 1); … … 4214 4207 p_DebugPrint(F->m[j], r, r, 0); 4215 4208 #endif 4216 4209 4217 4210 for( poly p = F->m[j]; p != NULL; pIter(p) ) 4218 { 4211 { 4219 4212 int c = p_GetComp(p, r); 4220 4213 4221 4214 if( c > MIN ) 4222 4215 { 4223 #ifdef PDEBUG 4216 #ifdef PDEBUG 4224 4217 Print("gen[%d] -> gen(%d)\n", c, MIN + (*V)[ c - MIN - 1 ]); 4225 4218 #endif 4226 4219 4227 4220 p_SetComp( p, MIN + (*V)[ c - MIN - 1 ], r ); 4228 4221 } 4229 4222 } 4230 #ifdef PDEBUG 4223 #ifdef PDEBUG 4231 4224 Print("new F[%d]:", j); 4232 4225 p_Test(F->m[j], r); … … 4301 4294 rDebugPrint(currRing); 4302 4295 #endif 4303 Print S("\n");4296 PrintLn(); 4304 4297 #endif 4305 4298 … … 4317 4310 rDebugPrint(currRing); 4318 4311 #endif 4319 Print S("\n");4312 PrintLn(); 4320 4313 #endif 4321 4314 } … … 4383 4376 rDebugPrint(r); 4384 4377 #endif 4385 Print S("\n");4378 PrintLn(); 4386 4379 #endif 4387 4380 #endif … … 4418 4411 rDebugPrint(r); 4419 4412 #endif 4420 Print S("\n");4413 PrintLn(); 4421 4414 #endif 4422 4415 … … 4748 4741 res->OrdSgn = 1; 4749 4742 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 4750 4754 rChangeCurrRing(res); 4751 4755 return res; … … 4762 4766 rDebugPrint(r); 4763 4767 #endif 4764 Print S("\n");4768 PrintLn(); 4765 4769 #endif 4766 4770 … … 4824 4828 rDebugPrint(res); 4825 4829 #endif 4826 PrintS("\n"); 4827 #endif 4828 4829 4830 PrintLn(); 4831 #endif 4830 4832 4831 4833 #ifdef HAVE_PLURAL … … 4852 4854 rDebugPrint(res); 4853 4855 #endif 4854 PrintS("\n"); 4855 #endif 4856 #endif 4857 4856 PrintLn(); 4857 #endif 4858 #endif 4858 4859 4859 4860 if (r->qideal!=NULL) … … 4884 4885 return res; 4885 4886 } 4886 4887 4888 4889 4890 4887 4891 4888 ring rCurrRingAssure_dp_S() … … 5110 5107 if (rField_is_Ring_PtoM(r)) return n_Zpn; 5111 5108 if (rField_is_Ring_2toM(r)) return n_Z2n; 5112 #endif 5109 #endif 5113 5110 5114 5111 return n_unknown; … … 5541 5538 rChangeCurrRing(dest); 5542 5539 5543 const ring srcBase = src ->GetNC()->basering;5540 const ring srcBase = src; 5544 5541 5545 5542 assume( nSetMap(srcBase) == nSetMap(currRing) ); // currRing is important here! -
kernel/sca.cc
rc1f5e3c r26b68f 85 85 86 86 //////////////////////////////////////////////////////////////////////////////////////////////////// 87 // Super Commutative Algebra extension by Oleksandr 87 // Super Commutative Algebra extension by Oleksandr 88 88 //////////////////////////////////////////////////////////////////////////////////////////////////// 89 89 … … 193 193 assume(tpower <= 1); 194 194 #endif 195 195 196 196 p_ExpVectorAdd(pMonomM, pMonomMM, rRing); // "exponents" are additive!!! 197 197 … … 305 305 assume( iExp2 <= 1); 306 306 #endif 307 307 308 308 if( iExp2 != 0 ) 309 309 { … … 322 322 assume(cpower <= 1); 323 323 #endif 324 324 325 325 poly pResult; 326 326 omTypeAllocBin(poly, pResult, rRing->PolyBin); … … 1239 1239 completeReduce(strat); // ??? 1240 1240 } 1241 1241 1242 1242 /* release temp data-------------------------------- */ 1243 1243 exitBuchMora(strat); … … 1318 1318 1319 1319 PrintLn(); 1320 1320 1321 1321 assureCurrentRing(rSaveRing); 1322 } 1323 #endif 1324 1322 } 1323 #endif 1324 1325 1325 1326 1326 if(bCopy) … … 1333 1333 1334 1334 assume(!bCopy); 1335 1335 1336 1336 const int N = rG->N; 1337 1337 … … 1362 1362 1363 1363 const nc_struct* NC = rG->GetNC(); 1364 const ring rBase = NC->basering;1364 const ring rBase = rG; //NC->basering; 1365 1365 const matrix C = NC->C; // live in rBase! 1366 1366 const matrix D = NC->D; // live in rBase! … … 1381 1381 return false; 1382 1382 } 1383 1384 1383 1384 1385 1385 assume(MATELEM(C,i,j) != NULL); // after CallPlural! 1386 1386 number c = p_GetCoeff(MATELEM(C,i,j), rBase); … … 1476 1476 1477 1477 int b = N+1; 1478 int e = -1; 1478 int e = -1; 1479 1479 1480 1480 if(rIsSCA(rG)) … … 1486 1486 Print("AltVars!?: [%d, %d]\n", b, e); 1487 1487 #endif 1488 1489 } 1490 1491 1488 } 1489 1492 1490 for ( int i = iAltVarStart; (i <= iAltVarEnd) && bSCA; i++ ) 1493 1491 if( (i < b) || (i > e) ) // otherwise it's ok since rG is an SCA! … … 1511 1509 1512 1510 assureCurrentRing(rSaveRing); 1513 1511 1514 1512 if(!bSCA) return false; 1515 1513 … … 1532 1530 iiWriteMatrix((matrix)tempQ,"__",1); 1533 1531 #endif 1534 1532 1535 1533 idSkipZeroes( tempQ ); 1536 1534 … … 1539 1537 scaFirstAltVar( rGR, iAltVarStart ); 1540 1538 scaLastAltVar( rGR, iAltVarEnd ); 1541 1539 1542 1540 if( idIs0(tempQ) ) 1543 1541 rGR->GetNC()->SCAQuotient() = NULL; … … 1555 1553 PrintS("(NULL)\n"); 1556 1554 #endif 1557 1555 1558 1556 return true; 1559 1557 } … … 1589 1587 rGR->GetNC()->SCAQuotient() = tempQ; 1590 1588 1591 1589 1592 1590 scaFirstAltVar( rGR, b ); 1593 1591 scaLastAltVar( rGR, e ); … … 1658 1656 PrintLn(); 1659 1657 #endif 1660 1658 1661 1659 1662 1660 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing); … … 1680 1678 idPrint(tempQ); 1681 1679 #endif 1682 1680 1683 1681 strat->z2homog = id_IsSCAHomogeneous(tempF, NULL, NULL, currRing); // wCx == wCy == NULL! 1684 1682 // redo no_prod_crit: … … 1689 1687 1690 1688 1691 1689 1692 1690 #ifdef KDEBUG 1693 1691 om_Opts.MinTrack = 5; 1694 1692 #endif 1695 1693 1696 1694 int srmax, lrmax, red_result = 1; 1697 1695 int olddeg, reduc; … … 1789 1787 1790 1788 enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos); 1791 } 1792 1793 } 1794 1795 } 1796 } 1797 1798 1799 1789 } 1790 } 1791 } 1792 } 1800 1793 1801 1794 /* compute------------------------------------------------------- */ … … 2036 2029 // } 2037 2030 2038 2039 2040 2031 #ifdef KDEBUG 2041 2032 // memset(&(strat->P), 0, sizeof(strat->P)); … … 2058 2049 } 2059 2050 2060 2061 2051 /* release temp data-------------------------------- */ 2062 2052 … … 2064 2054 2065 2055 id_Delete(&tempF, currRing); 2066 2056 2067 2057 if (TEST_OPT_WEIGHTM) 2068 2058 { … … 2078 2068 2079 2069 2080 2070 2081 2071 if (tempQ!=NULL) updateResult(strat->Shdl,tempQ,strat); 2082 2072 … … 2091 2081 strat->Shdl = erg; 2092 2082 } 2093 2094 2083 2095 2084 #if MYTEST 2096 2085 PrintS("\n\n</sca_bba>\n\n"); 2097 2086 #endif 2098 2087 2099 2088 return (strat->Shdl); 2100 2089 } … … 2214 2203 int hilbcount=0; 2215 2204 2216 2205 2217 2206 /*- compute-------------------------------------------*/ 2218 2207 … … 2227 2216 2228 2217 2229 2218 2230 2219 // due to std( SB, p) 2231 2220 if(TEST_OPT_SB_1) … … 2275 2264 2276 2265 if (strat->Ll>lrmax) lrmax = strat->Ll; 2277 } 2278 2279 } 2280 2281 } 2282 } 2266 } 2267 } 2268 2269 } 2270 } 2283 2271 2284 2272 … … 2807 2795 2808 2796 // 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. 2810 2798 ideal id_KillSquares(const ideal id, 2811 2799 const unsigned int iFirstAltVar, const unsigned int iLastAltVar, -
kernel/structs.h
rc1f5e3c r26b68f 446 446 struct nc_struct 447 447 { 448 short ref;449 448 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!) 451 450 452 451 // initial data: square matrices rVar() x rVar()
Note: See TracChangeset
for help on using the changeset viewer.