Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
DiophantineSolver.h
Go to the documentation of this file.
1/* This file is part of MoDELib, the Mechanics Of Defects Evolution 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_DiophantineSolver_h_
9#define model_DiophantineSolver_h_
10
11#include <Eigen/Dense>
12// #include <LatticeGCD.h>
13namespace model
14{
16 {
17 public:
18 // Finds such x and y, that a x + b y = gcd(a, b)
19 // https://github.com/ADJA/algos/blob/master/NumberTheory/DiophantineEquation.cpp
20 static long int extended_gcd(long int a, long int b, long int &x, long int &y);
21
22 // Solves equation a x + b y = c, writes answer to x and y
23 static void solveDiophantine2vars(long int a, long int b, long int c, long int &x, long int &y);
24 // http://mathafou.free.fr/exe_en/exedioph3.html
25 // https://math.stackexchange.com/questions/514105/how-do-i-solve-a-linear-diophantine-equation-with-three-unknowns
26 static void solveDiophantine3vars(const Eigen::Matrix<long int, 3, 1> &alphas, const long int t1,
27 Eigen::Matrix<long int, 3, 1> &sols);
28 };
29} // namespace model
30
31#endif
static void solveDiophantine2vars(long int a, long int b, long int c, long int &x, long int &y)
static void solveDiophantine3vars(const Eigen::Matrix< long int, 3, 1 > &alphas, const long int t1, Eigen::Matrix< long int, 3, 1 > &sols)
static long int extended_gcd(long int a, long int b, long int &x, long int &y)
c
Definition int_R.m:15
a
Definition int_R.m:14
b
Definition int_R.m:16
x
Definition int_R.m:12
INEXACT REAL t1