Changeset dd012ca in git
- Timestamp:
- Jan 17, 2011, 12:16:00 PM (13 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'fc741b6502fd8a97288eaa3eba6e5220f3c3df87')
- Children:
- 7eb7b589b58bd7d0f3394de9432ef2b9a9d03d57
- Parents:
- 8e0bf8b4ab959ccb20087537bf84bdc77bdee721
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2011-01-17 12:16:00+01:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:59:25+01:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/monomials/ring.cc
r8e0bf8 rdd012ca 86 86 87 87 /*0 implementation*/ 88 //BOOLEAN rField_is_R(ring r =currRing)88 //BOOLEAN rField_is_R(ring r) 89 89 //{ 90 90 // if (r->ch== -1) … … 110 110 rTest(r); 111 111 /*------------ set global ring vars --------------------------------*/ 112 currQuotient=r->qideal;112 //currQuotient=r->qideal; 113 113 114 114 /*------------ global variables related to coefficients ------------*/ … … 133 133 /*r->P = 0; Alloc0 */ 134 134 /*names*/ 135 r->names = (char **) omAlloc0(N * sizeof(char _ptr));135 r->names = (char **) omAlloc0(N * sizeof(char *)); 136 136 int i; 137 137 for(i=0;i<N;i++) … … 253 253 omCheckAddrSize(r->block1,nblocks*sizeof(int)); 254 254 omCheckAddrSize(r->wvhdl,nblocks*sizeof(int *)); 255 omCheckAddrSize(r->names,r->N*sizeof(char _ptr));255 omCheckAddrSize(r->names,r->N*sizeof(char *)); 256 256 257 257 nblocks--; … … 260 260 if (rField_is_GF(r)) 261 261 { 262 Print("// # ground field : %d\n",r InternalChar(r));262 Print("// # ground field : %d\n",r->ch); 263 263 Print("// primitive element : %s\n", r->parameter[0]); 264 264 StringSetS("// minpoly : "); … … 396 396 { 397 397 PrintS("\n// noncommutative relations:"); 398 if (r==currRing) 399 { 400 poly pl=NULL; 401 int nl; 402 int i,j; 403 for (i = 1; i<r->N; i++) 404 { 405 for (j = i+1; j<=r->N; j++) 406 { 407 nl = nIsOne(p_GetCoeff(MATELEM(r->GetNC()->C,i,j),r->GetNC()->basering)); 408 if ( (MATELEM(r->GetNC()->D,i,j)!=NULL) || (!nl) ) 409 { 410 Print("\n// %s%s=",r->names[j-1],r->names[i-1]); 411 pl = MATELEM(r->GetNC()->MT[UPMATELEM(i,j,r->N)],1,1); 412 p_Write0(pl, r, r); 413 } 414 } 415 } 416 } 417 else PrintS(" ..."); 398 poly pl=NULL; 399 int nl; 400 int i,j; 401 for (i = 1; i<r->N; i++) 402 { 403 for (j = i+1; j<=r->N; j++) 404 { 405 nl = nIsOne(p_GetCoeff(MATELEM(r->GetNC()->C,i,j),r->GetNC()->basering)); 406 if ( (MATELEM(r->GetNC()->D,i,j)!=NULL) || (!nl) ) 407 { 408 Print("\n// %s%s=",r->names[j-1],r->names[i-1]); 409 pl = MATELEM(r->GetNC()->MT[UPMATELEM(i,j,r->N)],1,1); 410 p_Write0(pl, r, r); 411 } 412 } 413 } 418 414 #if 0 /*Singularg should not differ from Singular except in error case*/ 419 415 Print("\n// noncommutative type:%d", (int)ncRingType(r)); … … 489 485 if (r->names[i] != NULL) omFree((ADDRESS)r->names[i]); 490 486 } 491 omFreeSize((ADDRESS)r->names,r->N*sizeof(char _ptr));487 omFreeSize((ADDRESS)r->names,r->N*sizeof(char *)); 492 488 } 493 489 … … 503 499 j++; 504 500 } 505 omFreeSize((ADDRESS)r->parameter,rPar(r)*sizeof(char _ptr));501 omFreeSize((ADDRESS)r->parameter,rPar(r)*sizeof(char *)); 506 502 } 507 503 #ifdef HAVE_RINGS … … 796 792 int rSumInternal(ring r1, ring r2, ring &sum, BOOLEAN vartest, BOOLEAN dp_dp) 797 793 { 798 ring save=currRing;799 794 ip_sring tmpR; 800 795 memset(&tmpR,0,sizeof(tmpR)); … … 810 805 if (!vartest || (strcmp(r1->parameter[0],r2->parameter[0])==0)) /* 1 par */ 811 806 { 812 tmpR.parameter=(char **)omAllocBin(char _ptr_bin);807 tmpR.parameter=(char **)omAllocBin(char *); 813 808 tmpR.parameter[0]=omStrDup(r1->parameter[0]); 814 809 tmpR.P=1; … … 832 827 && n_Equal(r1->minpoly,r2->minpoly, r1)) 833 828 { 834 tmpR.parameter=(char **)omAllocBin(char _ptr_bin);829 tmpR.parameter=(char **)omAllocBin(char *); 835 830 tmpR.parameter[0]=omStrDup(r1->parameter[0]); 836 831 tmpR.minpoly=n_Copy(r1->minpoly, r1); 837 832 tmpR.P=1; 838 833 // HANNES: TODO: delete nSetChar 839 rChangeCurrRing(save);840 834 } 841 835 else 842 836 { 843 837 // HANNES: TODO: delete nSetChar 844 rChangeCurrRing(save);845 838 WerrorS("different minpolys"); 846 839 return -1; … … 852 845 && (rPar(r2)==1)) 853 846 { 854 tmpR.parameter=(char **)omAllocBin(char _ptr_bin);847 tmpR.parameter=(char **)omAllocBin(char *); 855 848 tmpR.parameter[0]=omStrDup(r1->parameter[0]); 856 849 tmpR.P=1; … … 871 864 && (rPar(r1)==1)) 872 865 { 873 tmpR.parameter=(char **)omAllocBin(char _ptr_bin);866 tmpR.parameter=(char **)omAllocBin(char *); 874 867 tmpR.parameter[0]=omStrDup(r1->parameter[0]); 875 868 tmpR.P=1; … … 885 878 { 886 879 int len=rPar(r1)+rPar(r2); 887 tmpR.parameter=(char **)omAlloc0(len*sizeof(char _ptr));880 tmpR.parameter=(char **)omAlloc0(len*sizeof(char *)); 888 881 int i; 889 882 for (i=0;i<rPar(r1);i++) … … 913 906 { 914 907 tmpR.parameter=(char**)omReallocSize(tmpR.parameter, 915 len*sizeof(char _ptr),916 i*sizeof(char _ptr));908 len*sizeof(char *), 909 i*sizeof(char *)); 917 910 } 918 911 tmpR.P=i; … … 960 953 tmpR.ch=rInternalChar(r1); 961 954 tmpR.P=rPar(r1); 962 tmpR.parameter=(char **)omAlloc(rPar(r1)*sizeof(char _ptr));955 tmpR.parameter=(char **)omAlloc(rPar(r1)*sizeof(char *)); 963 956 int i; 964 957 for (i=0;i<rPar(r1);i++) … … 988 981 tmpR.ch=rInternalChar(r2); 989 982 tmpR.P=rPar(r2); 990 tmpR.parameter=(char **)omAlloc(rPar(r2)*sizeof(char _ptr));983 tmpR.parameter=(char **)omAlloc(rPar(r2)*sizeof(char *)); 991 984 int i; 992 985 for (i=0;i<rPar(r2);i++) … … 1004 997 if (r2->parameter!=NULL) 1005 998 { 1006 tmpR.parameter=(char **)omAllocBin(char _ptr_bin);999 tmpR.parameter=(char **)omAllocBin(char *); 1007 1000 tmpR.P=1; 1008 1001 tmpR.parameter[0]=omStrDup(r2->parameter[0]); … … 1021 1014 tmpR.ch=rInternalChar(r1); 1022 1015 tmpR.P=rPar(r1); 1023 tmpR.parameter=(char **)omAlloc(rPar(r1)*sizeof(char _ptr));1016 tmpR.parameter=(char **)omAlloc(rPar(r1)*sizeof(char *)); 1024 1017 int i; 1025 1018 for(i=0;i<rPar(r1);i++) … … 1048 1041 tmpR.ch=rInternalChar(r2); 1049 1042 tmpR.P=rPar(r2); 1050 tmpR.parameter=(char **)omAlloc(rPar(r2)*sizeof(char _ptr));1043 tmpR.parameter=(char **)omAlloc(rPar(r2)*sizeof(char *)); 1051 1044 int i; 1052 1045 for(i=0;i<rPar(r2);i++) … … 1069 1062 int i,j,k; 1070 1063 int l=r1->N+r2->N; 1071 char **names=(char **)omAlloc0(l*sizeof(char _ptr));1064 char **names=(char **)omAlloc0(l*sizeof(char *)); 1072 1065 k=0; 1073 1066 … … 1319 1312 { 1320 1313 for(i=0;i<k;i++) omFree((ADDRESS)tmpR.names[i]); 1321 omFreeSize((ADDRESS)names,tmpR.N*sizeof(char _ptr));1314 omFreeSize((ADDRESS)names,tmpR.N*sizeof(char *)); 1322 1315 Werror("difficulties with variables: %d,%d -> %d",rVar(r1),rVar(r2),k); 1323 1316 return -1; … … 1496 1489 if (r2->qideal!=NULL) 1497 1490 { 1498 if (currRing!=sum)1499 rChangeCurrRing(sum);1491 //if (currRing!=sum) 1492 // rChangeCurrRing(sum); 1500 1493 int *perm2 = (int *)omAlloc0((rVar(r2)+1)*sizeof(int)); 1501 1494 int *par_perm2 = NULL; … … 1507 1500 Q2 = idInit(IDELEMS(r2->qideal),1); 1508 1501 for (int for_i=0;for_i<IDELEMS(r2->qideal);for_i++) 1509 Q2->m[for_i] = p PermPoly(r2->qideal->m[for_i],perm2,r2,nMap2,par_perm2,rPar(r2));1502 Q2->m[for_i] = p_PermPoly(r2->qideal->m[for_i],perm2,r2,nMap2,par_perm2,rPar(r2),sum); 1510 1503 omFree((ADDRESS)perm2); 1511 1504 } … … 1513 1506 { 1514 1507 Q = idSimpleAdd(Q1,Q2); 1515 rChangeCurrRing(old_ring2);1508 //rChangeCurrRing(old_ring2); 1516 1509 } 1517 1510 sum->qideal = Q; … … 1644 1637 if (r->parameter!=NULL) 1645 1638 { 1646 if (r->minpoly!=NULL) res->minpoly=n Copy(r->minpoly);1639 if (r->minpoly!=NULL) res->minpoly=n_Copy(r->minpoly,r->cf); 1647 1640 int l=rPar(r); 1648 res->parameter=(char **)omAlloc(l*sizeof(char _ptr));1641 res->parameter=(char **)omAlloc(l*sizeof(char *)); 1649 1642 int i; 1650 1643 for(i=0;i<rPar(r);i++) … … 1685 1678 //memset: } 1686 1679 1687 res->names = (char **)omAlloc0(rVar(r) * sizeof(char _ptr));1680 res->names = (char **)omAlloc0(rVar(r) * sizeof(char *)); 1688 1681 for (i=0; i<rVar(res); i++) 1689 1682 { … … 1747 1740 if (r1 == NULL || r2 == NULL) return FALSE; 1748 1741 1749 if ((r InternalChar(r1) != rInternalChar(r2))1742 if ((r1->cf->type != r2->cf->type) 1750 1743 || (r1->float_len != r2->float_len) 1751 1744 || (r1->float_len2 != r2->float_len2) … … 1816 1809 m2 = id2->m; 1817 1810 for (i=0; i<n; i++) 1818 if (! p EqualPolys(m1[i],m2[i])) return FALSE;1811 if (! p_EqualPolys(m1[i],m2[i],r1)) return FALSE; 1819 1812 } 1820 1813 } … … 1836 1829 if (r1 == NULL || r2 == NULL) return FALSE; 1837 1830 1838 if ((r InternalChar(r1) != rInternalChar(r2))1831 if ((r1->cf->type != r2->cf->type) 1839 1832 || (r1->float_len != r2->float_len) 1840 1833 || (r1->float_len2 != r2->float_len2) … … 5159 5152 n_coeffType rFieldType(ring r) 5160 5153 { 5154 return (r->cf->type); 5161 5155 if (rField_is_Zp(r)) return n_Zp; 5162 5156 if (rField_is_Q(r)) return n_Q;
Note: See TracChangeset
for help on using the changeset viewer.