spielwiese
Last change
on this file since 9c0b20a was
9c0b20a,
checked in by Hans Schoenemann <hannes@…>, 13 years ago
|
LLL via system("LLL",M) for matrix (char 0)/intmat
git-svn-id: file:///usr/local/Singular/svn/trunk@13670 2c84dea3-7e68-4137-9b89-c4e89433aadc
|
-
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 | #include "NTLconvert.h" |
---|
16 | #include "canonicalform.h" |
---|
17 | #include "cf_defs.h" |
---|
18 | #include "cf_hnf.h" |
---|
19 | #include <NTL/mat_ZZ.h> |
---|
20 | #include <NTL/HNF.h> |
---|
21 | #include <NTL/LLL.h> |
---|
22 | |
---|
23 | // The input matrix A is an n x m matrix of rank m (so n >= m), and D |
---|
24 | // is a multiple of the determinant of the lattice L spanned by the |
---|
25 | // rows of A. W is computed as the Hermite Normal Form of A; that is, |
---|
26 | // W is the unique m x m matrix whose rows span L, such that |
---|
27 | // |
---|
28 | // - W is lower triangular, |
---|
29 | // - the diagonal entries are positive, |
---|
30 | // - any entry below the diagonal is a non-negative number |
---|
31 | // strictly less than the diagonal entry in its column. |
---|
32 | // |
---|
33 | // via ntl |
---|
34 | CFMatrix* cf_HNF(CFMatrix& A) |
---|
35 | { |
---|
36 | mat_ZZ *AA=convertFacCFMatrix2NTLmat_ZZ(A); |
---|
37 | ZZ DD=convertFacCF2NTLZZ(determinant(A,A.rows())); |
---|
38 | mat_ZZ WW; |
---|
39 | HNF(WW,*AA,DD); |
---|
40 | delete AA; |
---|
41 | return convertNTLmat_ZZ2FacCFMatrix(WW); |
---|
42 | } |
---|
43 | CFMatrix* cf_LLL(CFMatrix& A) |
---|
44 | { |
---|
45 | mat_ZZ *AA=convertFacCFMatrix2NTLmat_ZZ(A); |
---|
46 | LLL_RR(*AA); |
---|
47 | delete AA; |
---|
48 | CFMatrix *r= convertNTLmat_ZZ2FacCFMatrix(*AA); |
---|
49 | delete AA; |
---|
50 | return r; |
---|
51 | } |
---|
52 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.