Changeset 96113d in git for factory/NTLconvert.cc
- Timestamp:
- Sep 22, 2020, 12:15:32 PM (4 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'c5facdfddea2addfd91babd8b9019161dea4b695')
- Children:
- 2b855d1c8b46f692768e9f35250ef5b613a65527
- Parents:
- 0009d27fbcef51e5c96bad3b03f4c4205b1fc4ae
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/NTLconvert.cc
r0009d2 r96113d 359 359 /// factorization of NTL to convert the result back to Factory. 360 360 /// 361 /// Additionally a variable x and the computed multiplicity, as a type ZZp361 /// Additionally a variable x and the computed content, as a type ZZp 362 362 /// of NTL, is needed as parameters indicating the main variable of the 363 /// computed canonicalform and the multiplicityof the original polynomial.363 /// computed canonicalform and the conent of the original polynomial. 364 364 /// To guarantee the correct execution of the algorithm the characteristic 365 365 /// has a be an arbitrary prime number. 366 366 /// 367 367 /// INPUT: A vector of polynomials over ZZp of type vec_pair_ZZ_pX_long and 368 /// a variable x and a multiplicityof type ZZp368 /// a variable x and a content of type ZZp 369 369 /// OUTPUT: The converted list of polynomials of type CFFList, all polynomials 370 370 /// have x as their main variable … … 372 372 373 373 CFFList convertNTLvec_pair_ZZpX_long2FacCFFList 374 (const vec_pair_ZZ_pX_long & e,const ZZ_p & multi,const Variable & x)374 (const vec_pair_ZZ_pX_long & e,const ZZ_p & cont,const Variable & x) 375 375 { 376 376 //printf("convertNTLvec_pair_ZZpX_long2FacCFFList\n"); … … 391 391 result.append(CFFactor(convertNTLZZpX2CF(e[i].a,x),e[i].b)); 392 392 } 393 // the multiplicity at pos 1 394 if (!IsOne(multi)) 395 result.insert(CFFactor(CanonicalForm(to_long(rep(multi))),1)); 393 // the content at pos 1 394 result.insert(CFFactor(CanonicalForm(to_long(rep(cont))),1)); 396 395 return result; 397 396 } 398 397 CFFList convertNTLvec_pair_zzpX_long2FacCFFList 399 (const vec_pair_zz_pX_long & e,const zz_p multi,const Variable & x)398 (const vec_pair_zz_pX_long & e,const zz_p cont,const Variable & x) 400 399 { 401 400 //printf("convertNTLvec_pair_zzpX_long2FacCFFList\n"); … … 416 415 result.append(CFFactor(convertNTLzzpX2CF(e[i].a,x),e[i].b)); 417 416 } 418 // the multiplicity at pos 1 419 if (!IsOne(multi)) 420 result.insert(CFFactor(CanonicalForm(to_long(rep(multi))),1)); 417 // the content at pos 1 418 result.insert(CFFactor(CanonicalForm(to_long(rep(cont))),1)); 421 419 return result; 422 420 } … … 431 429 /// As usual this is simply a special case of the more general conversion 432 430 /// routine but again speeded up by leaving out unnecessary steps. 433 /// Additionally a variable x and the computed multiplicity, as type431 /// Additionally a variable x and the computed content, as type 434 432 /// GF2 of NTL, are needed as parameters indicating the main variable of the 435 /// computed canonicalform and the multiplicityof the original polynomial.433 /// computed canonicalform and the content of the original polynomial. 436 434 /// To guarantee the correct execution of the algorithm the characteristic 437 435 /// has a be an arbitrary prime number. 438 436 /// 439 437 /// INPUT: A vector of polynomials over GF2 of type vec_pair_GF2X_long and 440 /// a variable x and a multiplicityof type GF2438 /// a variable x and a content of type GF2 441 439 /// OUTPUT: The converted list of polynomials of type CFFList, all 442 440 /// polynomials have x as their main variable … … 444 442 445 443 CFFList convertNTLvec_pair_GF2X_long2FacCFFList 446 (const vec_pair_GF2X_long& e, GF2 /* multi*/, const Variable & x)444 (const vec_pair_GF2X_long& e, GF2 /*cont*/, const Variable & x) 447 445 { 448 446 //printf("convertNTLvec_pair_GF2X_long2FacCFFList\n"); … … 457 455 // so it is omitted. 458 456 459 //We do not have to worry about the multiplicity in GF2 since it equals one.460 461 457 // Go through the vector e and compute the CFFList 462 458 // bigone summarizes the result again … … 476 472 result.append(CFFactor(bigone,exponent)); 477 473 } 474 result.insert(CFFactor(1,1)); 478 475 return result; 479 476 } … … 739 736 /// CFFList of Factory. This routine will be used after a successful 740 737 /// factorization of NTL to convert the result back to Factory. 741 /// Additionally a variable x and the computed multiplicity, as a type738 /// Additionally a variable x and the computed content, as a type 742 739 /// ZZ of NTL, is needed as parameters indicating the main variable of the 743 /// computed canonicalform and the multiplicityof the original polynomial.740 /// computed canonicalform and the content of the original polynomial. 744 741 /// To guarantee the correct execution of the algorithm the characteristic 745 742 /// has to equal zero. 746 743 /// 747 744 /// INPUT: A vector of polynomials over ZZ of type vec_pair_ZZX_long and 748 /// a variable x and a multiplicityof type ZZ745 /// a variable x and a content of type ZZ 749 746 /// OUTPUT: The converted list of polynomials of type CFFList, all 750 747 /// have x as their main variable … … 752 749 753 750 CFFList 754 convertNTLvec_pair_ZZX_long2FacCFFList (const vec_pair_ZZX_long & e,const ZZ & multi,const Variable & x)751 convertNTLvec_pair_ZZX_long2FacCFFList (const vec_pair_ZZX_long & e,const ZZ & cont,const Variable & x) 755 752 { 756 753 CFFList result; … … 770 767 result.append(CFFactor(bigone,exponent)); 771 768 } 772 // the multiplicityat pos 1773 result.insert(CFFactor(convertZZ2CF( multi),1));769 // the content at pos 1 770 result.insert(CFFactor(convertZZ2CF(cont),1)); 774 771 775 772 //return the converted list … … 810 807 /// of Factory. This routine will be used after a successful factorization 811 808 /// of NTL to convert the result back to Factory. 812 /// Additionally a variable x and the computed multiplicity, as a type809 /// Additionally a variable x and the computed content, as a type 813 810 /// ZZpE of NTL, is needed as parameters indicating the main variable of the 814 /// computed canonicalform and the multiplicityof the original polynomial.811 /// computed canonicalform and the content of the original polynomial. 815 812 /// To guarantee the correct execution of the algorithm the characteristic 816 813 /// has a be an arbitrary prime number p and computations have to be done … … 818 815 /// 819 816 /// INPUT: A vector of polynomials over ZZpE of type vec_pair_ZZ_pEX_long and 820 /// a variable x and a multiplicityof type ZZpE817 /// a variable x and a content of type ZZpE 821 818 /// OUTPUT: The converted list of polynomials of type CFFList, all polynomials 822 819 /// have x as their main variable … … 824 821 825 822 CFFList 826 convertNTLvec_pair_ZZpEX_long2FacCFFList(const vec_pair_ZZ_pEX_long & e,const ZZ_pE & multi,const Variable & x,const Variable & alpha)823 convertNTLvec_pair_ZZpEX_long2FacCFFList(const vec_pair_ZZ_pEX_long & e,const ZZ_pE & cont,const Variable & x,const Variable & alpha) 827 824 { 828 825 CFFList result; … … 861 858 result.append(CFFactor(bigone,exponent)); 862 859 } 863 // Start by appending the multiplicity 864 if (!IsOne(multi)) 865 result.insert(CFFactor(convertNTLZZpE2CF(multi,alpha),1)); 860 // Start by insert the content 861 result.insert(CFFactor(convertNTLZZpE2CF(cont,alpha),1)); 866 862 867 863 //return the computed CFFList … … 869 865 } 870 866 CFFList 871 convertNTLvec_pair_zzpEX_long2FacCFFList(const vec_pair_zz_pEX_long & e,const zz_pE & multi,const Variable & x,const Variable & alpha)867 convertNTLvec_pair_zzpEX_long2FacCFFList(const vec_pair_zz_pEX_long & e,const zz_pE & cont,const Variable & x,const Variable & alpha) 872 868 { 873 869 CFFList result; … … 906 902 result.append(CFFactor(bigone,exponent)); 907 903 } 908 // Start by appending the multiplicity 909 if (!IsOne(multi)) 910 result.insert(CFFactor(convertNTLzzpE2CF(multi,alpha),1)); 904 // Start by appending the constant factor 905 result.insert(CFFactor(convertNTLzzpE2CF(cont,alpha),1)); 911 906 912 907 //return the computed CFFList … … 945 940 /// This is a special, but optimized case of the more general conversion 946 941 /// from ZZpE to canonicalform. 947 /// Additionally a variable x and the computed multiplicity, as a type GF2E942 /// Additionally a variable x and the computed content, as a type GF2E 948 943 /// of NTL, is needed as parameters indicating the main variable of the 949 /// computed canonicalform and the multiplicityof the original polynomial.944 /// computed canonicalform and the content of the original polynomial. 950 945 /// To guarantee the correct execution of the algorithm the characteristic 951 946 /// has to equal two and computations have to be done in an extention of F_2. 952 947 /// 953 948 /// INPUT: A vector of polynomials over GF2E of type vec_pair_GF2EX_long and 954 /// a variable x and a multiplicityof type GF2E949 /// a variable x and a content of type GF2E 955 950 /// OUTPUT: The converted list of polynomials of type CFFList, all polynomials 956 951 /// have x as their main variable … … 958 953 959 954 CFFList convertNTLvec_pair_GF2EX_long2FacCFFList 960 (const vec_pair_GF2EX_long & e, const GF2E & multi, const Variable & x, const Variable & alpha)955 (const vec_pair_GF2EX_long & e, const GF2E & cont, const Variable & x, const Variable & alpha) 961 956 { 962 957 CFFList result; … … 967 962 // Maybe, e may additionally be sorted with respect to increasing degree of x, but this is not 968 963 //important for the factorization, but nevertheless would take computing time, so it is omitted 969 970 // multiplicity is always one, so we do not have to worry about that971 964 972 965 // Go through the vector e and build up the CFFList … … 994 987 } 995 988 } 996 997 989 // append the computed polynomial together with its multiplicity 998 990 result.append(CFFactor(bigone,exponent)); 999 1000 } 1001 1002 if (!IsOne(multi)) 1003 result.insert(CFFactor(convertNTLGF2E2CF(multi,alpha),1)); 991 } 992 993 result.insert(CFFactor(convertNTLGF2E2CF(cont,alpha),1)); 1004 994 1005 995 // return the computed CFFList
Note: See TracChangeset
for help on using the changeset viewer.