Changeset cb7b21 in git


Ignore:
Timestamp:
Jan 7, 2014, 5:51:07 PM (10 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
7c43417b3c0a11646757be1dbd5877c7b19d0459
Parents:
49ba0963eace9d5fafa517dc5e9b39eb0ed0a096
git-author:
Martin Lee <martinlee84@web.de>2014-01-07 17:51:07+01:00
git-committer:
Martin Lee <martinlee84@web.de>2014-01-20 16:45:04+01:00
Message:
chg: new function to get coeffs over extension with FLINT
Location:
factory
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • factory/facFqBivarUtil.cc

    r49ba09 rcb7b21  
    3131#include "facHensel.h"
    3232#include "facMul.h"
     33
     34#ifdef HAVE_FLINT
     35#include "FLINTconvert.h"
     36#endif
    3337
    3438TIMING_DEFINE_PRINT(fac_log_deriv_div)
     
    698702#endif
    699703
     704#ifdef HAVE_FLINT
     705CFArray
     706getCoeffs (const CanonicalForm& G, const int k, const int l, const int degMipo,
     707           const Variable& alpha, const CanonicalForm& evaluation,
     708           const nmod_mat_t M)
     709{
     710  ASSERT (G.isUnivariate() || G.inCoeffDomain(), "univariate input expected");
     711  CanonicalForm F= G (G.mvar() - evaluation, G.mvar());
     712  if (F.isZero())
     713    return CFArray ();
     714
     715  Variable y= Variable (2);
     716  F= F (power (y, degMipo), y);
     717  F= F (y, alpha);
     718
     719  nmod_poly_t FLINTF;
     720  nmod_mat_t MFLINTF, mulResult;
     721  nmod_mat_init (MFLINTF, l*degMipo, 1, getCharacteristic());
     722  nmod_mat_init (mulResult, l*degMipo, 1, getCharacteristic());
     723
     724  convertFacCF2nmod_poly_t (FLINTF, F);
     725
     726  slong i;
     727
     728  for (i= 0; i < FLINTF->length; i++)
     729    nmod_mat_entry (MFLINTF, i, 0)= FLINTF->coeffs[i];
     730
     731  for (; i < MFLINTF->r; i++)
     732    nmod_mat_entry (MFLINTF, i, 0)= UWORD(0);
     733
     734  nmod_mat_mul (mulResult, M, MFLINTF);
     735
     736  F= 0;
     737  for (i= 0; i < mulResult->r; i++)
     738    F += CanonicalForm ((long) nmod_mat_entry (mulResult, i, 0))*power (y, i);
     739
     740  nmod_mat_clear (MFLINTF);
     741  nmod_mat_clear (mulResult);
     742
     743  if (degree (F, 2) < k)
     744    return CFArray();
     745
     746  CFArray result= CFArray (degree (F) - k + 1);
     747
     748  CFIterator j= F;
     749  for (int i= degree (F); i >= k; i--)
     750  {
     751    if (j.exp() == i)
     752    {
     753      result [i - k]= j.coeff();
     754      j++;
     755      if (!j.hasTerms())
     756        return result;
     757    }
     758    else
     759      result[i - k]= 0;
     760  }
     761  return result;
     762}
     763#endif
     764
    700765int * computeBounds (const CanonicalForm& F, int& n, bool& isIrreducible)
    701766{
  • factory/facFqBivarUtil.h

    r49ba09 rcb7b21  
    2121#ifdef HAVE_NTL
    2222#include "NTLconvert.h"
     23#endif
     24
     25#ifdef HAVE_FLINT
     26#include "FLINTconvert.h"
    2327#endif
    2428
     
    269273#endif
    270274
     275#ifdef HAVE_FLINT
     276/// extract coefficients of \f$ x^i \f$ for \f$i\geq k\f$ where \f$ x \f$ is
     277/// a variable of level 1
     278///
     279/// @return coefficients of \f$ x^i \f$ for \f$i\geq k\f$
     280/// @sa {getCoeffs (const CanonicalForm&, const int, const Variable& alpha),
     281/// getCoeffs (const CanonicalForm&, const int)}
     282CFArray
     283getCoeffs (const CanonicalForm& F,         ///< [in] compressed bivariate poly
     284           const int k,                    ///< [in] some int
     285           const int l,                    ///< [in] precision
     286           const int degMipo,              ///< [in] degree of minimal poly
     287           const Variable& alpha,          ///< [in] algebraic variable
     288           const CanonicalForm& evaluation,///< [in] evaluation point
     289           const nmod_mat_t M              ///< [in] bases change matrix
     290          );
     291#endif
     292
    271293/// write A into M starting at row startIndex
    272294void
Note: See TracChangeset for help on using the changeset viewer.