mirror of
https://github.com/TREX-CoE/Sherman-Morrison.git
synced 2025-01-12 22:18:36 +01:00
Cosmetics
This commit is contained in:
parent
43b996dad9
commit
4f0aaa5763
@ -60,9 +60,9 @@ int test_cycle(H5File file, int cycle, std::string version, double tolerance) {
|
||||
double *u = new double[nupdates * dim];
|
||||
|
||||
/* Test */
|
||||
#ifdef DEBUG2
|
||||
#ifdef DEBUG2
|
||||
showMatrix(slater_inverse, dim, "OLD Inverse");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Transform replacement updates in 'updates[]' into additive updates in 'u[]'
|
||||
for (j = 0; j < nupdates; j++) {
|
||||
@ -74,18 +74,15 @@ int test_cycle(H5File file, int cycle, std::string version, double tolerance) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG2
|
||||
#ifdef DEBUG2
|
||||
showMatrix(slater_matrix, dim, "OLD Slater");
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG2
|
||||
showMatrix(u, dim, "Updates");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef PERF
|
||||
#ifdef PERF
|
||||
#ifdef DEBUG1
|
||||
std::cerr << "# of reps. = " << repetition_number << std::endl;
|
||||
#endif
|
||||
#endif // DEBUG1
|
||||
double *slater_inverse_nonpersistent = new double[dim * dim];
|
||||
if (version == "sm1") {
|
||||
for (unsigned int i = 0; i < repetition_number; i++) {
|
||||
@ -127,20 +124,20 @@ int test_cycle(H5File file, int cycle, std::string version, double tolerance) {
|
||||
std::memcpy(slater_inverse_nonpersistent, slater_inverse, dim * dim * sizeof(double));
|
||||
SMWB4(slater_inverse_nonpersistent, dim, nupdates, u, col_update_index);
|
||||
}
|
||||
#ifdef MKL
|
||||
#ifdef MKL
|
||||
} else if (version == "lapack") {
|
||||
for (unsigned int i = 0; i < repetition_number; i++) {
|
||||
std::memcpy(slater_inverse_nonpersistent, slater_matrix, dim * dim * sizeof(double));
|
||||
inverse(slater_inverse_nonpersistent, dim);
|
||||
}
|
||||
#endif // MKL
|
||||
#endif // MKL
|
||||
} else {
|
||||
std::cerr << "Unknown version " << version << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
std::memcpy(slater_inverse, slater_inverse_nonpersistent, dim * dim * sizeof(double));
|
||||
delete[] slater_inverse_nonpersistent;
|
||||
#else
|
||||
#else // No performance measurements repetition
|
||||
if (version == "maponia3") {
|
||||
MaponiA3(slater_inverse, dim, nupdates, u, col_update_index);
|
||||
} else if (version == "maponia3s") {
|
||||
@ -165,24 +162,21 @@ int test_cycle(H5File file, int cycle, std::string version, double tolerance) {
|
||||
// SMWB3(slater_inverse, dim, nupdates, u, col_update_index);
|
||||
} else if (version == "smwb4") {
|
||||
SMWB4(slater_inverse, dim, nupdates, u, col_update_index);
|
||||
#ifdef MKL
|
||||
#ifdef MKL
|
||||
} else if (version == "lapack") {
|
||||
memcpy(slater_inverse, slater_matrix, dim * dim * sizeof(double));
|
||||
inverse(slater_inverse, dim);
|
||||
#endif // MKL
|
||||
#endif // MKL
|
||||
} else {
|
||||
std::cerr << "Unknown version " << version << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
#endif // PERF
|
||||
#endif // PERF
|
||||
|
||||
#ifdef DEBUG2
|
||||
#ifdef DEBUG2
|
||||
showMatrix(slater_matrix, dim, "NEW Slater");
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG2
|
||||
showMatrix(slater_inverse, dim, "NEW Inverse");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
double *res = new double[dim * dim]{0};
|
||||
matMul(slater_matrix, slater_inverse, res, dim);
|
||||
@ -195,9 +189,9 @@ int test_cycle(H5File file, int cycle, std::string version, double tolerance) {
|
||||
<< res2 << std::endl;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG2
|
||||
#ifdef DEBUG2
|
||||
showMatrix(res, dim, "Result");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
delete[] res, updates, u, col_update_index, slater_matrix, slater_inverse;
|
||||
|
||||
@ -205,7 +199,7 @@ int test_cycle(H5File file, int cycle, std::string version, double tolerance) {
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#ifdef PERF
|
||||
#ifdef PERF
|
||||
if (argc != 5) {
|
||||
std::cerr << "Execute from within 'datasets/'" << std::endl;
|
||||
std::cerr
|
||||
@ -213,7 +207,7 @@ int main(int argc, char **argv) {
|
||||
<< std::endl;
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
#else
|
||||
if (argc != 4) {
|
||||
std::cerr << "Execute from within 'datasets/'" << std::endl;
|
||||
std::cerr
|
||||
@ -221,7 +215,7 @@ int main(int argc, char **argv) {
|
||||
<< std::endl;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
std::string version(argv[1]);
|
||||
std::string cyclefile_name(argv[2]);
|
||||
std::ifstream cyclefile(cyclefile_name);
|
||||
@ -231,9 +225,9 @@ int main(int argc, char **argv) {
|
||||
double tolerance = std::stod(argv[3]);
|
||||
H5File file(FILE_NAME, H5F_ACC_RDONLY);
|
||||
|
||||
#ifdef PERF
|
||||
#ifdef PERF
|
||||
repetition_number = std::stoi(argv[4]);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool ok;
|
||||
for (auto & cycle : cycles) {
|
||||
|
Loading…
Reference in New Issue
Block a user