Changeset 4946e3 in git


Ignore:
Timestamp:
Jul 3, 2020, 1:03:03 PM (4 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'fc741b6502fd8a97288eaa3eba6e5220f3c3df87')
Children:
175dfbe8022a34e8c7eab0e37ca15b932dbcb243
Parents:
f3adf3a165dd0f173fe615a55624a41ff34bdddb
Message:
factory: LL via FLINT
Files:
4 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
  • factory/cf_hnf.h

    rf3adf3 r4946e3  
    44
    55/*BEGINPUBLIC*/
    6 
    7 #ifdef HAVE_NTL
    86
    97/**
     
    4139 * the lattice.
    4240 *
    43  * @note: uses NTL
     41 * @note: uses NTL or FLINT
    4442**/
    4543
    4644CFMatrix* cf_LLL(CFMatrix& A);
    4745
    48 #endif
    49 
    5046/*ENDPUBLIC*/
    5147
  • factory/facAbsBiFact.cc

    rf3adf3 r4946e3  
    206206}
    207207
    208 #ifdef HAVE_NTL
     208#ifdef HAVE_NTL // henselLiftAndEarly
    209209//G is assumed to be bivariate, irreducible over Q, primitive wrt x and y, compressed
    210210CFAFList absBiFactorizeMain (const CanonicalForm& G, bool full)
     
    519519    }
    520520
     521    #ifdef HAVE_FLINT
     522    fmpz_mat_t FLINTM;
     523    convertFacCFMatrix2Fmpz_mat_t(FLINTM,*M);
     524    fmpq_t delta,eta;
     525    fmpq_init(delta); fmpq_set_si(delta,1,1);
     526    fmpq_init(eta); fmpq_set_si(eta,3,4);
     527    fmpz_mat_transpose(FLINTM,FLINTM);
     528    fmpz_mat_lll_storjohann(FLINTM,delta,eta);
     529    fmpz_mat_transpose(FLINTM,FLINTM);
     530    delete M;
     531    M=convertFmpz_mat_t2FacCFMatrix(FLINTM);
     532    fmpz_mat_clear(FLINTM);
     533    #elif defined(HAVE_NTL)
    521534    mat_ZZ * NTLM= convertFacCFMatrix2NTLmat_ZZ (*M);
    522535
     
    529542    M= convertNTLmat_ZZ2FacCFMatrix (*NTLM);
    530543    delete NTLM;
     544    #endif
    531545
    532546    mipo= 0;
  • libpolys/polys/clapsing.cc

    rf3adf3 r4946e3  
    17631763}
    17641764
    1765 #ifdef HAVE_NTL   /*define derived from factory*/
     1765#if defined(HAVE_NTL) || defined(AHVE_FLINT)
    17661766matrix singntl_HNF(matrix  m, const ring s )
    17671767{
     
    19171917  return mm;
    19181918}
    1919 
     1919#else
     1920matrix singntl_HNF(matrix  m, const ring s )
     1921{
     1922  WerrorS("NTL/FLINT missing");
     1923  return NULL;
     1924}
     1925
     1926intvec* singntl_HNF(intvec*  m)
     1927{
     1928  WerrorS("NTL/FLINT missing");
     1929  return NULL;
     1930}
     1931
     1932matrix singntl_LLL(matrix  m, const ring s )
     1933{
     1934  WerrorS("NTL/FLINT missing");
     1935  return NULL;
     1936}
     1937
     1938intvec* singntl_LLL(intvec*  m)
     1939{
     1940  WerrorS("NTL/FLINT missing");
     1941  return NULL;
     1942}
     1943#endif
     1944
     1945#ifdef HAVE_NTL
    19201946ideal singclap_absFactorize ( poly f, ideal & mipos, intvec ** exps, int & numFactors, const ring r)
    19211947{
     
    19952021
    19962022#else
    1997 matrix singntl_HNF(matrix  m, const ring s )
     2023ideal singclap_absFactorize ( poly f, ideal & mipos, intvec ** exps, int & numFactors, const ring r)
    19982024{
    19992025  WerrorS("NTL missing");
     
    20012027}
    20022028
    2003 intvec* singntl_HNF(intvec*  m)
    2004 {
    2005   WerrorS("NTL missing");
    2006   return NULL;
    2007 }
    2008 
    2009 matrix singntl_LLL(matrix  m, const ring s )
    2010 {
    2011   WerrorS("NTL missing");
    2012   return NULL;
    2013 }
    2014 
    2015 intvec* singntl_LLL(intvec*  m)
    2016 {
    2017   WerrorS("NTL missing");
    2018   return NULL;
    2019 }
    2020 
    2021 ideal singclap_absFactorize ( poly f, ideal & mipos, intvec ** exps, int & numFactors, const ring r)
    2022 {
    2023   WerrorS("NTL missing");
    2024   return NULL;
    2025 }
    2026 
    20272029#endif /* HAVE_NTL */
    20282030
Note: See TracChangeset for help on using the changeset viewer.