1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-12-23 04:44:03 +01:00

fixed seg fault: incremented wrong counter

This commit is contained in:
Gianfranco Abrusci 2022-02-03 11:40:54 +01:00
parent 67f80532f9
commit 6a0c54f48c

View File

@ -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 function qmckl_compute_asymp_jasb_f
#+end_src #+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 ( qmckl_exit_code qmckl_compute_asymp_jasb (
const qmckl_context context, const qmckl_context context,
const int64_t bord_num, const int64_t bord_num,
const double* bord_vector, const double* bord_vector,
const double rescale_factor_kappa_ee, const double rescale_factor_kappa_ee,
double* const asymp_jasb ) { double* const asymp_jasb ) {
// Put some code here // What is wrong here?
int64_t info;
double kappa_inv, x, asym_one; double kappa_inv, x, asym_one;
kappa_inv = 1.0/ rescale_factor_kappa_ee; kappa_inv = 1.0 / rescale_factor_kappa_ee;
info = QMCKL_SUCCESS;
if (context == QMCKL_NULL_CONTEXT){ if (context == QMCKL_NULL_CONTEXT){
info = QMCKL_INVALID_CONTEXT; return QMCKL_INVALID_CONTEXT;
return info;
} }
if (bord_num <= 0) { if (bord_num <= 0) {
info = QMCKL_INVALID_ARG_2; return QMCKL_INVALID_ARG_2;
return info;
} }
asym_one = bord_vector[0] * kappa_inv / (1.0 + bord_vector[1] * kappa_inv); asym_one = bord_vector[0] * kappa_inv / (1.0 + bord_vector[1] * kappa_inv);
asymp_jasb[0] = asym_one; asymp_jasb[0] = asym_one;
asymp_jasb[1] = 0.5 * 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; x = kappa_inv;
for (int p = 1; p < bord_num; ++p){
for (int p = 1; p < bord_num; ++i){
x = x * kappa_inv; x = x * kappa_inv;
asymp_jasb[i] = asymp_jasb[i] + bord_vector[p + 1] * x; asymp_jasb[i] = asymp_jasb[i] + bord_vector[p + 1] * x;
} }
} }
return info; return QMCKL_SUCCESS;
} // end function qmckl_exit_code }
#+end_src #+end_src
#+CALL: generate_c_header(table=qmckl_asymp_jasb_args,rettyp=get_value("CRetType"),fname=get_value("Name")) #+CALL: generate_c_header(table=qmckl_asymp_jasb_args,rettyp=get_value("CRetType"),fname=get_value("Name"))