Skip to content
Snippets Groups Projects
Commit fb321d96 authored by René Heß's avatar René Heß
Browse files

[skip ci] Fourth solution and asbolute fuzzy factor

parent 83255ed2
No related branches found
No related tags found
No related merge requests found
...@@ -100,7 +100,7 @@ bool isclose(T a, T b, double rel_tol=1e-9, double abs_tol=0.0){ ...@@ -100,7 +100,7 @@ bool isclose(T a, T b, double rel_tol=1e-9, double abs_tol=0.0){
} }
template<typename T> template<typename T>
bool fuzzy_is_permutation(T a, T b, double rel_tol=1e-9, double abs_tol=0.0){ bool fuzzy_is_permutation(T a, T b, double rel_tol=1e-9, double abs_tol=1e-14){
assert (a.size()==b.size()); assert (a.size()==b.size());
std::sort(a.begin(), a.end()); std::sort(a.begin(), a.end());
std::sort(b.begin(), b.end()); std::sort(b.begin(), b.end());
...@@ -255,6 +255,8 @@ int main(int argc, char** argv){ ...@@ -255,6 +255,8 @@ int main(int argc, char** argv){
std::vector<RangeType> solution_3 {-0.21436796383145873, -0.23383260730195662, -0.28383755411465533, -0.29526590985481704, -0.0045507639649666034, -0.0034803883238202818, -0.0036071199470257055, -0.0024060631441813391, 0.22702984288940109, 0.0045507639649666042, 0.27429663847448937, 0.0036071199470257059, 0.23989650875067281, 0.0034803883238202818, 0.28608104498832443, 0.0024060631441813391}; std::vector<RangeType> solution_3 {-0.21436796383145873, -0.23383260730195662, -0.28383755411465533, -0.29526590985481704, -0.0045507639649666034, -0.0034803883238202818, -0.0036071199470257055, -0.0024060631441813391, 0.22702984288940109, 0.0045507639649666042, 0.27429663847448937, 0.0036071199470257059, 0.23989650875067281, 0.0034803883238202818, 0.28608104498832443, 0.0024060631441813391};
std::vector<RangeType> solution_4 {2.3589302088734218e-17, 6.3207344446901369e-18, 6.32073444469013e-18, 1.693635690026303e-18, -0.24497506595070379, -0.29846897291910235, -0.25528824297544883, -0.30346218805770897, 0.24497506595070367, -3.8844456896567597e-17, 0.2984689729191024, -1.0408340855860846e-17, 0.25528824297544883, -1.0408340855860843e-17, 0.30346218805770903, -2.7889065268757736e-18};
std::cout.precision(17); std::cout.precision(17);
std::vector<RangeType> residual(16); std::vector<RangeType> residual(16);
for (std::size_t i=0; i<16; ++i){ for (std::size_t i=0; i<16; ++i){
...@@ -272,7 +274,13 @@ int main(int argc, char** argv){ ...@@ -272,7 +274,13 @@ int main(int argc, char** argv){
<< fuzzy_is_permutation(solution_2, residual) << std::endl; << fuzzy_is_permutation(solution_2, residual) << std::endl;
std::cout << "palpo is_permuation to solution_3: " std::cout << "palpo is_permuation to solution_3: "
<< fuzzy_is_permutation(solution_3, residual) << std::endl; << fuzzy_is_permutation(solution_3, residual) << std::endl;
if (!fuzzy_is_permutation(solution_1, residual) and !fuzzy_is_permutation(solution_2, residual) and !fuzzy_is_permutation(solution_3, residual)) std::cout << "palpo is_permuation to solution_4: "
<< fuzzy_is_permutation(solution_4, residual) << std::endl;
if (!fuzzy_is_permutation(solution_1, residual)
and !fuzzy_is_permutation(solution_2, residual)
and !fuzzy_is_permutation(solution_3, residual)
and !fuzzy_is_permutation(solution_4, residual)
)
return 1; return 1;
} }
if (initree.get<bool>("printmatrix", false)) { if (initree.get<bool>("printmatrix", false)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment