Changeset e64ec88 in git for factory/cfModGcd.cc


Ignore:
Timestamp:
Jun 30, 2020, 1:06:38 PM (3 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
f542551517fde5e0e330f2a5f4ae6e3fdfd32454
Parents:
c13ebdc9277f3b41f188d330d716d537518c250d
Message:
factory: gauss via FLINT
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/cfModGcd.cc

    rc13ebd re64ec88  
    17831783}
    17841784
    1785 #ifdef HAVE_NTL //gauss, zz_pE
    17861785long
    17871786gaussianElimFq (CFMatrix& M, CFArray& L, const Variable& alpha)
     
    17991798    (*N) (j, M.columns() + 1)= L[i];
    18001799  int p= getCharacteristic ();
     1800  #ifdef HAVE_FLINT
     1801  // convert mipo
     1802  nmod_poly_t mipo1;
     1803  convertFacCF2nmod_poly_t(mipo1,getMipo(alpha));
     1804  fq_nmod_ctx_t ctx;
     1805  fq_nmod_ctx_init_modulus(ctx,mipo1,"t");
     1806  nmod_poly_clear(mipo1);
     1807  // convert matrix
     1808  fq_nmod_mat_t FLINTN;
     1809  convertFacCFMatrix2Fq_nmod_mat_t (FLINTN, ctx, *N);
     1810  // rank
     1811  long rk= fq_nmod_mat_rref (FLINTN,ctx);
     1812  // clean up
     1813  fq_nmod_mat_clear (FLINTN,ctx);
     1814  fq_nmod_ctx_clear(ctx);
     1815  #elif defined(HAVE_NTL)
    18011816  if (fac_NTL_char != p)
    18021817  {
     
    18081823  mat_zz_pE *NTLN= convertFacCFMatrix2NTLmat_zz_pE(*N);
    18091824  long rk= gauss (*NTLN);
    1810 
     1825  N= convertNTLmat_zz_pE2FacCFMatrix (*NTLN, alpha);
     1826  delete NTLN;
     1827  #endif
    18111828  delete N;
    1812   N= convertNTLmat_zz_pE2FacCFMatrix (*NTLN, alpha);
    1813 
    1814   delete NTLN;
    18151829
    18161830  M= (*N) (1, M.rows(), 1, M.columns());
     
    18221836  return rk;
    18231837}
    1824 #endif
    18251838
    18261839CFArray
     
    18761889}
    18771890
    1878 #ifdef HAVE_NTL //gauss, zz_pE
    18791891CFArray
    18801892solveSystemFq (const CFMatrix& M, const CFArray& L, const Variable& alpha)
     
    18911903    (*N) (j, M.columns() + 1)= L[i];
    18921904  int p= getCharacteristic ();
     1905  #ifdef HAVE_FLINT
     1906  // convert mipo
     1907  nmod_poly_t mipo1;
     1908  convertFacCF2nmod_poly_t(mipo1,getMipo(alpha));
     1909  fq_nmod_ctx_t ctx;
     1910  fq_nmod_ctx_init_modulus(ctx,mipo1,"t");
     1911  nmod_poly_clear(mipo1);
     1912  // convert matrix
     1913  fq_nmod_mat_t FLINTN;
     1914  convertFacCFMatrix2Fq_nmod_mat_t (FLINTN, ctx, *N);
     1915  // rank
     1916  long rk= fq_nmod_mat_rref (FLINTN,ctx);
     1917  #elif defined(HAVE_NTL)
    18931918  if (fac_NTL_char != p)
    18941919  {
     
    19001925  mat_zz_pE *NTLN= convertFacCFMatrix2NTLmat_zz_pE(*N);
    19011926  long rk= gauss (*NTLN);
     1927  #endif
    19021928
    19031929  delete N;
    19041930  if (rk != M.columns())
    19051931  {
     1932    #if defined(HAVE_NTL) && !defined(HAVE_FLINT)
    19061933    delete NTLN;
     1934    #endif
    19071935    return CFArray();
    19081936  }
     1937  #ifdef HAVE_FLINT
     1938  // convert and clean up
     1939  N=convertFq_nmod_mat_t2FacCFMatrix(FLINTN,ctx,alpha);
     1940  fq_nmod_mat_clear (FLINTN,ctx);
     1941  fq_nmod_ctx_clear(ctx);
     1942  #elif defined(HAVE_NTL)
    19091943  N= convertNTLmat_zz_pE2FacCFMatrix (*NTLN, alpha);
    1910 
    19111944  delete NTLN;
     1945  #endif
    19121946
    19131947  CFArray A= readOffSolution (*N, rk);
     
    19161950  return A;
    19171951}
    1918 #endif
    19191952#endif
    19201953
     
    42224255  }
    42234256}
    4224 
    4225 
    42264257#endif
Note: See TracChangeset for help on using the changeset viewer.