mirror of
https://github.com/TREX-CoE/Sherman-Morrison.git
synced 2024-08-25 14:41:45 +02:00
Replaced inappropriate std::abs() occurences with std::fabs() in C++ code.
This commit is contained in:
parent
5693e177ba
commit
0e5bbbbffb
@ -119,9 +119,9 @@ template <typename T> T matDet(T **A, unsigned int M) {
|
|||||||
template <typename T> bool is_identity(T *A, unsigned int M, double tolerance) {
|
template <typename T> bool is_identity(T *A, unsigned int M, double tolerance) {
|
||||||
for (unsigned int i = 0; i < M; i++) {
|
for (unsigned int i = 0; i < M; i++) {
|
||||||
for (unsigned int j = 0; j < M; j++) {
|
for (unsigned int j = 0; j < M; j++) {
|
||||||
if (i == j && fabs(A[i * M + j] - 1) > tolerance)
|
if (i == j && std::fabs(A[i * M + j] - 1) > tolerance)
|
||||||
return false;
|
return false;
|
||||||
if (i != j && fabs(A[i * M + j]) > tolerance)
|
if (i != j && std::fabs(A[i * M + j]) > tolerance)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ template <typename T> T norm_max(T *A, unsigned int Dim) {
|
|||||||
for (unsigned int i = 0; i < Dim; i++) {
|
for (unsigned int i = 0; i < Dim; i++) {
|
||||||
for (unsigned int j = 0; j < Dim; j++) {
|
for (unsigned int j = 0; j < Dim; j++) {
|
||||||
T delta = A[i * Dim + j];
|
T delta = A[i * Dim + j];
|
||||||
delta = fabs(delta);
|
delta = std::fabs(delta);
|
||||||
if (delta > res) {
|
if (delta > res) {
|
||||||
res = delta;
|
res = delta;
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ template <typename T> T residual_max(T *A, unsigned int Dim) {
|
|||||||
for (unsigned int i = 0; i < Dim; i++) {
|
for (unsigned int i = 0; i < Dim; i++) {
|
||||||
for (unsigned int j = 0; j < Dim; j++) {
|
for (unsigned int j = 0; j < Dim; j++) {
|
||||||
T delta = A[i * Dim + j] - (i == j);
|
T delta = A[i * Dim + j] - (i == j);
|
||||||
delta = fabs(delta);
|
delta = std::fabs(delta);
|
||||||
if (delta > res) {
|
if (delta > res) {
|
||||||
res = delta;
|
res = delta;
|
||||||
}
|
}
|
||||||
|
@ -25,10 +25,10 @@ void selectLargestDenominator(unsigned int l, unsigned int N_updates,
|
|||||||
for (unsigned int j = lbar; j < N_updates + 1; j++) {
|
for (unsigned int j = lbar; j < N_updates + 1; j++) {
|
||||||
index = p[j];
|
index = p[j];
|
||||||
component = Updates_index[index - 1];
|
component = Updates_index[index - 1];
|
||||||
breakdown = abs(1 + ylk[l][index][component]);
|
breakdown = std::fabs(1 + ylk[l][index][component]);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cout << "Inside selectLargestDenominator()" << std::endl;
|
std::cout << "Inside selectLargestDenominator()" << std::endl;
|
||||||
std::cout << "breakdown = abs(1 + ylk[" << l << "][" << index << "]["
|
std::cout << "breakdown = fabs(1 + ylk[" << l << "][" << index << "]["
|
||||||
<< component << "]) = " << breakdown << std::endl;
|
<< component << "]) = " << breakdown << std::endl;
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
@ -76,7 +76,7 @@ void MaponiA3(double *Slater_inv, unsigned int Dim, unsigned int N_updates,
|
|||||||
<< "] = " << beta << std::endl;
|
<< "] = " << beta << std::endl;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (fabs(beta) < threshold()) {
|
if (std::fabs(beta) < threshold()) {
|
||||||
std::cerr << "Breakdown condition triggered at " << Updates_index[l]
|
std::cerr << "Breakdown condition triggered at " << Updates_index[l]
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
@ -208,7 +208,7 @@ void MaponiA3S(double *Slater_inv, unsigned int Dim, unsigned int N_updates,
|
|||||||
<< "] = " << beta << std::endl;
|
<< "] = " << beta << std::endl;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (fabs(beta) < threshold()) {
|
if (std::fabs(beta) < threshold()) {
|
||||||
std::cerr << "Breakdown condition triggered at " << Updates_index[l]
|
std::cerr << "Breakdown condition triggered at " << Updates_index[l]
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
for (unsigned int i = 1; i < Dim + 1; i++) {
|
for (unsigned int i = 1; i < Dim + 1; i++) {
|
||||||
|
@ -23,7 +23,7 @@ void SM1(double *Slater_inv, unsigned int Dim, unsigned int N_updates,
|
|||||||
|
|
||||||
// Denominator
|
// Denominator
|
||||||
double den = 1 + C[Updates_index[l] - 1];
|
double den = 1 + C[Updates_index[l] - 1];
|
||||||
if (fabs(den) < threshold()) {
|
if (std::fabs(den) < threshold()) {
|
||||||
std::cerr << "Breakdown condition triggered at " << Updates_index[l]
|
std::cerr << "Breakdown condition triggered at " << Updates_index[l]
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ void SM2(double *Slater_inv, unsigned int Dim, unsigned int N_updates,
|
|||||||
|
|
||||||
// Denominator
|
// Denominator
|
||||||
double den = 1 + C[Updates_index[l] - 1];
|
double den = 1 + C[Updates_index[l] - 1];
|
||||||
if (fabs(den) < threshold()) {
|
if (std::fabs(den) < threshold()) {
|
||||||
std::cerr << "Breakdown condition triggered at " << Updates_index[l]
|
std::cerr << "Breakdown condition triggered at " << Updates_index[l]
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ void SM3(double *Slater_inv, unsigned int Dim, unsigned int N_updates,
|
|||||||
|
|
||||||
// Denominator
|
// Denominator
|
||||||
double den = 1 + C[Updates_index[l] - 1];
|
double den = 1 + C[Updates_index[l] - 1];
|
||||||
if (fabs(den) < threshold()) {
|
if (std::fabs(den) < threshold()) {
|
||||||
std::cerr << "Breakdown condition triggered at " << Updates_index[l]
|
std::cerr << "Breakdown condition triggered at " << Updates_index[l]
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ void SM4(double *Slater_inv, unsigned int Dim, unsigned int N_updates,
|
|||||||
|
|
||||||
// Denominator
|
// Denominator
|
||||||
double den = 1 + C[Updates_index[l] - 1];
|
double den = 1 + C[Updates_index[l] - 1];
|
||||||
if (fabs(den) < threshold()) {
|
if (std::fabs(den) < threshold()) {
|
||||||
std::cerr << "Breakdown condition triggered at " << Updates_index[l]
|
std::cerr << "Breakdown condition triggered at " << Updates_index[l]
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user