cf_hnf.cc
Go to the documentation of this file.
1 /* emacs edit mode for this file is -*- C++ -*- */
2 
3 /**
4  *
5  * @file cf_hnf.cc
6  *
7  * HNF/LLL of NTL
8  *
9  * Header file: cf_hnf.h
10  *
11 **/
12 
13 
14 #include "config.h"
15 
16 
17 #ifdef HAVE_NTL
18 #include "NTLconvert.h"
19 #include "canonicalform.h"
20 #include "cf_defs.h"
21 #include "cf_hnf.h"
22 #include <NTL/mat_ZZ.h>
23 #include <NTL/HNF.h>
24 #include <NTL/LLL.h>
25 
26 /**
27  * The input matrix A is an n x m matrix of rank m (so n >= m), and D
28  * is a multiple of the determinant of the lattice L spanned by the
29  * rows of A. W is computed as the Hermite Normal Form of A; that is,
30  * W is the unique m x m matrix whose rows span L, such that
31  *
32  * - W is lower triangular,
33  * - the diagonal entries are positive,
34  * - any entry below the diagonal is a non-negative number
35  * strictly less than the diagonal entry in its column.
36  *
37 **/
39 {
40  mat_ZZ *AA=convertFacCFMatrix2NTLmat_ZZ(A);
41  ZZ DD=convertFacCF2NTLZZ(determinant(A,A.rows()));
42  mat_ZZ WW;
43  HNF(WW,*AA,DD);
44  delete AA;
46 }
47 
49 {
50  mat_ZZ *AA=convertFacCFMatrix2NTLmat_ZZ(A);
51  #if 0
52  LLL_RR(*AA);
53  #else
54  ZZ det2;
55  LLL(det2,*AA,0L);
56  #endif
58  delete AA;
59  return r;
60 }
61 #endif
ZZ convertFacCF2NTLZZ(const CanonicalForm &f)
NAME: convertFacCF2NTLZZX.
Definition: NTLconvert.cc:667
Conversion to and from NTL.
CFMatrix * cf_LLL(CFMatrix &A)
performs LLL reduction.
Definition: cf_hnf.cc:48
const ring r
Definition: syzextra.cc:208
#define A
Definition: sirandom.c:23
factory switches.
CFMatrix * cf_HNF(CFMatrix &A)
The input matrix A is an n x m matrix of rank m (so n >= m), and D is a multiple of the determinant o...
Definition: cf_hnf.cc:38
mat_ZZ * convertFacCFMatrix2NTLmat_ZZ(const CFMatrix &m)
Definition: NTLconvert.cc:1140
CanonicalForm determinant(const CFMatrix &M, int n)
Definition: cf_linsys.cc:222
CFMatrix * convertNTLmat_ZZ2FacCFMatrix(const mat_ZZ &m)
Definition: NTLconvert.cc:1155
Header for factory&#39;s main class CanonicalForm.