source: git/factory/cf_hnf.cc @ f291fcd

spielwiese
Last change on this file since f291fcd was f291fcd, checked in by Hans Schoenemann <hannes@…>, 13 years ago
cf_HNF: Hermite Normalform git-svn-id: file:///usr/local/Singular/svn/trunk@13113 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1015 bytes
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
22// The input matrix A is an n x m matrix of rank m (so n >= m), and D
23// is a multiple of the determinant of the lattice L spanned by the
24// rows of A.  W is computed as the Hermite Normal Form of A; that is,
25// W is the unique m x m matrix whose rows span L, such that
26//
27// - W is lower triangular,
28// - the diagonal entries are positive,
29// - any entry below the diagonal is a non-negative number
30//   strictly less than the diagonal entry in its column.
31//
32// via ntl
33CFMatrix* cf_HNF(CFMatrix& A)
34{
35  mat_ZZ *AA=convertFacCFMatrix2NTLmat_ZZ(A);
36  ZZ DD=convertFacCF2NTLZZ(determinant(A,A.rows()));
37  mat_ZZ WW;
38  HNF(WW,*AA,DD);
39  delete AA;
40  return convertNTLmat_ZZ2FacCFMatrix(WW);
41}
42#endif
Note: See TracBrowser for help on using the repository browser.