Changeset 3ef9c8 in git
- Timestamp:
- Dec 10, 2011, 12:51:17 AM (11 years ago)
- Branches:
- (u'spielwiese', '8d54773d6c9e2f1d2593a28bc68b7eeab54ed529')
- Children:
- f41d12e69588befe7fc3383e41747d4ac6575de4f78374aba946095faa511cce5808e17088898c1a
- Parents:
- 600d9a415e87303ccbc4a8f4460e9617a66c7f81
- git-author:
- Martin Lee <martinlee84@web.de>2011-12-10 00:51:17+01:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-12-12 21:04:28+01:00
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/iparith.cc
r600d9a r3ef9c8 3154 3154 if ((sw<0)||(sw>2)) fac_sw=1; 3155 3155 singclap_factorize_retry=0; 3156 ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, fac_sw );3156 ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, fac_sw, currRing); 3157 3157 if (f==NULL) 3158 3158 return TRUE; … … 4682 4682 { 4683 4683 singclap_factorize_retry=0; 4684 intvec *v=NULL; 4684 4685 ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, 0, currRing); 4685 4686 if (f==NULL) return TRUE; -
libpolys/polys/clapsing.cc
r600d9a r3ef9c8 952 952 return res; 953 953 } 954 ideal singclap_sqrfree ( poly f, const ring r)954 ideal singclap_sqrfree ( poly f, intvec ** v , int with_exps, const ring r) 955 955 { 956 956 p_Test(f,r); … … 969 969 { 970 970 res=idInit(1,1); 971 if (with_exps!=1) 972 { 973 (*v)=new intvec(1); 974 (**v)[0]=1; 975 } 971 976 return res; 972 977 } … … 978 983 int e; 979 984 for(i=rVar(r);i>0;i--) if(p_GetExp(f,i,r)!=0) n++; 980 n++; // with coeff985 if (with_exps==0) n++; // with coeff 981 986 res=idInit(si_max(n,1),1); 987 switch(with_exps) 988 { 989 case 0: // with coef & exp. 990 res->m[0]=p_NSet(n_Copy(pGetCoeff(f),r->cf),r); 991 // no break 992 case 2: // with exp. 993 (*v)=new intvec(si_max(1,n)); 994 (**v)[0]=1; 995 // no break 996 case 1: ; 997 #ifdef TEST 998 default: ; 999 #endif 1000 } 982 1001 res->m[0]=p_NSet(n_Copy(pGetCoeff(f),r->cf),r); 983 1002 if (n==0) … … 985 1004 res->m[0]=p_One(r); 986 1005 // (**v)[0]=1; is already done 987 return res; 988 } 989 for(i=rVar(r);i>0;i--) 990 { 991 e=p_GetExp(f,i,r); 992 if(e!=0) 993 { 994 n--; 995 poly p=p_One(r); 996 p_SetExp(p,i,1,r); 997 p_Setm(p,r); 998 res->m[n]=p; 999 } 1000 } 1006 } 1007 else 1008 { 1009 for(i=rVar(r);i>0;i--) 1010 { 1011 e=p_GetExp(f,i,r); 1012 if(e!=0) 1013 { 1014 n--; 1015 poly p=p_One(r); 1016 p_SetExp(p,i,1,r); 1017 p_Setm(p,r); 1018 res->m[n]=p; 1019 if (with_exps!=1) (**v)[n]=e; 1020 } 1021 } 1022 } 1023 p_Delete(&f,r); 1001 1024 return res; 1002 1025 } … … 1010 1033 #endif 1011 1034 CFFList L; 1035 number N=NULL; 1036 number NN=NULL; 1012 1037 1013 1038 if (!rField_is_Zp(r) && !rField_is_Zp_a(r)) /* Q, Q(a) */ 1014 1039 { 1015 1040 //if (f!=NULL) // already tested at start of routine 1016 { 1017 p_Cleardenom(f, r); 1041 number n0=n_Copy(pGetCoeff(f),r->cf); 1042 if (with_exps==0) 1043 N=n_Copy(n0,r->cf); 1044 p_Cleardenom(f, r); 1045 //after here f should not have a denominator!! 1046 //PrintS("S:");p_Write(f,r);PrintLn(); 1047 NN=n_Div(n0,pGetCoeff(f),r->cf); 1048 n_Delete(&n0,r->cf); 1049 if (with_exps==0) 1050 { 1051 n_Delete(&N,r->cf); 1052 N=n_Copy(NN,r->cf); 1018 1053 } 1019 1054 } … … 1023 1058 if (singclap_factorize_retry==0) 1024 1059 { 1060 number n0=n_Copy(pGetCoeff(f),r->cf); 1061 if (with_exps==0) 1062 N=n_Copy(n0,r->cf); 1025 1063 p_Norm(f,r); 1026 1064 p_Cleardenom(f, r); 1065 NN=n_Div(n0,pGetCoeff(f),r->cf); 1066 n_Delete(&n0,r->cf); 1067 if (with_exps==0) 1068 { 1069 n_Delete(&N,r->cf); 1070 N=n_Copy(NN,r->cf); 1071 } 1027 1072 } 1028 1073 } … … 1032 1077 CanonicalForm F( convSingPFactoryP( f,r ) ); 1033 1078 L = sqrFree( F ); 1079 } 1080 else if (rField_is_Extension(r)) 1081 { 1082 if (rField_is_Q_a (r)) setCharacteristic (0); 1083 else setCharacteristic( rChar(r) ); 1084 if (r->cf->extRing->minideal!=NULL) 1085 { 1086 CanonicalForm mipo=convSingPFactoryP(r->cf->extRing->minideal->m[0], 1087 r->cf->extRing); 1088 Variable a=rootOf(mipo); 1089 CanonicalForm F( convSingAPFactoryAP( f, a, r ) ); 1090 L= sqrFree (F); 1091 } 1092 else 1093 { 1094 CanonicalForm F( convSingTrPFactoryP( f,r ) ); 1095 L = sqrFree( F ); 1096 } 1034 1097 } 1035 1098 #if 0 … … 1059 1122 CFFListIterator J=L; 1060 1123 int j=0; 1124 if (with_exps!=1) 1125 { 1126 if ((with_exps==2)&&(n>1)) 1127 { 1128 n--; 1129 J++; 1130 } 1131 *v = new intvec( n ); 1132 } 1133 else if (L.getFirst().factor().inCoeffDomain()) 1134 { 1135 n--; 1136 J++; 1137 } 1061 1138 res = idInit( n ,1); 1062 1139 for ( ; J.hasItem(); J++, j++ ) 1063 1140 { 1064 res->m[j] = convFactoryPSingP( J.getItem().factor(),r ); 1141 if (with_exps!=1) (**v)[j] = J.getItem().exp(); 1142 if (rField_is_Zp(r) || rField_is_Q(r)) 1143 res->m[j] = convFactoryPSingP( J.getItem().factor(),r ); 1144 else if (rField_is_Extension(r)) /* Q(a), Fp(a) */ 1145 { 1146 if (r->cf->extRing->minideal==NULL) 1147 res->m[j]=convFactoryPSingTrP( J.getItem().factor(),r ); 1148 else 1149 res->m[j]=convFactoryAPSingAP( J.getItem().factor(),r ); 1150 } 1065 1151 } 1066 1152 if (res->m[0]==NULL) -
libpolys/polys/clapsing.h
r600d9a r3ef9c8 39 39 ideal singclap_factorize ( poly f, intvec ** v , int with_exps, const ring r); 40 40 41 ideal singclap_sqrfree ( poly f, const ring r );41 ideal singclap_sqrfree ( poly f, intvec ** v , int with_exps, const ring r ); 42 42 43 43 #ifdef HAVE_NTL
Note: See TracChangeset
for help on using the changeset viewer.