1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-09-27 03:51:09 +02:00

lkpm works

This commit is contained in:
Gianfranco Abrusci 2022-03-14 11:21:31 +01:00
parent 712f595ed6
commit b222ee3156

View File

@ -5128,7 +5128,7 @@ end function qmckl_compute_cord_vect_full_f
| ~context~ | ~qmckl_context~ | in | Global state |
| ~cord_num~ | ~int64_t~ | in | Order of polynomials |
| ~dim_cord_vect~ | ~int64_t~ | in | dimension of cord full table |
| ~lpkm_combined_index~ | ~int64_t[4][dim_cord_vect]~ | out | Full list of combined indices |
| ~lkpm_combined_index~ | ~int64_t[4][dim_cord_vect]~ | out | Full list of combined indices |
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
integer function qmckl_compute_lkpm_combined_index_f(context, cord_num, dim_cord_vect, &
@ -5184,6 +5184,53 @@ integer function qmckl_compute_lkpm_combined_index_f(context, cord_num, dim_cord
end function qmckl_compute_lkpm_combined_index_f
#+end_src
#+begin_src c :comments org :tangle (eval c) :noweb yes
qmckl_exit_code qmckl_compute_lkpm_combined_index (
const qmckl_context context,
const int64_t cord_num,
const int64_t dim_cord_vect,
int64_t* const lkpm_combined_index ) {
int kk, lmax, m;
if (context == QMCKL_NULL_CONTEXT) {
return QMCKL_INVALID_CONTEXT;
}
if (cord_num <= 0) {
return QMCKL_INVALID_ARG_2;
}
if (dim_cord_vect <= 0) {
return QMCKL_INVALID_ARG_3;
}
/*
*/
kk = 0;
for (int p = 2; p <= cord_num; ++p) {
for (int k=(p-1); k >= 0; --k) {
if (k != 0) {
lmax = p - k;
} else {
lmax = p - k - 2;
}
for (int l=lmax; l >= 0; --l) {
if (((p - k - l) & 1) == 1) continue;
m = (p - k - l)/2;
lkpm_combined_index[kk ] = l;
lkpm_combined_index[kk + dim_cord_vect] = k;
lkpm_combined_index[kk + 2*dim_cord_vect] = p;
lkpm_combined_index[kk + 3*dim_cord_vect] = m;
kk = kk + 1;
}
}
}
return QMCKL_SUCCESS;
}
#+end_src
#+CALL: generate_c_header(table=qmckl_factor_lkpm_combined_index_args,rettyp=get_value("CRetType"),fname=get_value("Name"))
#+RESULTS:
@ -5192,32 +5239,10 @@ end function qmckl_compute_lkpm_combined_index_f
const qmckl_context context,
const int64_t cord_num,
const int64_t dim_cord_vect,
int64_t* const lpkm_combined_index );
int64_t* const lkpm_combined_index );
#+end_src
#+CALL: generate_c_interface(table=qmckl_factor_lkpm_combined_index_args,rettyp=get_value("CRetType"),fname=get_value("Name"))
#+RESULTS:
#+begin_src f90 :tangle (eval f) :comments org :exports none
integer(c_int32_t) function qmckl_compute_lkpm_combined_index &
(context, cord_num, dim_cord_vect, lpkm_combined_index) &
bind(C) result(info)
use, intrinsic :: iso_c_binding
implicit none
integer (c_int64_t) , intent(in) , value :: context
integer (c_int64_t) , intent(in) , value :: cord_num
integer (c_int64_t) , intent(in) , value :: dim_cord_vect
integer (c_int64_t) , intent(out) :: lpkm_combined_index(dim_cord_vect,4)
integer(c_int32_t), external :: qmckl_compute_lkpm_combined_index_f
info = qmckl_compute_lkpm_combined_index_f &
(context, cord_num, dim_cord_vect, lpkm_combined_index)
end function qmckl_compute_lkpm_combined_index
#+end_src
*** Compute tmp_c
:PROPERTIES: