Changeset 4946e3 in git for factory/cf_hnf.cc


Ignore:
Timestamp:
Jul 3, 2020, 1:03:03 PM (3 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
175dfbe8022a34e8c7eab0e37ca15b932dbcb243
Parents:
f3adf3a165dd0f173fe615a55624a41ff34bdddb
Message:
factory: LL via FLINT
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/cf_hnf.cc

    rf3adf3 r4946e3  
    1414#include "config.h"
    1515
     16#include "canonicalform.h"
     17#include "cf_defs.h"
     18#include "cf_hnf.h"
    1619
    1720#ifdef HAVE_NTL
    1821#include "NTLconvert.h"
    19 #include "canonicalform.h"
    20 #include "cf_defs.h"
    21 #include "cf_hnf.h"
    2222#include <NTL/mat_ZZ.h>
    2323#include <NTL/HNF.h>
    2424#include <NTL/LLL.h>
     25#endif
     26
     27#ifdef HAVE_FLINT
     28#include "FLINTconvert.h"
     29#endif
    2530
    2631/**
     
    3843CFMatrix* cf_HNF(CFMatrix& A)
    3944{
     45#ifdef HAVE_FLINT
     46  fmpz_mat_t FLINTM;
     47  convertFacCFMatrix2Fmpz_mat_t(FLINTM,A);
     48  fmpz_mat_hnf(FLINTM,FLINTM);
     49  CFMatrix *r=convertFmpz_mat_t2FacCFMatrix(FLINTM);
     50  fmpz_mat_clear(FLINTM);
     51  return r;
     52#elif defined(HAVE_NTL)
    4053  mat_ZZ *AA=convertFacCFMatrix2NTLmat_ZZ(A);
    4154  ZZ DD=convertFacCF2NTLZZ(determinant(A,A.rows()));
     
    4457  delete AA;
    4558  return convertNTLmat_ZZ2FacCFMatrix(WW);
     59#endif
    4660}
    4761
    4862CFMatrix* cf_LLL(CFMatrix& A)
    4963{
     64#ifdef HAVE_FLINT
     65  fmpz_mat_t FLINTM;
     66  convertFacCFMatrix2Fmpz_mat_t(FLINTM,A);
     67  fmpq_t delta,eta;
     68  fmpq_init(delta); fmpq_set_si(delta,1,1);
     69  fmpq_init(eta); fmpq_set_si(eta,3,4);
     70  fmpz_mat_lll_storjohann(FLINTM,delta,eta);
     71  CFMatrix *r=convertFmpz_mat_t2FacCFMatrix(FLINTM);
     72  fmpz_mat_clear(FLINTM);
     73  return r;
     74#elif defined(HAVE_NTL)
    5075  mat_ZZ *AA=convertFacCFMatrix2NTLmat_ZZ(A);
    51   #if 0
    52   LLL_RR(*AA);
    53   #else
    5476  ZZ det2;
    5577  LLL(det2,*AA,0L);
    56   #endif
    5778  CFMatrix *r= convertNTLmat_ZZ2FacCFMatrix(*AA);
    5879  delete AA;
    5980  return r;
     81#endif
    6082}
    61 #endif
Note: See TracChangeset for help on using the changeset viewer.