GPRidge v1.0.0
GPR-accelerated saddle point searches on potential energy surfaces
☾
Toggle main menu visibility
Loading...
Searching...
No Matches
CoordinateResolution.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
// Copyright (c) gpridge developers
3
// See LICENSE for details.
4
#pragma once
5
6
#include <Eigen/Core>
7
#include <algorithm>
8
#include <cmath>
9
#include <limits>
10
11
namespace
gpr::optim
{
12
16
template
<
class
Left,
class
Right>
17
[[nodiscard]]
bool
coordinatesCoincideAtRoundoff
(
18
const
Eigen::MatrixBase<Left>& left,
19
const
Eigen::MatrixBase<Right>& right)
noexcept
20
{
21
if
(left.rows() != right.rows() || left.cols() != right.cols() ||
22
left.size() == 0 || !left.allFinite() || !right.allFinite())
23
return
false
;
24
constexpr
double
allowance = 8.0 * std::numeric_limits<double>::epsilon();
25
for
(Eigen::Index row = 0; row < left.rows(); ++row) {
26
for
(Eigen::Index column = 0; column < left.cols(); ++column) {
27
const
double
a = left(row, column);
28
const
double
b = right(row, column);
29
const
double
scale = std::max({1.0, std::abs(a), std::abs(b)});
30
if
(std::abs(a - b) > allowance * scale)
return
false
;
31
}
32
}
33
return
true
;
34
}
35
36
}
// namespace gpr::optim
gpr::optim
Definition
ConsistentForceModel.h:13
gpr::optim::coordinatesCoincideAtRoundoff
bool coordinatesCoincideAtRoundoff(const Eigen::MatrixBase< Left > &left, const Eigen::MatrixBase< Right > &right) noexcept
Definition
CoordinateResolution.h:17
gpr
optimization
CoordinateResolution.h
Generated by
1.17.0
Generated by
Doxygen 1.17.0
Analytics by
Antics
provided by
TurtleTech ehf