Changeset 96113d in git for factory/NTLconvert.cc


Ignore:
Timestamp:
Sep 22, 2020, 12:15:32 PM (4 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'c5facdfddea2addfd91babd8b9019161dea4b695')
Children:
2b855d1c8b46f692768e9f35250ef5b613a65527
Parents:
0009d27fbcef51e5c96bad3b03f4c4205b1fc4ae
Message:
fix: always add content in conversion of factors from NTL
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/NTLconvert.cc

    r0009d2 r96113d  
    359359/// factorization of NTL to convert the result back to Factory.
    360360///
    361 /// Additionally a variable x and the computed multiplicity, as a type ZZp
     361/// Additionally a variable x and the computed content, as a type ZZp
    362362/// of NTL, is needed as parameters indicating the main variable of the
    363 /// computed canonicalform and the multiplicity of the original polynomial.
     363/// computed canonicalform and the conent of the original polynomial.
    364364/// To guarantee the correct execution of the algorithm the characteristic
    365365/// has a be an arbitrary prime number.
    366366///
    367367/// INPUT:  A vector of polynomials over ZZp of type vec_pair_ZZ_pX_long and
    368 ///         a variable x and a multiplicity of type ZZp
     368///         a variable x and a content of type ZZp
    369369/// OUTPUT: The converted list of polynomials of type CFFList, all polynomials
    370370///         have x as their main variable
     
    372372
    373373CFFList 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)
    375375{
    376376  //printf("convertNTLvec_pair_ZZpX_long2FacCFFList\n");
     
    391391    result.append(CFFactor(convertNTLZZpX2CF(e[i].a,x),e[i].b));
    392392  }
    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));
    396395  return result;
    397396}
    398397CFFList 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)
    400399{
    401400  //printf("convertNTLvec_pair_zzpX_long2FacCFFList\n");
     
    416415    result.append(CFFactor(convertNTLzzpX2CF(e[i].a,x),e[i].b));
    417416  }
    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));
    421419  return result;
    422420}
     
    431429/// As usual this is simply a special case of the more general conversion
    432430/// routine but again speeded up by leaving out unnecessary steps.
    433 /// Additionally a variable x and the computed multiplicity, as type
     431/// Additionally a variable x and the computed content, as type
    434432/// GF2 of NTL, are needed as parameters indicating the main variable of the
    435 /// computed canonicalform and the multiplicity of the original polynomial.
     433/// computed canonicalform and the content of the original polynomial.
    436434/// To guarantee the correct execution of the algorithm the characteristic
    437435/// has a be an arbitrary prime number.
    438436///
    439437/// INPUT:  A vector of polynomials over GF2 of type vec_pair_GF2X_long and
    440 ///         a variable x and a multiplicity of type GF2
     438///         a variable x and a content of type GF2
    441439/// OUTPUT: The converted list of polynomials of type CFFList, all
    442440///         polynomials have x as their main variable
     
    444442
    445443CFFList 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)
    447445{
    448446  //printf("convertNTLvec_pair_GF2X_long2FacCFFList\n");
     
    457455  // so it is omitted.
    458456
    459   //We do not have to worry about the multiplicity in GF2 since it equals one.
    460 
    461457  // Go through the vector e and compute the CFFList
    462458  // bigone summarizes the result again
     
    476472    result.append(CFFactor(bigone,exponent));
    477473  }
     474  result.insert(CFFactor(1,1));
    478475  return result;
    479476}
     
    739736/// CFFList of Factory. This routine will be used after a successful
    740737/// factorization of NTL to convert the result back to Factory.
    741 /// Additionally a variable x and the computed multiplicity, as a type
     738/// Additionally a variable x and the computed content, as a type
    742739/// ZZ of NTL, is needed as parameters indicating the main variable of the
    743 /// computed canonicalform and the multiplicity of the original polynomial.
     740/// computed canonicalform and the content of the original polynomial.
    744741/// To guarantee the correct execution of the algorithm the characteristic
    745742/// has to equal zero.
    746743///
    747744/// INPUT:  A vector of polynomials over ZZ of type vec_pair_ZZX_long and
    748 ///         a variable x and a multiplicity of type ZZ
     745///         a variable x and a content of type ZZ
    749746/// OUTPUT: The converted list of polynomials of type CFFList, all
    750747///         have x as their main variable
     
    752749
    753750CFFList
    754 convertNTLvec_pair_ZZX_long2FacCFFList (const vec_pair_ZZX_long & e,const ZZ & multi,const Variable & x)
     751convertNTLvec_pair_ZZX_long2FacCFFList (const vec_pair_ZZX_long & e,const ZZ & cont,const Variable & x)
    755752{
    756753  CFFList result;
     
    770767    result.append(CFFactor(bigone,exponent));
    771768  }
    772   // the multiplicity at pos 1
    773   result.insert(CFFactor(convertZZ2CF(multi),1));
     769  // the content at pos 1
     770  result.insert(CFFactor(convertZZ2CF(cont),1));
    774771
    775772  //return the converted list
     
    810807/// of Factory. This routine will be used after a successful factorization
    811808/// of NTL to convert the result back to Factory.
    812 /// Additionally a variable x and the computed multiplicity, as a type
     809/// Additionally a variable x and the computed content, as a type
    813810/// ZZpE of NTL, is needed as parameters indicating the main variable of the
    814 /// computed canonicalform and the multiplicity of the original polynomial.
     811/// computed canonicalform and the content of the original polynomial.
    815812/// To guarantee the correct execution of the algorithm the characteristic
    816813/// has a be an arbitrary prime number p and computations have to be done
     
    818815///
    819816/// INPUT:  A vector of polynomials over ZZpE of type vec_pair_ZZ_pEX_long and
    820 ///         a variable x and a multiplicity of type ZZpE
     817///         a variable x and a content of type ZZpE
    821818/// OUTPUT: The converted list of polynomials of type CFFList, all polynomials
    822819///         have x as their main variable
     
    824821
    825822CFFList
    826 convertNTLvec_pair_ZZpEX_long2FacCFFList(const vec_pair_ZZ_pEX_long & e,const ZZ_pE & multi,const Variable & x,const Variable & alpha)
     823convertNTLvec_pair_ZZpEX_long2FacCFFList(const vec_pair_ZZ_pEX_long & e,const ZZ_pE & cont,const Variable & x,const Variable & alpha)
    827824{
    828825  CFFList result;
     
    861858    result.append(CFFactor(bigone,exponent));
    862859  }
    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));
    866862
    867863  //return the computed CFFList
     
    869865}
    870866CFFList
    871 convertNTLvec_pair_zzpEX_long2FacCFFList(const vec_pair_zz_pEX_long & e,const zz_pE & multi,const Variable & x,const Variable & alpha)
     867convertNTLvec_pair_zzpEX_long2FacCFFList(const vec_pair_zz_pEX_long & e,const zz_pE & cont,const Variable & x,const Variable & alpha)
    872868{
    873869  CFFList result;
     
    906902    result.append(CFFactor(bigone,exponent));
    907903  }
    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));
    911906
    912907  //return the computed CFFList
     
    945940/// This is a special, but optimized case of the more general conversion
    946941/// from ZZpE to canonicalform.
    947 /// Additionally a variable x and the computed multiplicity, as a type GF2E
     942/// Additionally a variable x and the computed content, as a type GF2E
    948943/// of NTL, is needed as parameters indicating the main variable of the
    949 /// computed canonicalform and the multiplicity of the original polynomial.
     944/// computed canonicalform and the content of the original polynomial.
    950945/// To guarantee the correct execution of the algorithm the characteristic
    951946/// has to equal two and computations have to be done in an extention of F_2.
    952947///
    953948/// INPUT:  A vector of polynomials over GF2E of type vec_pair_GF2EX_long and
    954 ///         a variable x and a multiplicity of type GF2E
     949///         a variable x and a content of type GF2E
    955950/// OUTPUT: The converted list of polynomials of type CFFList, all polynomials
    956951///         have x as their main variable
     
    958953
    959954CFFList 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)
    961956{
    962957  CFFList result;
     
    967962  // Maybe, e may additionally be sorted with respect to increasing degree of x, but this is not
    968963  //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 that
    971964
    972965  // Go through the vector e and build up the CFFList
     
    994987      }
    995988    }
    996 
    997989    // append the computed polynomial together with its multiplicity
    998990    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));
    1004994
    1005995  // return the computed CFFList
Note: See TracChangeset for help on using the changeset viewer.