jengelhdatetimespielwiese
Last change
on this file since 895b31c was
895b31c,
checked in by Oleksandr Motsak <motsak@…>, 11 years ago

ADD: reenabled _HNF/_LLL


Property mode set to
100644

File size:
1.2 KB

Line  

1  /* emacs edit mode for this file is * C++ * */ 

2  /* $Id$ */ 

3  

4  //{{{ docu 

5  // 

6  // cf_hnf.cc  HNF of NTL 

7  // 

8  // Header file: cf_hnf.h 

9  // 

10  //}}} 

11  

12  #include "config.h" 

13  

14  #ifdef HAVE_NTL 

15  #if 1 

16  #include "NTLconvert.h" 

17  #include "canonicalform.h" 

18  #include "cf_defs.h" 

19  #include "cf_hnf.h" 

20  #include <NTL/mat_ZZ.h> 

21  #include <NTL/HNF.h> 

22  #include <NTL/LLL.h> 

23  

24  // The input matrix A is an n x m matrix of rank m (so n >= m), and D 

25  // is a multiple of the determinant of the lattice L spanned by the 

26  // rows of A. W is computed as the Hermite Normal Form of A; that is, 

27  // W is the unique m x m matrix whose rows span L, such that 

28  // 

29  //  W is lower triangular, 

30  //  the diagonal entries are positive, 

31  //  any entry below the diagonal is a nonnegative number 

32  // strictly less than the diagonal entry in its column. 

33  // 

34  // via ntl 

35  CFMatrix* cf_HNF(CFMatrix& A) 

36  { 

37  mat_ZZ *AA=convertFacCFMatrix2NTLmat_ZZ(A); 

38  ZZ DD=convertFacCF2NTLZZ(determinant(A,A.rows())); 

39  mat_ZZ WW; 

40  HNF(WW,*AA,DD); 

41  delete AA; 

42  return convertNTLmat_ZZ2FacCFMatrix(WW); 

43  } 

44  CFMatrix* cf_LLL(CFMatrix& A) 

45  { 

46  mat_ZZ *AA=convertFacCFMatrix2NTLmat_ZZ(A); 

47  #if 0 

48  LLL_RR(*AA); 

49  #else 

50  ZZ det2; 

51  LLL(det2,*AA,0L); 

52  #endif 

53  CFMatrix *r= convertNTLmat_ZZ2FacCFMatrix(*AA); 

54  delete AA; 

55  return r; 

56  } 

57  #endif 

58  #endif 

Note: See
TracBrowser
for help on using the repository browser.