Changeset 3aab7b in git
- Timestamp:
- Jun 25, 2008, 5:37:25 PM (16 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 19d1fac34461d4e329153e0e8bc2a41090b7e60e
- Parents:
- 17c0fde8f413be9755c6ad3adfaf7e2c678775dc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/ring.cc
r17c0fd r3aab7b 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: ring.cc,v 1.8 4 2008-06-19 12:39:56 wienandExp $ */4 /* $Id: ring.cc,v 1.85 2008-06-25 15:37:25 Singular Exp $ */ 5 5 6 6 /* … … 1058 1058 #ifdef HAVE_PLURAL 1059 1059 && !rIsPluralRing(r1) && !rIsPluralRing(r2) 1060 #endif 1060 #endif 1061 1061 ) 1062 1062 { … … 1190 1190 { 1191 1191 int b=rBlocks(r1); 1192 1192 1193 1193 tmpR.order=(int*)omAlloc0(b*sizeof(int)); 1194 1194 tmpR.block0=(int*)omAlloc0(b*sizeof(int)); … … 1313 1313 idTest((ideal)D); 1314 1314 1315 1315 1316 1316 for (i=1; i<= rVar(R2); i++) 1317 1317 for (j=i+1; j<=rVar(R2); j++) … … 1339 1339 1340 1340 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 1346 1346 rDelete(R1); 1347 1347 rDelete(R2); … … 1355 1355 rChangeCurrRing(old_ring); 1356 1356 } 1357 1357 1358 1358 } 1359 1359 #endif … … 2445 2445 res->GetNC() = NULL; 2446 2446 #endif 2447 2447 2448 2448 // res->qideal, res->idroot ??? 2449 2449 res->wvhdl=wvhdl; … … 2496 2496 WarnS("error in nc_rComplete"); 2497 2497 // cleanup? 2498 2498 2499 2499 // rDelete(res); 2500 2500 // return r; … … 2504 2504 } 2505 2505 #endif 2506 2506 2507 2507 return res; 2508 2508 } … … 2516 2516 res->GetNC() = NULL; 2517 2517 #endif 2518 2518 2519 2519 /*weights: entries for 3 blocks: NULL*/ 2520 2520 res->wvhdl = (int **)omAlloc0(3 * sizeof(int_ptr)); … … 2587 2587 #ifdef HAVE_PLURAL 2588 2588 res->GetNC() = NULL; 2589 #endif 2589 #endif 2590 2590 // res->qideal, res->idroot ??? 2591 2591 res->wvhdl=wvhdl; … … 3693 3693 #endif 3694 3694 #endif 3695 3695 3696 3696 3697 3697 if (old_ring->qideal != NULL) … … 3704 3704 if( rIsPluralRing(r) ) 3705 3705 nc_SetupQuotient(r); 3706 #endif 3706 #endif 3707 3707 } 3708 3708 } … … 3718 3718 #endif 3719 3719 #endif 3720 3720 3721 3721 return r; 3722 3722 } … … 3729 3729 int j; 3730 3730 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)); 3735 3732 res->block0=(int *)omAlloc0((i+1)*sizeof(int)); 3736 for(j=i;j>0;j--) res->block0[j]=r->block0[j-1];3737 3738 3733 res->block1=(int *)omAlloc0((i+1)*sizeof(int)); 3739 for(j=i;j>0;j--) res->block1[j]=r->block1[j-1];3740 3741 3734 int ** wvhdl =(int **)omAlloc0((i+1)*sizeof(int**)); 3742 3735 for(j=i;j>0;j--) 3743 3736 { 3737 res->order[j]=r->order[j-1]; 3738 res->block0[j]=r->block0[j-1]; 3739 res->block1[j]=r->block1[j-1]; 3744 3740 if (r->wvhdl[j-1] != NULL) 3745 3741 { … … 3747 3743 } 3748 3744 } 3745 res->order[0]=ringorder_s; 3746 3749 3747 res->wvhdl = wvhdl; 3750 3748 … … 3768 3766 } 3769 3767 #endif 3770 3771 } 3768 3769 } 3770 return res; 3771 } 3772 3773 ring 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 3772 3832 return res; 3773 3833 } … … 3778 3838 int i=0; 3779 3839 do 3780 { 3840 { 3781 3841 if (r->order[i] == ringorder_c || 3782 3842 r->order[i] == ringorder_C) return r; … … 3787 3847 //WarnS("re-creating ring with comps"); 3788 3848 last_block=i-1; 3789 3849 3790 3850 ring new_r = rCopy0(r, FALSE, FALSE); 3791 3851 i+=2; … … 3806 3866 last_block++; 3807 3867 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; 3810 3870 //new_r->wvhdl[last_block]=NULL; 3811 3871 … … 3827 3887 } 3828 3888 #endif 3829 3889 3830 3890 return new_r; 3831 3891 } … … 3881 3941 } 3882 3942 #endif 3883 3943 3884 3944 } 3885 3945 return new_r; … … 3930 3990 } 3931 3991 #endif 3932 3992 3933 3993 rChangeCurrRing(new_r); 3934 3994 if (old_r->qideal != NULL) … … 3941 4001 nc_SetupQuotient( new_r ); 3942 4002 #endif 3943 4003 3944 4004 } 3945 4005 rTest(new_r); … … 4171 4231 ring save = currRing; 4172 4232 rChangeCurrRing(src); 4173 4233 4174 4234 ring r = rCopy0(src,TRUE); /* TRUE for copy the qideal */ 4175 4235 /* rChangeCurrRing(r); */ … … 4382 4442 rComplete(r); 4383 4443 4384 4444 4385 4445 #ifdef RDEBUG 4386 4446 // rDebugPrint(r); … … 4388 4448 #endif 4389 4449 4390 rChangeCurrRing(r); 4450 rChangeCurrRing(r); 4391 4451 4392 4452 #ifdef HAVE_PLURAL … … 4395 4455 { 4396 4456 assume( currRing == r); 4397 4457 4398 4458 int *perm = (int *)omAlloc0((rVar(r)+1)*sizeof(int)); 4399 4459 int *par_perm = NULL; … … 4434 4494 omFreeSize((ADDRESS)perm,(rVar(r)+1)*sizeof(int)); 4435 4495 4436 rChangeCurrRing(save); 4437 4496 rChangeCurrRing(save); 4497 4438 4498 } 4439 4499 #endif /* HAVE_PLURAL */ … … 4472 4532 4473 4533 #ifdef HAVE_PLURAL 4474 BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient) 4534 BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient) 4475 4535 /* returns TRUE is there were errors */ 4476 4536 /* dest is actualy equals src with the different ordering */ … … 4481 4541 // ring created by dirty hack (without nc_CallPlural) 4482 4542 4483 assume(!rIsPluralRing(dest)); // destination must be a newly constructed commutative ring 4543 assume(!rIsPluralRing(dest)); // destination must be a newly constructed commutative ring 4484 4544 4485 4545 if (!rIsPluralRing(src)) … … 4498 4558 4499 4559 const ring srcBase = src->GetNC()->basering; 4500 4560 4501 4561 assume( nSetMap(srcBase) == nSetMap(currRing) ); // currRing is important here! 4502 4562 4503 4563 matrix C = mpNew(N,N); // ring independent 4504 4564 matrix D = mpNew(N,N); … … 4520 4580 MATELEM(C,i,j) = p; 4521 4581 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); // ? 4523 4583 } 4524 4584 } 4525 4585 /* One must test C and D _only_ in r->GetNC()->basering!!! not in r!!! */ 4526 4586 4527 4587 idTest((ideal)C); // in dest! 4528 4588 idTest((ideal)D); … … 4530 4590 if (nc_CallPlural(C, D, NULL, NULL, dest, bSetupQuotient, false, true, dest)) // also takes care about quotient ideal 4531 4591 { 4532 //WarnS("Error transferring non-commutative structure"); 4592 //WarnS("Error transferring non-commutative structure"); 4533 4593 // error message should be in the interpreter interface 4534 4594 … … 4538 4598 if (currRing != save) 4539 4599 rChangeCurrRing(save); 4540 4600 4541 4601 return TRUE; 4542 4602 } 4543 4603 4544 4604 // mpDelete(&C, dest); // used by nc_CallPlural! 4545 4605 // mpDelete(&D, dest); … … 4547 4607 if (dest != save) 4548 4608 rChangeCurrRing(save); 4549 4609 4550 4610 return FALSE; 4551 4611 }
Note: See TracChangeset
for help on using the changeset viewer.