From d2bab284acc89fab9bf1341ed58a1552534663a5 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 3 Dec 2020 18:57:15 +0100 Subject: [PATCH] Tilde --- src/README.org | 2 +- src/qmckl_ao.org | 118 ++++++++++++++++++++--------------------- src/qmckl_context.org | 92 ++++++++++++++++---------------- src/qmckl_distance.org | 48 ++++++++--------- src/qmckl_memory.org | 4 +- 5 files changed, 132 insertions(+), 132 deletions(-) diff --git a/src/README.org b/src/README.org index c0206ee..1fea984 100644 --- a/src/README.org +++ b/src/README.org @@ -1,7 +1,7 @@ #+TITLE: QMCkl source code documentation #+EXPORT_FILE_NAME: index.html -#+SETUPFILE: https://fniessen.github.io/org-html-themes/org/theme-readtheorg.setup +#+SETUPFILE: https://fniessen.github.io/org-html-themes/org/setup/theme-readtheorg.setup * Introduction diff --git a/src/qmckl_ao.org b/src/qmckl_ao.org index f9095ab..0ff0878 100644 --- a/src/qmckl_ao.org +++ b/src/qmckl_ao.org @@ -41,30 +41,30 @@ MunitResult test_qmckl_ao() { && c(c-1) (x-X_i)^a (y-Y_i)^b (z-Z_i)^{c-1} \end{eqnarray*} -**** =qmckl_ao_power= +**** ~qmckl_ao_power~ - Computes all the powers of the =n= input data up to the given + Computes all the powers of the ~n~ input data up to the given maximum value given in input for each of the $n$ points: \[ P_{ij} = X_j^i \] ***** Arguments - | =context= | input | Global state | - | =n= | input | Number of values | - | =X(n)= | input | Array containing the input values | - | =LMAX(n)= | input | Array containing the maximum power for each value | - | =P(LDP,n)= | output | Array containing all the powers of =X= | - | =LDP= | input | Leading dimension of array =P= | + | ~context~ | input | Global state | + | ~n~ | input | Number of values | + | ~X(n)~ | input | Array containing the input values | + | ~LMAX(n)~ | input | Array containing the maximum power for each value | + | ~P(LDP,n)~ | output | Array containing all the powers of ~X~ | + | ~LDP~ | input | Leading dimension of array ~P~ | ***** Requirements - - =context= is not 0 - - =n= > 0 - - =X= is allocated with at least $n \times 8$ bytes - - =LMAX= is allocated with at least $n \times 4$ bytes - - =P= is allocated with at least $n \times \max_i \text{LMAX}_i \times 8$ bytes - - =LDP= >= $\max_i$ =LMAX[i]= + - ~context~ is not 0 + - ~n~ > 0 + - ~X~ is allocated with at least $n \times 8$ bytes + - ~LMAX~ is allocated with at least $n \times 4$ bytes + - ~P~ is allocated with at least $n \times \max_i \text{LMAX}_i \times 8$ bytes + - ~LDP~ >= $\max_i$ ~LMAX[i]~ ***** Header #+BEGIN_SRC C :tangle qmckl.h @@ -193,48 +193,48 @@ munit_assert_int(0, ==, test_qmckl_ao_power(context)); #+END_SRC -**** =qmckl_ao_polynomial_vgl= +**** ~qmckl_ao_polynomial_vgl~ Computes the values, gradients and Laplacians at a given point of - all polynomials with an angular momentum up to =lmax=. + all polynomials with an angular momentum up to ~lmax~. ***** Arguments - | =context= | input | Global state | - | =X(3)= | input | Array containing the coordinates of the points | - | =R(3)= | input | Array containing the x,y,z coordinates of the center | - | =lmax= | input | Maximum angular momentum | - | =n= | output | Number of computed polynomials | - | =L(ldl,n)= | output | Contains a,b,c for all =n= results | - | =ldl= | input | Leading dimension of =L= | - | =VGL(ldv,n)= | output | Value, gradients and Laplacian of the polynomials | - | =ldv= | input | Leading dimension of array =VGL= | + | ~context~ | input | Global state | + | ~X(3)~ | input | Array containing the coordinates of the points | + | ~R(3)~ | input | Array containing the x,y,z coordinates of the center | + | ~lmax~ | input | Maximum angular momentum | + | ~n~ | output | Number of computed polynomials | + | ~L(ldl,n)~ | output | Contains a,b,c for all ~n~ results | + | ~ldl~ | input | Leading dimension of ~L~ | + | ~VGL(ldv,n)~ | output | Value, gradients and Laplacian of the polynomials | + | ~ldv~ | input | Leading dimension of array ~VGL~ | ***** Requirements - - =context= is not 0 - - =n= > 0 - - =lmax= >= 0 - - =ldl= >= 3 - - =ldv= >= 5 - - =X= is allocated with at least $3 \times 8$ bytes - - =R= is allocated with at least $3 \times 8$ bytes - - =n= >= =(lmax+1)(lmax+2)(lmax+3)/6= - - =L= is allocated with at least $3 \times n \times 4$ bytes - - =VGL= is allocated with at least $5 \times n \times 8$ bytes - - On output, =n= should be equal to =(lmax+1)(lmax+2)(lmax+3)/6= + - ~context~ is not 0 + - ~n~ > 0 + - ~lmax~ >= 0 + - ~ldl~ >= 3 + - ~ldv~ >= 5 + - ~X~ is allocated with at least $3 \times 8$ bytes + - ~R~ is allocated with at least $3 \times 8$ bytes + - ~n~ >= ~(lmax+1)(lmax+2)(lmax+3)/6~ + - ~L~ is allocated with at least $3 \times n \times 4$ bytes + - ~VGL~ is allocated with at least $5 \times n \times 8$ bytes + - On output, ~n~ should be equal to ~(lmax+1)(lmax+2)(lmax+3)/6~ - On output, the powers are given in the following order (l=a+b+c): - - Increase values of =l= - - Within a given value of =l=, alphabetical order of the + - Increase values of ~l~ + - Within a given value of ~l~, alphabetical order of the string made by a*"x" + b*"y" + c*"z" (in Python notation). For example, with a=0, b=2 and c=1 the string is "yyz" ***** Error codes | -1 | Null context | - | -2 | Inconsistent =ldl= | - | -3 | Inconsistent =ldv= | - | -4 | Inconsistent =lmax= | + | -2 | Inconsistent ~ldl~ | + | -3 | Inconsistent ~ldv~ | + | -4 | Inconsistent ~lmax~ | ***** Header #+BEGIN_SRC C :tangle qmckl.h @@ -512,14 +512,13 @@ end function test_qmckl_ao_polynomial_vgl int test_qmckl_ao_polynomial_vgl(qmckl_context context); munit_assert_int(0, ==, test_qmckl_ao_polynomial_vgl(context)); #+END_SRC - #+END_SRC *** Gaussian basis functions -**** =qmckl_ao_gaussian_vgl= +**** ~qmckl_ao_gaussian_vgl~ Computes the values, gradients and Laplacians at a given point of - =n= Gaussian functions centered at the same point: + ~n~ Gaussian functions centered at the same point: \[ v_i = exp(-a_i |X-R|^2) \] \[ \nabla_x v_i = -2 a_i (X_x - R_x) v_i \] @@ -529,24 +528,24 @@ munit_assert_int(0, ==, test_qmckl_ao_polynomial_vgl(context)); ***** Arguments - | =context= | input | Global state | - | =X(3)= | input | Array containing the coordinates of the points | - | =R(3)= | input | Array containing the x,y,z coordinates of the center | - | =n= | input | Number of computed gaussians | - | =A(n)= | input | Exponents of the Gaussians | - | =VGL(ldv,5)= | output | Value, gradients and Laplacian of the Gaussians | - | =ldv= | input | Leading dimension of array =VGL= | + | ~context~ | input | Global state | + | ~X(3)~ | input | Array containing the coordinates of the points | + | ~R(3)~ | input | Array containing the x,y,z coordinates of the center | + | ~n~ | input | Number of computed gaussians | + | ~A(n)~ | input | Exponents of the Gaussians | + | ~VGL(ldv,5)~ | output | Value, gradients and Laplacian of the Gaussians | + | ~ldv~ | input | Leading dimension of array ~VGL~ | ***** Requirements - - =context= is not 0 - - =n= > 0 - - =ldv= >= 5 - - =A(i)= > 0 for all =i= - - =X= is allocated with at least $3 \times 8$ bytes - - =R= is allocated with at least $3 \times 8$ bytes - - =A= is allocated with at least $n \times 8$ bytes - - =VGL= is allocated with at least $n \times 5 \times 8$ bytes + - ~context~ is not 0 + - ~n~ > 0 + - ~ldv~ >= 5 + - ~A(i)~ > 0 for all ~i~ + - ~X~ is allocated with at least $3 \times 8$ bytes + - ~R~ is allocated with at least $3 \times 8$ bytes + - ~A~ is allocated with at least $n \times 8$ bytes + - ~VGL~ is allocated with at least $n \times 5 \times 8$ bytes ***** Header #+BEGIN_SRC C :tangle qmckl.h @@ -740,3 +739,4 @@ munit_assert_int(0, ==, test_qmckl_ao_gaussian_vgl(context)); # -*- mode: org -*- # vim: syntax=c + diff --git a/src/qmckl_context.org b/src/qmckl_context.org index 6ca4894..dad24a6 100644 --- a/src/qmckl_context.org +++ b/src/qmckl_context.org @@ -24,8 +24,8 @@ MunitResult test_qmckl_context() { is stored in the following data structure, which can't be seen outside of the library. To simplify compatibility with other languages, the pointer to the internal data structure is converted - into a 64-bit signed integer, defined in the =qmckl_context= type. - A value of 0 for the context is equivalent to a =NULL= pointer. + into a 64-bit signed integer, defined in the ~qmckl_context~ type. + A value of 0 for the context is equivalent to a ~NULL~ pointer. # The following code block should be kept to insert comments into # the qmckl.h file @@ -89,10 +89,10 @@ qmckl_context new_context; #+END_SRC -**** =qmckl_context_check= +**** ~qmckl_context_check~ Checks if the domain pointed by the pointer is a valid context. - Returns the input =qmckl_context= if the context is valid, 0 + Returns the input ~qmckl_context~ if the context is valid, 0 otherwise. #+BEGIN_SRC C :comments org :tangle qmckl.h @@ -113,11 +113,11 @@ qmckl_context qmckl_context_check(const qmckl_context context) { } #+END_SRC -**** =qmckl_context_create= +**** ~qmckl_context_create~ - To create a new context, use =qmckl_context_create()=. - - On success, returns a pointer to a context using the =qmckl_context= type - - Returns 0 upon failure to allocate the internal data structure + To create a new context, use ~qmckl_context_create()~. + - On success, returns a pointer to a context using the ~qmckl_context~ type + - Returns ~0~ upon failure to allocate the internal data structure #+BEGIN_SRC C :comments org :tangle qmckl.h qmckl_context qmckl_context_create(); @@ -159,11 +159,11 @@ munit_assert_int64( context, !=, (qmckl_context) 0); munit_assert_int64( qmckl_context_check(context), ==, context); #+END_SRC -**** =qmckl_context_copy= +**** ~qmckl_context_copy~ This function makes a shallow copy of the current context. - Copying the 0-valued context returns 0 - - On success, returns a pointer to the new context using the =qmckl_context= type + - On success, returns a pointer to the new context using the ~qmckl_context~ type - Returns 0 upon failure to allocate the internal data structure for the new context @@ -218,7 +218,7 @@ munit_assert_int64(new_context, !=, context); munit_assert_int64(qmckl_context_check(new_context), ==, new_context); #+END_SRC -**** =qmckl_context_previous= +**** ~qmckl_context_previous~ Returns the previous context - On success, returns the ancestor of the current context @@ -261,7 +261,7 @@ munit_assert_int64(qmckl_context_previous(context), ==, (qmckl_context) 0); munit_assert_int64(qmckl_context_previous((qmckl_context) 0), ==, (qmckl_context) 0); #+END_SRC -**** =qmckl_context_destroy= +**** ~qmckl_context_destroy~ Destroys the current context, leaving the ancestors untouched. - Succeeds if the current context is properly destroyed @@ -351,20 +351,20 @@ COEFFICIENT = [ 0.006068, 0.045308, 0.202822, 0.503903, 0.383421, 0.503903, 0.383421, 1.0, 1.0, 1.0, 1.0, 1.0] #+END_EXAMPLE -**** =qmckl_context_update_ao_basis= +**** ~qmckl_context_update_ao_basis~ Updates the data describing the AO basis set into the context. - | =type= | Gaussian or Slater | - | =shell_num= | Number of shells | - | =prim_num= | Total number of primitives | - | =SHELL_CENTER(shell_num)= | Id of the nucleus on which the shell is centered | - | =SHELL_ANG_MOM(shell_num)= | Id of the nucleus on which the shell is centered | - | =SHELL_FACTOR(shell_num)= | Normalization factor for the shell | - | =SHELL_PRIM_NUM(shell_num)= | Number of primitives in the shell | - | =SHELL_PRIM_INDEX(shell_num)= | Address of the first primitive of the shelll in the =EXPONENT= array | - | =EXPONENT(prim_num)= | Array of exponents | - | =COEFFICIENT(prim_num)= | Array of coefficients | + | ~type~ | Gaussian or Slater | + | ~shell_num~ | Number of shells | + | ~prim_num~ | Total number of primitives | + | ~SHELL_CENTER(shell_num)~ | Id of the nucleus on which the shell is centered | + | ~SHELL_ANG_MOM(shell_num)~ | Id of the nucleus on which the shell is centered | + | ~SHELL_FACTOR(shell_num)~ | Normalization factor for the shell | + | ~SHELL_PRIM_NUM(shell_num)~ | Number of primitives in the shell | + | ~SHELL_PRIM_INDEX(shell_num)~ | Address of the first primitive of the shelll in the ~EXPONENT~ array | + | ~EXPONENT(prim_num)~ | Array of exponents | + | ~COEFFICIENT(prim_num)~ | Array of coefficients | #+BEGIN_SRC C :comments org :tangle qmckl.h qmckl_exit_code @@ -515,20 +515,20 @@ qmckl_context_update_ao_basis(qmckl_context context , const char type ***** TODO Test -**** =qmckl_context_set_ao_basis= +**** ~qmckl_context_set_ao_basis~ Sets the data describing the AO basis set into the context. - | =type= | Gaussian or Slater | - | =shell_num= | Number of shells | - | =prim_num= | Total number of primitives | - | =SHELL_CENTER(shell_num)= | Id of the nucleus on which the shell is centered | - | =SHELL_ANG_MOM(shell_num)= | Id of the nucleus on which the shell is centered | - | =SHELL_FACTOR(shell_num)= | Normalization factor for the shell | - | =SHELL_PRIM_NUM(shell_num)= | Number of primitives in the shell | - | =SHELL_PRIM_INDEX(shell_num)= | Address of the first primitive of the shelll in the =EXPONENT= array | - | =EXPONENT(prim_num)= | Array of exponents | - | =COEFFICIENT(prim_num)= | Array of coefficients | + | ~type~ | Gaussian or Slater | + | ~shell_num~ | Number of shells | + | ~prim_num~ | Total number of primitives | + | ~SHELL_CENTER(shell_num)~ | Id of the nucleus on which the shell is centered | + | ~SHELL_ANG_MOM(shell_num)~ | Id of the nucleus on which the shell is centered | + | ~SHELL_FACTOR(shell_num)~ | Normalization factor for the shell | + | ~SHELL_PRIM_NUM(shell_num)~ | Number of primitives in the shell | + | ~SHELL_PRIM_INDEX(shell_num)~ | Address of the first primitive of the shelll in the ~EXPONENT~ array | + | ~EXPONENT(prim_num)~ | Array of exponents | + | ~COEFFICIENT(prim_num)~ | Array of coefficients | #+BEGIN_SRC C :comments org :tangle qmckl.h qmckl_context @@ -592,15 +592,15 @@ qmckl_context_set_ao_basis(const qmckl_context context , const char typ *** Precision The following functions set and get the expected required - precision and range. =precision= should be an integer between 2 - and 53, and =range= should be an integer between 2 and 11. + precision and range. ~precision~ should be an integer between 2 + and 53, and ~range~ should be an integer between 2 and 11. The setter functions functions return a new context as a 64-bit integer. The getter functions return the value, as a 32-bit - integer. The update functions return =QMCKL_SUCCESS= or - =QMCKL_FAILURE=. + integer. The update functions return ~QMCKL_SUCCESS~ or + ~QMCKL_FAILURE~. -**** =qmckl_context_update_precision= +**** ~qmckl_context_update_precision~ Modifies the parameter for the numerical precision in a given context. #+BEGIN_SRC C :comments org :tangle qmckl.h qmckl_exit_code qmckl_context_update_precision(const qmckl_context context, const int precision); @@ -633,7 +633,7 @@ qmckl_exit_code qmckl_context_update_precision(const qmckl_context context, cons #+END_SRC ***** TODO Tests :noexport: -**** =qmckl_context_update_range= +**** ~qmckl_context_update_range~ Modifies the parameter for the numerical range in a given context. #+BEGIN_SRC C :comments org :tangle qmckl.h qmckl_exit_code qmckl_context_update_range(const qmckl_context context, const int range); @@ -666,7 +666,7 @@ qmckl_exit_code qmckl_context_update_range(const qmckl_context context, const in #+END_SRC ***** TODO Tests :noexport: -**** =qmckl_context_set_precision= +**** ~qmckl_context_set_precision~ Returns a copy of the context with a different precision parameter. #+BEGIN_SRC C :comments org :tangle qmckl.h qmckl_context qmckl_context_set_precision(const qmckl_context context, const int precision); @@ -696,7 +696,7 @@ qmckl_context qmckl_context_set_precision(const qmckl_context context, const int #+END_SRC ***** TODO Tests :noexport: -**** =qmckl_context_set_range= +**** ~qmckl_context_set_range~ Returns a copy of the context with a different precision parameter. #+BEGIN_SRC C :comments org :tangle qmckl.h qmckl_context qmckl_context_set_range(const qmckl_context context, const int range); @@ -727,7 +727,7 @@ qmckl_context qmckl_context_set_range(const qmckl_context context, const int ran ***** TODO Tests :noexport: -**** =qmckl_context_get_precision= +**** ~qmckl_context_get_precision~ Returns the value of the numerical precision in the context #+BEGIN_SRC C :comments org :tangle qmckl.h int32_t qmckl_context_get_precision(const qmckl_context context); @@ -752,7 +752,7 @@ int qmckl_context_get_precision(const qmckl_context context) { #+END_SRC ***** TODO Tests :noexport: -**** =qmckl_context_get_range= +**** ~qmckl_context_get_range~ Returns the value of the numerical range in the context #+BEGIN_SRC C :comments org :tangle qmckl.h int32_t qmckl_context_get_range(const qmckl_context context); @@ -778,8 +778,8 @@ int qmckl_context_get_range(const qmckl_context context) { ***** TODO Tests :noexport: -**** =qmckl_context_get_epsilon= - Returns $\epsilon = 2^{1-n}$ where =n= is the precision +**** ~qmckl_context_get_epsilon~ + Returns $\epsilon = 2^{1-n}$ where ~n~ is the precision #+BEGIN_SRC C :comments org :tangle qmckl.h double qmckl_context_get_epsilon(const qmckl_context context); #+END_SRC diff --git a/src/qmckl_distance.org b/src/qmckl_distance.org index 5eac91d..57e5531 100644 --- a/src/qmckl_distance.org +++ b/src/qmckl_distance.org @@ -20,7 +20,7 @@ MunitResult test_qmckl_distance() { *** Squared distance -**** =qmckl_distance_sq= +**** ~qmckl_distance_sq~ Computes the matrix of the squared distances between all pairs of points in two sets, one point within each set: @@ -30,35 +30,35 @@ MunitResult test_qmckl_distance() { ***** Arguments - | =context= | input | Global state | - | =transa= | input | Array =A= is =N=: Normal, =T=: Transposed | - | =transb= | input | Array =B= is =N=: Normal, =T=: Transposed | - | =m= | input | Number of points in the first set | - | =n= | input | Number of points in the second set | - | =A(lda,3)= | input | Array containing the $m \times 3$ matrix $A$ | - | =lda= | input | Leading dimension of array =A= | - | =B(ldb,3)= | input | Array containing the $n \times 3$ matrix $B$ | - | =ldb= | input | Leading dimension of array =B= | - | =C(ldc,n)= | output | Array containing the $m \times n$ matrix $C$ | - | =ldc= | input | Leading dimension of array =C= | + | ~context~ | input | Global state | + | ~transa~ | input | Array ~A~ is ~N~: Normal, ~T~: Transposed | + | ~transb~ | input | Array ~B~ is ~N~: Normal, ~T~: Transposed | + | ~m~ | input | Number of points in the first set | + | ~n~ | input | Number of points in the second set | + | ~A(lda,3)~ | input | Array containing the $m \times 3$ matrix $A$ | + | ~lda~ | input | Leading dimension of array ~A~ | + | ~B(ldb,3)~ | input | Array containing the $n \times 3$ matrix $B$ | + | ~ldb~ | input | Leading dimension of array ~B~ | + | ~C(ldc,n)~ | output | Array containing the $m \times n$ matrix $C$ | + | ~ldc~ | input | Leading dimension of array ~C~ | ***** Requirements - - =context= is not 0 - - =m= > 0 - - =n= > 0 - - =lda= >= 3 if =transa= is =N= - - =lda= >= m if =transa= is =T= - - =ldb= >= 3 if =transb= is =N= - - =ldb= >= n if =transb= is =T= - - =ldc= >= m if =transa= is = - - =A= is allocated with at least $3 \times m \times 8$ bytes - - =B= is allocated with at least $3 \times n \times 8$ bytes - - =C= is allocated with at least $m \times n \times 8$ bytes + - ~context~ is not 0 + - ~m~ > 0 + - ~n~ > 0 + - ~lda~ >= 3 if ~transa~ is ~N~ + - ~lda~ >= m if ~transa~ is ~T~ + - ~ldb~ >= 3 if ~transb~ is ~N~ + - ~ldb~ >= n if ~transb~ is ~T~ + - ~ldc~ >= m + - ~A~ is allocated with at least $3 \times m \times 8$ bytes + - ~B~ is allocated with at least $3 \times n \times 8$ bytes + - ~C~ is allocated with at least $m \times n \times 8$ bytes ***** Performance - This function might be more efficient when =A= and =B= are + This function might be more efficient when ~A~ and ~B~ are transposed. #+BEGIN_SRC C :comments org :tangle qmckl.h diff --git a/src/qmckl_memory.org b/src/qmckl_memory.org index 7e3ca79..e74913b 100644 --- a/src/qmckl_memory.org +++ b/src/qmckl_memory.org @@ -18,7 +18,7 @@ MunitResult test_qmckl_memory() { #+END_SRC -*** =qmckl_malloc= +*** ~qmckl_malloc~ Memory allocation function, letting the library choose how the memory will be allocated, and a pointer is returned to the user. @@ -61,7 +61,7 @@ munit_assert_int(a[1], ==, 2); munit_assert_int(a[2], ==, 3); #+END_SRC -*** =qmckl_free= +*** ~qmckl_free~ #+BEGIN_SRC C :tangle qmckl.h void qmckl_free(void *ptr);