Changeset 5625fe in git
- Timestamp:
- Feb 19, 2013, 1:20:53 PM (10 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- e3c718ce6966101d56d035026b091d8a404af532
- Parents:
- 73b2e93d708311ad220a6ca578c7bff10757938aedb81bb221ceae0874c0570e0ac83e5a84b6f77d
- Files:
-
- 12 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/iparith.cc
r73b2e9 r5625fe 63 63 #include <Singular/linearAlgebra_ip.h> 64 64 #ifdef HAVE_FACTORY 65 # include <factory/factory.h> 65 66 # include <polys/clapsing.h> 66 67 # include <kernel/kstdfac.h> 67 #endif /* HAVE_FACTORY */68 #ifdef HAVE_FACTORY69 68 # include <kernel/fglm.h> 70 69 # include <Singular/fglm.h> … … 2351 2350 static BOOLEAN jjGCD_BI(leftv res, leftv u, leftv v) 2352 2351 { 2352 #ifdef HAVE_FACTORY 2353 number n1 = (number) u->CopyD(); 2354 number n2 = (number) v->CopyD(); 2355 CanonicalForm C1, C2; 2356 C1 = coeffs_BIGINT->convSingNFactoryN (n1,TRUE,coeffs_BIGINT); 2357 C2 = coeffs_BIGINT->convSingNFactoryN (n2,TRUE,coeffs_BIGINT); 2358 CanonicalForm G = gcd (C1,C2); 2359 number g = coeffs_BIGINT->convFactoryNSingN (G,coeffs_BIGINT); 2360 res->data = g; 2361 return FALSE; 2362 #else 2353 2363 number a=(number) u->Data(); 2354 2364 number b=(number) v->Data(); … … 2364 2374 } 2365 2375 return FALSE; 2376 #endif 2366 2377 } 2367 2378 static BOOLEAN jjGCD_N(leftv res, leftv u, leftv v) -
Tst/New.lst
redb81b r5625fe 18 18 New/print_param_poly_short.tst 19 19 New/ignoring_denominators_of_coefficients.tst 20 New/syz_cleardenom.tst 21 New/sat_cleardenom.tst 22 New/quotient_cleardenom.tst 23 -
Tst/Short.lst
redb81b r5625fe 243 243 ;MP Short/stratify.tst 244 244 Short/string.tst 245 Short/symodstd.tst 245 246 Short/test_c_dp.tst 246 247 Short/triang_s.tst -
Tst/Short/ncfactor_example2_7FromMaster_s.tst
-
Property
mode
changed from
100755
to100644
-
Property
mode
changed from
-
Tst/Short/ncfactor_example_all_procedures_s.res.gz.uu
-
Property
mode
changed from
100755
to100644
-
Property
mode
changed from
-
Tst/Short/ncfactor_inhomog_s.res.gz.uu
-
Property
mode
changed from
100755
to100644
-
Property
mode
changed from
-
Tst/Short/ncfactor_koepfShift_s.tst
-
Property
mode
changed from
100755
to100644
-
Property
mode
changed from
-
Tst/Short/ncfactor_koepf_s.tst
-
Property
mode
changed from
100755
to100644
-
Property
mode
changed from
-
Tst/Short/ncfactor_tsai_s.tst
-
Property
mode
changed from
100755
to100644
-
Property
mode
changed from
-
factory/ftmpl_inst.cc
r73b2e9 r5625fe 44 44 template class SubMatrix<CanonicalForm>; 45 45 template class Array<REvaluation>; 46 // libfac: 47 template class Array<int>; 48 template class Array<Variable>; 49 template class List<Variable>; 50 template class ListItem<Variable>; 51 template class ListIterator<Variable> ; 52 template class List<int>; 53 template class ListItem<int>; 54 template class ListIterator<int>; 55 template class List< List<int> >; 56 template class ListItem< List<int> >; 57 template class ListIterator< List<int> >; 58 template class List< List<CanonicalForm> >; 59 template class ListIterator< List<CanonicalForm> >; 60 61 62 template List<Variable> Union ( const List<Variable>&, const List<Variable>& ); 63 template List<Variable> Difference ( const List<Variable>&, const List<Variable>& ); 64 46 65 //}}} 47 66 -
factory/int_rat.cc
r73b2e9 r5625fe 13 13 #include "gmpext.h" 14 14 15 static int intgcd( int a, intb )15 static long intgcd( long a, long b ) 16 16 { 17 17 if ( a < 0 ) a = -a; 18 18 if ( b < 0 ) b = -b; 19 19 20 intc;20 long c; 21 21 22 22 while ( b != 0 ) … … 29 29 } 30 30 31 static long intgcd( long a, long b )32 {33 if ( a < 0 ) a = -a;34 if ( b < 0 ) b = -b;35 36 long c;37 38 while ( b != 0 )39 {40 c = a % b;41 a = b;42 b = c;43 }44 return a;45 }46 47 31 48 32 InternalRational::InternalRational() … … 68 52 else 69 53 { 70 int g = intgcd( n,d );54 long g = intgcd( (long) n, (long) d ); 71 55 if ( d < 0 ) 72 56 { 73 mpz_init_set_si( _num, - n/ g );74 mpz_init_set_si( _den, - d/ g );57 mpz_init_set_si( _num, -((long)n) / g ); 58 mpz_init_set_si( _den, -((long)d) / g ); 75 59 } 76 60 else -
factory/libfac/factor/tmpl_inst.cc
r73b2e9 r5625fe 13 13 #include "cf_reval.h" 14 14 15 #include "templates/ftmpl_array.cc"16 #include "templates/ftmpl_factor.cc"15 //#include "templates/ftmpl_array.cc" 16 //#include "templates/ftmpl_factor.cc" 17 17 #include "templates/ftmpl_list.cc" 18 #include "templates/ftmpl_functions.h"19 #include "templates/ftmpl_matrix.cc"18 //#include "templates/ftmpl_functions.h" 19 //#include "templates/ftmpl_matrix.cc" 20 20 21 21 // place here your own template stuff, not instantiated by factory … … 23 23 #include <libfac/factor/class.cc> 24 24 25 template class List<int>; 26 template class ListIterator<int>; 27 28 template class List<IntList>; 29 template class ListIterator<IntList>; 25 //template class List<IntList>; 26 //template class ListIterator<IntList>; 30 27 31 28 template class Substitution<CanonicalForm>; … … 39 36 40 37 // for charsets: 41 template class List<CFList>; 42 template class ListIterator<CFList>; 43 template class List<Variable>; 44 template class ListIterator<Variable> ; 45 46 template List<Variable> Union ( const List<Variable>&, const List<Variable>& ); 47 template List<Variable> Difference ( const List<Variable>&, const List<Variable>& ); 38 //template class List<CFList>; 39 //template class ListIterator<CFList>; 48 40 49 41 #ifndef NOSTREAMIO -
libpolys/polys/ext_fields/algext.cc
redb81b r5625fe 52 52 #endif 53 53 54 54 55 55 #include <polys/ext_fields/algext.h> 56 56 #define TRANSEXT_PRIVATES 1 … … 670 670 } 671 671 #endif 672 number napLcm(number b, const coeffs cf) 673 { 674 number h=n_Init(1,naRing->cf); 675 poly bb=(poly)b; 676 number d; 677 while(bb!=NULL) 678 { 679 d=n_Lcm(h,pGetCoeff(bb), naRing->cf); 680 n_Delete(&h,naRing->cf); 681 h=d; 682 pIter(bb); 683 } 684 } 685 number naLcmContent(number a, number b, const coeffs cf) 686 { 687 if (nCoeff_is_Zp(naRing->cf)) return naCopy(a,cf); 688 else return ndGcd(a,b,cf); 689 #if 0 690 { 691 a=(number)p_Copy((poly)a,naRing); 692 number t=napLcm(b,cf); 693 if(!naIsOne(t,cf)) 694 { 695 number bt, rr; 696 poly xx=(poly)a; 697 while (xx!=NULL) 698 { 699 bt = n_Gcd(t, pGetCoeff(xx), naRing->cf); 700 rr = n_Mult(t, pGetCoeff(xx), naRing->cf); 701 n_Delete(&pGetCoeff(xx),naRing->cf); 702 pGetCoeff(xx) = n_Div(rr, bt, naRing->cf); 703 n_Normalize(pGetCoeff(xx),naRing->cf); 704 n_Delete(&bt,naRing->cf); 705 n_Delete(&rr,naRing->cf); 706 pIter(xx); 707 } 708 } 709 n_Delete(&t,naRing->cf); 710 return (number) a; 711 } 712 #endif 713 } 672 714 673 715 /* expects *param to be castable to AlgExtInfo */ … … 689 731 if( rEqual(naRing, e->r, TRUE) ) // also checks the equality of qideals 690 732 { 691 const ideal mi = naRing->qideal; 733 const ideal mi = naRing->qideal; 692 734 assume( IDELEMS(mi) == 1 ); 693 735 const ideal ii = e->r->qideal; … … 696 738 // TODO: the following should be extended for 2 *equal* rings... 697 739 assume( p_EqualPolys(mi->m[0], ii->m[0], naRing, e->r) ); 698 740 699 741 rDelete(e->r); 700 742 701 743 return TRUE; 702 744 } … … 773 815 number naGcd(number a, number b, const coeffs cf) 774 816 { 817 if (a==NULL) return naCopy(b,cf); 818 if (b==NULL) return naCopy(a,cf); 819 820 poly ax=(poly)a; 821 poly bx=(poly)b; 822 if (pNext(ax)!=NULL) 823 return (number)p_Copy(ax, naRing); 824 else 825 { 826 if(nCoeff_is_Zp(naRing->cf)) 827 return naInit(1,cf); 828 else 829 { 830 number x = n_Copy(pGetCoeff((poly)a),naRing->cf); 831 if (n_IsOne(x,naRing->cf)) 832 return (number)p_NSet(x,naRing); 833 while (pNext(ax)!=NULL) 834 { 835 pIter(ax); 836 number y = n_Gcd(x, pGetCoeff(ax), naRing->cf); 837 n_Delete(&x,naRing->cf); 838 x = y; 839 if (n_IsOne(x,naRing->cf)) 840 return (number)p_NSet(x,naRing); 841 } 842 do 843 { 844 number y = n_Gcd(x, pGetCoeff(bx), naRing->cf); 845 n_Delete(&x,naRing->cf); 846 x = y; 847 if (n_IsOne(x,naRing->cf)) 848 return (number)p_NSet(x,naRing); 849 pIter(bx); 850 } 851 while (bx!=NULL); 852 return (number)p_NSet(x,naRing); 853 } 854 } 855 #if 0 775 856 naTest(a); naTest(b); 776 if ((a == NULL) && (b == NULL)) WerrorS(nDivBy0);777 857 const ring R = naRing; 778 858 return (number) singclap_gcd(p_Copy((poly)a, R), p_Copy((poly)b, R), R); 859 #endif 779 860 // return (number)p_Gcd((poly)a, (poly)b, naRing); 780 861 } … … 784 865 naTest(a); 785 866 if (a == NULL) WerrorS(nDivBy0); 786 867 787 868 poly aFactor = NULL; poly mFactor = NULL; poly theGcd = NULL; 788 869 // singclap_extgcd! … … 792 873 793 874 // if( ret ) theGcd = p_ExtGcd((poly)a, aFactor, naMinpoly, mFactor, naRing); 794 875 795 876 naTest((number)theGcd); naTest((number)aFactor); naTest((number)mFactor); 796 877 p_Delete(&mFactor, naRing); 797 878 798 879 // /* the gcd must be 1 since naMinpoly is irreducible and a != NULL: */ 799 // assume(naIsOne((number)theGcd, cf)); 880 // assume(naIsOne((number)theGcd, cf)); 800 881 801 882 if( !naIsOne((number)theGcd, cf) ) 802 { 883 { 803 884 WerrorS("zero divisor found - your minpoly is not irreducible"); 804 885 p_Delete(&aFactor, naRing); aFactor = NULL; … … 984 1065 const ring R = cf->extRing; 985 1066 assume(R != NULL); 986 const coeffs Q = R->cf; 987 assume(Q != NULL); 988 assume(nCoeff_is_Q(Q)); 1067 const coeffs Q = R->cf; 1068 assume(Q != NULL); 1069 assume(nCoeff_is_Q(Q)); 989 1070 990 1071 numberCollectionEnumerator.Reset(); … … 1004 1085 1005 1086 int normalcount = 0; 1006 1087 1007 1088 poly cand1, cand; 1008 1089 1009 1090 do 1010 1091 { … … 1013 1094 1014 1095 naTest(n); 1015 1096 1016 1097 cand1 = (poly)n; 1017 1098 … … 1036 1117 number& n = numberCollectionEnumerator.Current(); 1037 1118 ++length; 1038 1119 1039 1120 if( (--normalcount) <= 0) 1040 1121 naNormalize(n, cf); 1041 1122 1042 1123 naTest(n); 1043 1124 1044 1125 // p_InpGcd(cand, (poly)n, R); 1045 1126 1046 1127 cand = singclap_gcd(cand, p_Copy((poly)n, R), R); 1047 1128 1048 1129 // cand1 = p_Gcd(cand,(poly)n, R); p_Delete(&cand, R); cand = cand1; 1049 1130 1050 1131 assume( naGreaterZero((number)cand, cf) ); // ??? 1051 1132 /* … … 1069 1150 } 1070 1151 */ 1071 1072 } 1152 1153 } 1073 1154 1074 1155 // part3: all coeffs = all coeffs / cand … … 1076 1157 cand = p_Neg(cand, R); 1077 1158 1078 c = (number)cand; naTest(c); 1159 c = (number)cand; naTest(c); 1079 1160 1080 1161 poly cInverse = (poly)naInvers(c, cf); 1081 1162 assume(cInverse != NULL); // c is non-zero divisor!? 1082 1163 1083 1164 1084 1165 numberCollectionEnumerator.Reset(); 1085 1166 … … 1102 1183 assume(length == 0); 1103 1184 } 1104 1105 definiteReduce((poly &)n, naMinpoly, cf); 1106 } 1107 1185 1186 definiteReduce((poly &)n, naMinpoly, cf); 1187 } 1188 1108 1189 assume(length == 0); 1109 1190 assume(cInverse == NULL); // p_Delete(&cInverse, R); … … 1114 1195 number cc; 1115 1196 1116 n_ClearContent(itr, cc, Q); // TODO: get rid of (-LC) normalization!? 1197 n_ClearContent(itr, cc, Q); // TODO: get rid of (-LC) normalization!? 1117 1198 1118 1199 // over alg. ext. of Q // takes over the input number 1119 c = (number) p_Mult_nn( (poly)c, cc, R); 1200 c = (number) p_Mult_nn( (poly)c, cc, R); 1120 1201 // p_Mult_q(p_NSet(cc, R), , R); 1121 1202 … … 1169 1250 } 1170 1251 } 1171 */ 1172 1173 1252 */ 1253 1254 1174 1255 // c = n_Init(1, cf); assume(FALSE); // TODO: NOT YET IMPLEMENTED!!! 1175 1256 } … … 1183 1264 1184 1265 assume(cf->extRing != NULL); 1185 const coeffs Q = cf->extRing->cf; 1186 assume(Q != NULL); 1187 assume(nCoeff_is_Q(Q)); 1266 const coeffs Q = cf->extRing->cf; 1267 assume(Q != NULL); 1268 assume(nCoeff_is_Q(Q)); 1188 1269 number n; 1189 1270 CRecursivePolyCoeffsEnumerator<NAConverter> itr(numberCollectionEnumerator); // recursively treat the numbers as polys! … … 1269 1350 #endif 1270 1351 cf->cfGcd = naGcd; 1271 //cf->cfLcm = naLcm;1352 cf->cfLcm = naLcmContent; 1272 1353 cf->cfSize = naSize; 1273 1354 cf->nCoeffIsEqual = naCoeffIsEqual; … … 1289 1370 cf->cfClearDenominators = naClearDenominators; 1290 1371 } 1291 1372 1292 1373 return FALSE; 1293 1374 }
Note: See TracChangeset
for help on using the changeset viewer.