Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
LatticeGCD.cpp
Go to the documentation of this file.
1/* This file is part of PIL, the Particle Interaction Library.
2 *
3 *
4 * MODEL is distributed without any warranty under the
5 * GNU General Public License (GPL) v2 <http://www.gnu.org/licenses/>.
6 */
7
8#ifndef model_LatticeGCD_cpp_
9#define model_LatticeGCD_cpp_
10
11#include <LatticeGCD.h>
12#include <Eigen/Dense>
13
14namespace model
15{
16
17 template <int dim>
18 long int LatticeGCD<dim>::gcd(const long int &a, const long int &b)
19 {
20 const long int absA(abs(a));
21 const long int absB(abs(b));
22 return absB > 0 ? gcd(absB, absA % absB) : (absA > 0 ? absA : 1);
23 }
24
25 template <int dim>
26 long int LatticeGCD<dim>::gcd(const long int &a, const long int &b, const long int &c)
27 {
28 return gcd(a, gcd(b, c));
29 }
30
31 template <int dim>
33 {
34 return gcd(v(0), v(1), v(2));
35 }
36
37 template struct LatticeGCD<3>;
38} // end namespace
39#endif
c
Definition int_R.m:15
a
Definition int_R.m:14
b
Definition int_R.m:16
static long int gcd(const long int &a, const long int &b)
Eigen::Matrix< long int, dim, 1 > VectorDimI
Definition LatticeGCD.h:19
REAL v[4]