Sherman-Morrison/src/SMWB.cpp
2021-06-10 08:46:40 +02:00

25 lines
902 B
C++

#include "SMWB.hpp"
#include "SM_Standard.hpp"
#include "Woodbury.hpp"
#include "Helpers.hpp"
// Sherman-Morrison-Woodbury kernel 1
// WB2, WB3, SM2 mixing scheme 1
void SMWB1(double *Slater_inv, unsigned int Dim, unsigned int N_updates, double *Updates, unsigned int *Updates_index) {
std::cerr << "Called Sherman-Morrison-Woodbury kernel 1 with " << N_updates << " updates" << std::endl;
bool ok;
ok = WB2(Slater_inv, Dim, Updates, Updates_index);
if (!ok) {
std::cerr << "Woodbury kernel failed!" << std::endl;
SM2(Slater_inv, Dim, N_updates, Updates, Updates_index);
}
}
extern "C" {
void SMWB1_f(double **linSlater_inv, unsigned int *Dim, unsigned int *N_updates,
double **linUpdates, unsigned int **Updates_index) {
SMWB1(*linSlater_inv, *Dim, *N_updates, *linUpdates, *Updates_index);
}
}