Changeset 2ce3bf in git for factory/FLINTconvert.cc
 Timestamp:
 Jul 1, 2020, 4:36:02 PM (3 years ago)
 Branches:
 (u'spielwiese', 'd0474371d8c5d8068ab70bfb42719c97936b18a6')
 Children:
 cc5a86cc299c9d4d71030662a697af14d56a1bf3
 Parents:
 c1f4d51f741e0a6c42d18ed86f6d5f207f816516
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

factory/FLINTconvert.cc
rc1f4d51 r2ce3bf 63 63 #if ( __FLINT_RELEASE >= 20503) 64 64 #include <flint/fmpq_mpoly.h> 65 66 #if (__FLINT_RELEASE < 20601) 67 // helper for fq_nmod_t > nmod_poly_t 68 static void fq_nmod_get_nmod_poly(nmod_poly_t a, const fq_nmod_t b, const fq_nmod_ctx_t ctx) 69 { 70 FLINT_ASSERT(b>mod.n == ctx>modulus>mod.n); 71 a>mod = ctx>modulus>mod; 72 nmod_poly_set(a, b); 73 } 74 75 // helper for nmod_poly_t > fq_nmod_t 76 static void fq_nmod_set_nmod_poly(fq_nmod_t a, const nmod_poly_t b, const fq_nmod_ctx_t ctx) 77 { 78 FLINT_ASSERT(a>mod.n == b>mod.n); 79 FLINT_ASSERT(a>mod.n == ctx>modulus>mod.n); 80 nmod_poly_set(a, b); 81 fq_nmod_reduce(a, ctx); 82 } 83 #endif 84 85 65 86 #endif 66 87 #ifdef __cplusplus … … 363 384 bool save_sym_ff= isOn (SW_SYMMETRIC_FF); 364 385 if (save_sym_ff) Off (SW_SYMMETRIC_FF); 386 nmod_poly_t res; 387 nmod_poly_init(res,getCharacteristic()); 365 388 for (CFIterator i= f; i.hasTerms(); i++) 366 389 { … … 376 399 { 377 400 STICKYASSERT (i.exp() <= fq_nmod_ctx_degree(ctx), "convertFacCF2Fq_nmod_t: element is not reduced"); 378 nmod_poly_set_coeff_ui (result, i.exp(), c.intval()); 379 } 380 } 401 nmod_poly_set_coeff_ui (res, i.exp(), c.intval()); 402 } 403 } 404 fq_nmod_init(result,ctx); 405 fq_nmod_set_nmod_poly(result,res,ctx); 381 406 if (save_sym_ff) On (SW_SYMMETRIC_FF); 382 407 } 383 408 384 409 CanonicalForm 385 convertFq_nmod_t2FacCF (const fq_nmod_t poly, const Variable& alpha) 386 { 387 return convertnmod_poly_t2FacCF (poly, alpha); 410 convertFq_nmod_t2FacCF (const fq_nmod_t poly, const fq_nmod_ctx_t ctx, const Variable& alpha) 411 { 412 nmod_poly_t p; 413 nmod_poly_init(p,getCharacteristic()); 414 fq_nmod_get_nmod_poly(p,poly,ctx); 415 CanonicalForm res= convertnmod_poly_t2FacCF (p, alpha); 416 nmod_poly_clear(p); 417 return res; 388 418 } 389 419 … … 476 506 if (fq_nmod_is_zero (coeff, ctx)) 477 507 continue; 478 result += convertFq_nmod_t2FacCF (coeff, alpha )*power (x, i);508 result += convertFq_nmod_t2FacCF (coeff, alpha, ctx)*power (x, i); 479 509 fq_nmod_zero (coeff, ctx); 480 510 } … … 573 603 { 574 604 (*res)(i,j)=convertFq_nmod_t2FacCF (fq_nmod_mat_entry (m, i1, j1), 575 alpha );605 alpha, fq_con); 576 606 } 577 607 }
Note: See TracChangeset
for help on using the changeset viewer.