MCPcopy Create free account
hub / github.com/Singular/Singular / findMinPoly

Function findMinPoly

factory/cf_map_ext.cc:640–690  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

638
639#if defined(HAVE_NTL) || defined(HAVE_FLINT)
640CanonicalForm
641findMinPoly (const CanonicalForm& F, const Variable& alpha)
642{
643 ASSERT (F.isUnivariate() && F.mvar()==alpha,"expected element of F_p(alpha)");
644
645 int p=getCharacteristic();
646 #if defined(HAVE_FLINT) && (__FLINT_RELEASE >= 20503)
647 nmod_poly_t FLINT_F,FLINT_alpha,g;
648 nmod_poly_init(g,p);
649 convertFacCF2nmod_poly_t(FLINT_F,F);
650 convertFacCF2nmod_poly_t(FLINT_alpha,getMipo(alpha));
651 minpoly(g,FLINT_F,FLINT_alpha);
652 nmod_poly_clear(FLINT_alpha);
653 nmod_poly_clear(FLINT_F);
654 CanonicalForm res=convertnmod_poly_t2FacCF(g,Variable(1));
655 nmod_poly_clear(g);
656 return res;
657 #elif defined(HAVE_NTL)
658 if (fac_NTL_char != p)
659 {
660 fac_NTL_char= p;
661 zz_p::init (p);
662 }
663 zz_pX NTLF= convertFacCF2NTLzzpX (F);
664 int d= degree (getMipo (alpha));
665
666 zz_pX NTLMipo= convertFacCF2NTLzzpX (getMipo(alpha));
667 zz_pE::init (NTLMipo);
668 vec_zz_p pows;
669 pows.SetLength (2*d);
670
671 zz_pE powNTLF;
672 set (powNTLF);
673 zz_pE NTLFE= to_zz_pE (NTLF);
674 zz_pX buf;
675 for (int i= 0; i < 2*d; i++)
676 {
677 buf= rep (powNTLF);
678 buf.rep.SetLength (d);
679 pows [i]= buf.rep[0];
680 powNTLF *= NTLFE;
681 }
682
683 zz_pX NTLMinPoly;
684 MinPolySeq (NTLMinPoly, pows, d);
685
686 return convertNTLzzpX2CF (NTLMinPoly, Variable (1));
687 #else
688 factoryError("NTL/FLINT missing: findMinPoly");
689 #endif
690}
691#endif

Callers 2

init4extFunction · 0.85
mapPrimElemFunction · 0.85

Calls 14

getCharacteristicFunction · 0.85
convertFacCF2nmod_poly_tFunction · 0.85
getMipoFunction · 0.85
minpolyFunction · 0.85
convertnmod_poly_t2FacCFFunction · 0.85
VariableFunction · 0.85
initFunction · 0.85
convertFacCF2NTLzzpXFunction · 0.85
degreeFunction · 0.85
repClass · 0.85
convertNTLzzpX2CFFunction · 0.85
mvarMethod · 0.80

Tested by

no test coverage detected