spielwiese
Last change
on this file since a34bee4 was
a34bee4,
checked in by Martin Lee <martinlee84@…>, 9 years ago
|
chg: more changes to docu
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
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 | **/ |
---|
38 | CFMatrix* cf_HNF(CFMatrix& A) |
---|
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; |
---|
45 | return convertNTLmat_ZZ2FacCFMatrix(WW); |
---|
46 | } |
---|
47 | |
---|
48 | CFMatrix* cf_LLL(CFMatrix& A) |
---|
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 |
---|
57 | CFMatrix *r= convertNTLmat_ZZ2FacCFMatrix(*AA); |
---|
58 | delete AA; |
---|
59 | return r; |
---|
60 | } |
---|
61 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.