Changeset 273a2f in git for libpolys/polys/flintconv.cc


Ignore:
Timestamp:
Dec 2, 2021, 3:56:49 PM (2 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'c5facdfddea2addfd91babd8b9019161dea4b695')
Children:
18bb792edcc6d3f65af0111f93ed61118123ffd1
Parents:
c31a71c38969321615ad9607978783ca23b0edbb
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2021-12-02 15:56:49+01:00
git-committer:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2021-12-02 15:59:38+01:00
Message:
experimental: fq_nmod_mat_rref
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/flintconv.cc

    rc31a71 r273a2f  
    1414#ifdef HAVE_FLINT
    1515#if __FLINT_RELEASE >= 20500
     16
    1617#include "coeffs/coeffs.h"
    1718#include "coeffs/longrat.h"
     
    281282}
    282283
     284void convSingPFlintnmod_poly_t(nmod_poly_t result, const poly p, const ring r)
     285{
     286  // assume univariate
     287  nmod_poly_init2 (result,rChar(r),p_Deg(p,r));
     288  poly h=p;
     289  while(h!=NULL)
     290  {
     291    nmod_poly_set_coeff_ui(result,p_GetExp(h,1,r),n_Int(pGetCoeff(h),r->cf));
     292    pIter(h);
     293  }
     294}
     295
     296void convSingMFlintFq_nmod_mat(matrix m, fq_nmod_mat_t M, const fq_nmod_ctx_t fq_con, const ring r)
     297{
     298  fq_nmod_mat_init (M, (long)MATROWS(m), (long) MATCOLS(m), fq_con);
     299  int i,j;
     300  for(i=MATROWS(m);i>0;i--)
     301  {
     302    for(j=MATCOLS(m);j>0;j--)
     303    {
     304      convSingPFlintnmod_poly_t (M->rows[i-1]+j-1, MATELEM(m,i,j),r);
     305    }
     306  }
     307}
     308
     309poly convFlintFq_nmodSingP(const fq_nmod_t Fp, const fq_nmod_ctx_t ctx, const ring r)
     310{
     311  poly p=NULL;
     312  poly h;
     313  for (int i= 0; i < nmod_poly_length (Fp); i++)
     314  {
     315    ulong coeff= nmod_poly_get_coeff_ui (Fp, i);
     316    if (coeff != 0)
     317    h=p_NSet(n_Init(coeff,r->cf),r);
     318    p_SetExp(h,1,i,r);
     319    p_Setm(h,r);
     320    p=p_Add_q(p,h,r);
     321  }
     322  return p;
     323}
     324
     325matrix convFlintFq_nmod_matSingM(fq_nmod_mat_t m, const fq_nmod_ctx_t fq_con, const ring r)
     326{
     327  matrix M=mpNew(fq_nmod_mat_nrows (m, fq_con),fq_nmod_mat_ncols (m, fq_con));
     328   int i,j;
     329  for(i=MATROWS(M);i>0;i--)
     330  {
     331    for(j=MATCOLS(M);j>0;j--)
     332    {
     333      MATELEM(M,i,j)=convFlintFq_nmodSingP(fq_nmod_mat_entry (m, i-1, j-1),
     334                                          fq_con, r);
     335    }
     336  }
     337  return M;
     338}
     339
    283340bigintmat* singflint_LLL(bigintmat*  m, bigintmat* T)
    284341{
Note: See TracChangeset for help on using the changeset viewer.