All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
LatticeReduction.h
Go to the documentation of this file.
1 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2  Copyright (c) 2013 The plumed team
3  (see the PEOPLE file at the root of the distribution for a list of names)
4 
5  See http://www.plumed-code.org for more information.
6 
7  This file is part of plumed, version 2.0.
8 
9  plumed is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  plumed is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with plumed. If not, see <http://www.gnu.org/licenses/>.
21 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
22 #ifndef __PLUMED_tools_LatticeReduction_h
23 #define __PLUMED_tools_LatticeReduction_h
24 
25 #include "Vector.h"
26 #include "Tensor.h"
27 
28 namespace PLMD{
29 
30 /**
31 Class implementing algorithms for lattice reduction.
32 
33 This class implements algorithms described in
34 Igor Semaev, A 3-Dimensional Lattice Reduction Algorithm, CaLC 2001, LNCS 2146, pp. 181–193, 2001.
35 It just collect static methods in a separate namespace.
36 */
38 /// Gaussian reduction
39  static void reduce(Vector&a,Vector&b);
40 /// Obtain three reduce-2 vectors (Algorithm 1 in the paper), equivalent to reduce2(Tensor&t)
41  static void reduce2(Vector&a,Vector&b,Vector&c);
42 /// Check if two vectors are reduced
43  static bool isReduced(const Vector&a,const Vector&b);
44 /// Check if three vectors are reduced
45  static bool isReduced(const Vector&a,const Vector&b,const Vector &c);
46 /// Check if three vectors are reduced-2
47  static bool isReduced2(const Vector&a,const Vector&b,const Vector &c);
48 /// Obtain three reduce-2 vectors (Algorithm 1 in the paper), equivalent to reduce2(Vector&a,Vector&b,Vector&c)
49  static void reduce2(Tensor&t);
50 /// Sort three vectors by modulo
51  static void sort(Vector v[3]);
52 public:
53 /// Reduce a basis in place, maps to reduceFast()
54  static void reduce(Tensor&t);
55 /// Reduce a basis in place using the slow algorithm (Algorithm 2 in the paper)
56  static void reduceSlow(Tensor&t);
57 /// Reduce a basis in place using the fast algorithm (Algorithm 3 in the paper)
58  static void reduceFast(Tensor&t);
59 /// Check if a basis is reduced
60  static bool isReduced(const Tensor&t);
61 };
62 
63 }
64 
65 #endif
66 
static void sort(Vector v[3])
Sort three vectors by modulo.
Class implementing fixed size matrices of doubles.
Definition: Tensor.h:70
Class implementing fixed size vectors of doubles.
Definition: Vector.h:74
static bool isReduced(const Vector &a, const Vector &b)
Check if two vectors are reduced.
static void reduceFast(Tensor &t)
Reduce a basis in place using the fast algorithm (Algorithm 3 in the paper)
static bool isReduced2(const Vector &a, const Vector &b, const Vector &c)
Check if three vectors are reduced-2.
Class implementing algorithms for lattice reduction.
static void reduce2(Vector &a, Vector &b, Vector &c)
Obtain three reduce-2 vectors (Algorithm 1 in the paper), equivalent to reduce2(Tensor&t) ...
static void reduce(Vector &a, Vector &b)
Gaussian reduction.
void const char const char int double * a
Definition: Matrix.h:42
static void reduceSlow(Tensor &t)
Reduce a basis in place using the slow algorithm (Algorithm 2 in the paper)