Changeset dd8182 in git for libpolys/polys/simpleideals.cc
 Timestamp:
 May 28, 2015, 1:49:46 PM (9 years ago)
 Branches:
 (u'spielwiese', 'a719bcf0b8dbc648b128303a49777a094b57592c')
 Children:
 37118282b339c44c8ed29fe938c803f9a24fcfec
 Parents:
 f255f00715b2e38983ecf37e5ec5aaea460c09d8
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

libpolys/polys/simpleideals.cc
rf255f0 rdd8182 39 39 { 40 40 assume( idsize >= 0 && rank >= 0 ); 41 41 42 42 ideal hh = (ideal)omAllocBin(sip_sideal_bin); 43 43 … … 45 45 hh>nrows = 1; // ideal/module! 46 46 47 hh>rank = rank; // ideal: 1, module: >= 0! 48 47 hh>rank = rank; // ideal: 1, module: >= 0! 48 49 49 if (idsize>0) 50 50 hh>m = (poly *)omAlloc0(idsize*sizeof(poly)); 51 51 else 52 52 hh>m = NULL; 53 53 54 54 return hh; 55 55 } … … 101 101 ideal id_MaxIdeal (const ring r) 102 102 { 103 const int N = rVar(r); 104 ideal hh = idInit(N, 1); 105 for (int l=0; l < N; l++) 103 ideal hh = idInit(rVar(r), 1); 104 for (int l=rVar(r)1; l>=0; l) 106 105 { 107 106 hh>m[l] = p_One(r); … … 120 119 121 120 id_Test(*h, r); 122 121 123 122 const int elems = (*h)>nrows * (*h)>ncols; 124 123 … … 126 125 { 127 126 assume( (*h)>m != NULL ); 128 127 129 128 int j = elems; 130 129 do … … 134 133 if (pp!=NULL) p_Delete(&pp, r); 135 134 } 136 while (j>0); 137 135 while (j>0); 136 138 137 omFreeSize((ADDRESS)((*h)>m),sizeof(poly)*elems); 139 138 } 140 139 141 140 omFreeBin((ADDRESS)*h, sip_sideal_bin); 142 141 *h=NULL; … … 148 147 { 149 148 id_Test(*h, r); 150 149 151 150 if (*h == NULL) 152 151 return; 153 152 154 153 int j,elems; 155 154 elems=j=(*h)>nrows*(*h)>ncols; … … 172 171 { 173 172 assume (ide != NULL); 174 173 175 174 int k; 176 175 int j = 1; 177 BOOLEAN change=FALSE; 178 176 BOOLEAN change=FALSE; 177 179 178 for (k=0; k<IDELEMS(ide); k++) 180 179 { … … 210 209 { 211 210 assume (F != NULL); 212 211 213 212 int i=0,j=IDELEMS(F)1; 214 213 … … 227 226 { 228 227 id_Test(ide, r); 229 228 230 229 assume( ide != NULL ); 231 230 assume( k <= IDELEMS(ide) ); 232 231 233 232 ideal newI = idInit(k, ide>rank); 234 233 235 234 for (int i = 0; i < k; i++) 236 235 newI>m[i] = p_Copy(ide>m[i],r); 237 236 238 237 return newI; 239 238 } … … 347 346 { 348 347 id_Test(id, r); 349 348 350 349 int i, j; 351 350 int k = IDELEMS(id)1; … … 398 397 { 399 398 id_Test(id, r); 400 399 401 400 for (int k = IDELEMS(id)1; k>=0; k) 402 401 { … … 423 422 { 424 423 if (h1 != NULL) 425 { 424 { 426 425 // assume(IDELEMS(h1) > 0); for ideal/module, does not apply to matrix 427 426 omCheckAddrSize(h1,sizeof(*h1)); … … 429 428 assume( h1>ncols >= 0 ); 430 429 assume( h1>nrows >= 0 ); // matrix case! 431 430 432 431 assume( h1>rank >= 0 ); 433 432 … … 438 437 if( h1>m != NULL && n > 0 ) 439 438 omdebugAddrSize(h1>m, n * sizeof(poly)); 440 439 441 440 long new_rk = 0; // inlining id_RankFreeModule(h1, r, tailRing); 442 441 … … 451 450 // dense matrices only contain polynomials: 452 451 // h1>nrows == h1>rank > 1 && new_rk == 0! 453 assume( !( h1>nrows == h1>rank && h1>nrows > 1 && new_rk > 0 ) ); // 454 452 assume( !( h1>nrows == h1>rank && h1>nrows > 1 && new_rk > 0 ) ); // 453 455 454 if(new_rk > h1>rank) 456 455 { … … 603 602 id_Test(h1, R); 604 603 id_Test(h2, R); 605 604 606 605 if ( idIs0(h1) ) return id_Copy(h2,R); 607 606 if ( idIs0(h2) ) return id_Copy(h1,R); … … 609 608 int j = IDELEMS(h1)1; 610 609 while ((j >= 0) && (h1>m[j] == NULL)) j; 611 610 612 611 int i = IDELEMS(h2)1; 613 612 while ((i >= 0) && (h2>m[i] == NULL)) i; 614 613 615 614 const int r = si_max(h1>rank, h2>rank); 616 615 617 616 ideal result = idInit(i+j+2,r); 618 617 619 618 int l; 620 619 621 620 for (l=j; l>=0; l) 622 621 result>m[l] = p_Copy(h1>m[l],R); 623 622 624 623 j = i+j+1; 625 624 for (l=i; l>=0; l, j) 626 625 result>m[j] = p_Copy(h2>m[l],R); 627 626 628 627 return result; 629 628 } … … 635 634 if (h2==NULL) return FALSE; 636 635 assume (h1 != NULL); 637 636 638 637 int j = IDELEMS(h1)  1; 639 638 640 639 while ((j >= 0) && (h1>m[j] == NULL)) j; 641 640 j++; … … 695 694 696 695 /// h1 * h2 697 /// h1 must be an ideal (with at least one column) 698 /// h2 may be a module (with no columns at all) 699 ideal id_Mult (ideal h1,ideal h2, const ring r) 700 { 701 id_Test(h1, r); 702 id_Test(h2, r); 703 704 assume( h1>rank == 1 ); 696 /// one h_i must be an ideal (with at least one column) 697 /// the other h_i may be a module (with no columns at all) 698 ideal id_Mult (ideal h1,ideal h2, const ring R) 699 { 700 id_Test(h1, R); 701 id_Test(h2, R); 705 702 706 703 int j = IDELEMS(h1); 707 704 while ((j > 0) && (h1>m[j1] == NULL)) j; 708 705 709 706 int i = IDELEMS(h2); 710 707 while ((i > 0) && (h2>m[i1] == NULL)) i; 711 708 712 j = j * i; 713 714 ideal hh = idInit(j, si_max( h2>rank, h1>rank )); 715 716 if (j==0) return hh; 717 709 j *= i; 710 int r = si_max( h2>rank, h1>rank ); 711 if (j==0) 712 { 713 if ((IDELEMS(h1)>0) && (IDELEMS(h2)>0)) j=1; 714 return idInit(j, r); 715 } 716 ideal hh = idInit(j, r); 717 718 718 int k = 0; 719 719 for (i=0; i<IDELEMS(h1); i++) … … 725 725 if (h2>m[j] != NULL) 726 726 { 727 hh>m[k] = pp_Mult_qq(h1>m[i],h2>m[j], r);727 hh>m[k] = pp_Mult_qq(h1>m[i],h2>m[j],R); 728 728 k++; 729 729 } … … 731 731 } 732 732 } 733 734 id_Compactify(hh, r);733 734 id_Compactify(hh,R); 735 735 return hh; 736 736 } … … 741 741 assume (h != NULL); // will fail :( 742 742 // if (h == NULL) return TRUE; 743 744 for( int i = IDELEMS(h)1; i >= 0; i ) 743 744 for( int i = IDELEMS(h)1; i >= 0; i ) 745 745 if(h>m[i] != NULL) 746 746 return FALSE; … … 754 754 { 755 755 id_TestTail(s, lmRing, tailRing); 756 756 757 757 long j = 0; 758 758 … … 768 768 } 769 769 } 770 770 771 771 return j; // return 1; 772 772 } … … 908 908 assume(i >= 0); 909 909 ideal h = idInit(i, i); 910 910 911 911 for (int j=0; j<i; j++) 912 912 { … … 915 915 p_SetmComp(h>m[j],r); 916 916 } 917 917 918 918 return h; 919 919 } … … 1087 1087 if (h>m[i]!=NULL) 1088 1088 m>m[i]=p_Head(h>m[i],r); 1089 1089 1090 1090 return m; 1091 1091 } … … 1375 1375 r>ncols = i> ncols; 1376 1376 //r>rank = i> rank; 1377 1377 1378 1378 for(int k=(i>nrows)*(i>ncols)1;k>=0; k) 1379 1379 r>m[k]=pp_Jet(i>m[k],d,R); 1380 1380 1381 1381 return r; 1382 1382 } … … 1743 1743 1744 1744 // assume( s >= 0 ); // negative is also possible // TODO: verify input ideal in such a case!? 1745 1745 1746 1746 for(int i=IDELEMS(M)1; i>=0;i) 1747 1747 p_Shift(&(M>m[i]),s,r); 1748 1748 1749 1749 M>rank += s; 1750 1750 1751 1751 // id_Test( M, r ); 1752 1752 }
Note: See TracChangeset
for help on using the changeset viewer.