From 6a0c54f48c4df59ec8481a6239c027a0f6b64e7c Mon Sep 17 00:00:00 2001 From: Gianfranco Abrusci Date: Thu, 3 Feb 2022 11:40:54 +0100 Subject: [PATCH] fixed seg fault: incremented wrong counter --- org/qmckl_jastrow.org | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/org/qmckl_jastrow.org b/org/qmckl_jastrow.org index 7c37818..c70ef9f 100644 --- a/org/qmckl_jastrow.org +++ b/org/qmckl_jastrow.org @@ -1332,45 +1332,40 @@ integer function qmckl_compute_asymp_jasb_f(context, bord_num, bord_vector, resc end function qmckl_compute_asymp_jasb_f #+end_src -#+begin_src c :tangle (eval c) +#+begin_src c :comments org :tangle (eval c) :noweb yes qmckl_exit_code qmckl_compute_asymp_jasb ( const qmckl_context context, const int64_t bord_num, const double* bord_vector, const double rescale_factor_kappa_ee, double* const asymp_jasb ) { - // Put some code here - int64_t info; + // What is wrong here? double kappa_inv, x, asym_one; - kappa_inv = 1.0/ rescale_factor_kappa_ee; - - info = QMCKL_SUCCESS; + kappa_inv = 1.0 / rescale_factor_kappa_ee; if (context == QMCKL_NULL_CONTEXT){ - info = QMCKL_INVALID_CONTEXT; - return info; + return QMCKL_INVALID_CONTEXT; } if (bord_num <= 0) { - info = QMCKL_INVALID_ARG_2; - return info; + return QMCKL_INVALID_ARG_2; } + asym_one = bord_vector[0] * kappa_inv / (1.0 + bord_vector[1] * kappa_inv); asymp_jasb[0] = asym_one; asymp_jasb[1] = 0.5 * asym_one; - for (int i=0; i<=1; ++i) { + for (int i = 0 ; i <= 1; ++i) { x = kappa_inv; - - for (int p = 1; p < bord_num; ++i){ + for (int p = 1; p < bord_num; ++p){ x = x * kappa_inv; asymp_jasb[i] = asymp_jasb[i] + bord_vector[p + 1] * x; } } - return info; -} // end function qmckl_exit_code + return QMCKL_SUCCESS; +} #+end_src #+CALL: generate_c_header(table=qmckl_asymp_jasb_args,rettyp=get_value("CRetType"),fname=get_value("Name"))