From fb3ed9ce0c011b548a0d6a659d39460f1513c3ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Coppens?= Date: Mon, 19 Apr 2021 08:28:19 +0200 Subject: [PATCH] In Maponi A3, converted divisions into multiplications. --- src/SM_MaponiA3.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/SM_MaponiA3.cpp b/src/SM_MaponiA3.cpp index 8d62e42..71e1bf2 100644 --- a/src/SM_MaponiA3.cpp +++ b/src/SM_MaponiA3.cpp @@ -79,6 +79,7 @@ void MaponiA3(double *Slater_inv, unsigned int Dim, unsigned int N_updates, if (fabs(beta) < threshold()) { std::cerr << "Break-down occured." << std::endl; } + double ibeta = 1.0 / beta; // Compute intermediate update to Slater_inv #ifdef DEBUG @@ -93,7 +94,7 @@ void MaponiA3(double *Slater_inv, unsigned int Dim, unsigned int N_updates, for (i = 0; i < Dim; i++) { for (j = 0; j < Dim; j++) { Al[i * Dim + j] = - (i == j) - (j == component - 1) * ylk[l][p[l + 1]][i + 1] / beta; + (i == j) - (j == component - 1) * ylk[l][p[l + 1]][i + 1] * ibeta; } } matMul(Al, last, next, Dim); @@ -106,7 +107,7 @@ void MaponiA3(double *Slater_inv, unsigned int Dim, unsigned int N_updates, // For given l != 0 compute the next {y_{l,k}} for (k = l + 2; k < N_updates + 1; k++) { - alpha = ylk[l][p[k]][component] / beta; + alpha = ylk[l][p[k]][component] * ibeta; #ifdef DEBUG std::cout << "Inside k-loop: k = " << k << std::endl; std::cout << "ylk[" << l + 1 << "][" << p[k] << "][:]" << std::endl;