source: git/factory/cf_hnf.cc @ 895b31c

spielwiese
Last change on this file since 895b31c was 895b31c, checked in by Oleksandr Motsak <motsak@…>, 13 years ago
ADD: re-enabled _HNF/_LLL
  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[f291fcd]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
[c74d6a]12#include "config.h"
[f291fcd]13
14#ifdef HAVE_NTL
[895b31c]15#if 1
[f291fcd]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>
[9c0b20a]22#include <NTL/LLL.h>
[f291fcd]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 non-negative number
32//   strictly less than the diagonal entry in its column.
33//
34// via ntl
35CFMatrix* 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}
[9c0b20a]44CFMatrix* cf_LLL(CFMatrix& A)
45{
46  mat_ZZ *AA=convertFacCFMatrix2NTLmat_ZZ(A);
[9e7d85]47  #if 0
[9c0b20a]48  LLL_RR(*AA);
[9e7d85]49  #else
50  ZZ det2;
51  LLL(det2,*AA,0L);
52  #endif
[9c0b20a]53  CFMatrix *r= convertNTLmat_ZZ2FacCFMatrix(*AA);
54  delete AA;
55  return r;
56}
[f291fcd]57#endif
[686f46]58#endif
Note: See TracBrowser for help on using the repository browser.