diff --git a/ci/vfc_ci_report/compare_runs.py b/ci/vfc_ci_report/compare_runs.py index bc8da4e..d05b676 100644 --- a/ci/vfc_ci_report/compare_runs.py +++ b/ci/vfc_ci_report/compare_runs.py @@ -235,8 +235,8 @@ class CompareRuns: def update_n_runs(self, attrname, old, new): # Simply update runs selection (value and string display) - self.select_n_runs.value = new - self.current_n_runs = self.n_runs_dict[self.select_n_runs.value] + self.widgets["select_n_runs"].value = new + self.current_n_runs = self.n_runs_dict[self.widgets["select_n_runs"].value] self.update_plots() diff --git a/include/SM_Helpers.hpp b/include/SM_Helpers.hpp index 3543936..b569d18 100644 --- a/include/SM_Helpers.hpp +++ b/include/SM_Helpers.hpp @@ -87,7 +87,7 @@ T1 *outProd(T1 *vec1, T2 *vec2, unsigned int M) { } return C; } - + // // This flat version doesn't work. Get's stuck in an infinite recursion loop. // template T determinant(T *A, unsigned int M) { // std::cout << "determinant() called..." << std::endl; @@ -232,3 +232,15 @@ template T residual_frobenius2(T *A, unsigned int Dim) { } return res; } + + +template T residual2(T * A, unsigned int Dim) { + double res = 0.0; + for (unsigned int i = 0; i < Dim; i++) { + for (unsigned int j = 0; j < Dim; j++) { + T delta = (A[i * Dim + j] - (i == j)); + res += delta*delta; + } + } + return res; +} diff --git a/tests/vfc_test_h5.cpp b/tests/vfc_test_h5.cpp index 91109cf..920e069 100644 --- a/tests/vfc_test_h5.cpp +++ b/tests/vfc_test_h5.cpp @@ -133,15 +133,15 @@ int test_cycle(H5File file, int cycle, std::string version, matMul(slater_matrix, slater_inverse, res, dim); bool ok = is_identity(res, dim, 1e-3); - double res_max = residual_max(res, dim); - double res2 = residual_frobenius2(res, dim); + double res2 = residual2(res, dim); + double frob2 = norm_frobenius2(res, dim); #ifdef DEBUG showMatrix(res, dim, "Result"); #endif - vfc_put_probe(probes, &(zero_padded_group)[0], &("res_max_" + version)[0], - res_max); + vfc_put_probe(probes, &(zero_padded_group)[0], &("frob2_" + version)[0], + frob2); vfc_put_probe(probes, &(zero_padded_group)[0], &("res2_" + version)[0], res2); delete[] res, updates, u, col_update_index, slater_matrix, slater_inverse;