QMCkl source code documentation
@@ -348,8 +270,7 @@ and bug reports should be submitted at
QMCkl source code documentation
@@ -348,8 +270,7 @@ and bug reports should be submitted at
Introduction
Table of Contents
-
-
- 1. Using QMCkl -
- 2. Developing in QMCkl +
- 1. Using QMCkl +
- 2. Developing in QMCkl
-
-
- 2.1. Literate programming -
- 2.2. Source code editing -
- 2.3. Choice of the programming language -
- 2.4. Coding rules -
- 2.5. Design of the library -
- 2.6. Naming conventions -
- 2.7. Application programming interface -
- 2.8. Global state -
- 2.9. Headers -
- 2.10. Low-level functions -
- 2.11. High-level functions -
- 2.12. Numerical precision -
- 2.13. Algorithms +
- 2.1. Literate programming +
- 2.2. Source code editing +
- 2.3. Choice of the programming language +
- 2.4. Coding rules +
- 2.5. Design of the library +
- 2.6. Naming conventions +
- 2.7. Application programming interface +
- 2.8. Global state +
- 2.9. Headers +
- 2.10. Low-level functions +
- 2.11. High-level functions +
- 2.12. Numerical precision +
- 2.13. Algorithms
1 Using QMCkl
+1 Using QMCkl
The qmckl.h
header file installed in the ${prefix}/include
directory
@@ -385,12 +307,12 @@ Both files are located in the include/
directory.
2 Developing in QMCkl
+2 Developing in QMCkl
2.1 Literate programming
+2.1 Literate programming
In a traditional source code, most of the lines of source files of a program @@ -435,8 +357,8 @@ interactively, in the same spirit as Jupyter notebooks.
2.2 Source code editing
+2.2 Source code editing
For a tutorial on literate programming with org-mode, follow this link. @@ -467,8 +389,8 @@ org-mode.
2.3 Choice of the programming language
+2.3 Choice of the programming language
Most of the codes of the TREX CoE are written in Fortran with some scripts in @@ -516,8 +438,8 @@ For more guidelines on using Fortran to generate a C interface, see
2.4 Coding rules
+2.4 Coding rules
The authors should follow the recommendations of the C99
@@ -535,8 +457,8 @@ Compliance can be checked with cppcheck
as:
2.5 Design of the library
+2.5 Design of the library
The proposed API should allow the library to: deal with memory transfers @@ -547,8 +469,8 @@ functions (see below).
2.6 Naming conventions
+2.6 Naming conventions
To avoid namespace collisions, we use qmckl_
as a prefix for all exported
@@ -573,8 +495,8 @@ form is allowed.
2.7 Application programming interface
+2.7 Application programming interface
In the C language, the number of bits used by the integer types can change @@ -606,15 +528,15 @@ bindings in other languages in other repositories.
2.8 Global state
+2.8 Global state
Global variables should be avoided in the library, because it is
possible that one single program needs to use multiple instances
of the library. To solve this problem we propose to use a pointer
to a context
variable, built by the library with the
-qmckl_context_create
function. The =context= contains the global
+qmckl_context_create
function. The =context= contains the global
state of the library, and is used as the first argument of many
QMCkl functions.
2.9 Headers
+2.9 Headers
A single qmckl.h
header to be distributed by the library
@@ -717,8 +639,8 @@ and the types definitions should be written in the *_f_type.f90
fil
2.10 Low-level functions
+2.10 Low-level functions
Low-level functions are very simple functions which are leaves of @@ -727,14 +649,14 @@ the function call tree (they don't call any other QMCkl function).
These functions are pure, and unaware of the QMCkl
-context
. They are not allowed to allocate/deallocate memory, and
+context
. They are not allowed to allocate/deallocate memory, and
if they need temporary memory it should be provided in input.
2.11 High-level functions
+2.11 High-level functions
High-level functions are at the top of the function call tree. @@ -747,27 +669,27 @@ temporary storage, to simplify the use of accelerators.
The high-level functions should be pure, unless the introduction
of non-purity is justified. All the side effects should be made in
-the context
variable.
+the context
variable.
2.12 Numerical precision
+2.12 Numerical precision
The number of bits of precision required for a function should be
given as an input of low-level computational functions. This input
will be used to define the values of the different thresholds that
might be used to avoid computing unnecessary noise. High-level
-functions will use the precision specified in the context
+functions will use the precision specified in the context
variable.
2.13 Algorithms
+2.13 Algorithms
Reducing the scaling of an algorithm usually implies also reducing @@ -782,8 +704,7 @@ implemented adapted to different problem sizes.
Atomic Orbitals
Table of Contents
-
-
- 1. Context +
- 1. Context -
- 2. Polynomial part +
- 2. Polynomial part -
- 3. Radial part +
- 3. Radial part -
- 4. Combining radial and polynomial parts +
- 4. Combining radial and polynomial parts
1 Context
+1 Context
The following arrays are stored in the context: @@ -503,8 +425,8 @@ coefficient = [ 0.006068, 0.045308, 0.202822, 0.503903, 0.383421,
1.1 Data structure
+1.1 Data structure
typedef struct qmckl_ao_basis_struct {
@@ -533,8 +455,8 @@ struct is then initialized and provided == true
.
1.2 Access functions
+1.2 Access functions
When all the data for the AOs have been provided, the following
@@ -548,8 +470,8 @@ function returns true
.
1.3 Initialization functions
+1.3 Initialization functions
To set the basis set, all the following functions need to be @@ -572,17 +494,17 @@ called. When
1.4 TODO Fortran interfaces
+1.4 TODO Fortran interfaces
2 Polynomial part
+2 Polynomial part
2.1 Powers of \(x-X_i\)
+2.1 Powers of \(x-X_i\)
The qmckl_ao_power
function computes all the powers of the n
@@ -594,7 +516,7 @@ the \(n\) points:
\[ P_{ik} = X_i^k \]
2.1.1 Requirements
+2.1.1 Requirements
context
is notQMCKL_NULL_CONTEXT
@@ -666,8 +588,8 @@ the \(n\) points:
2.1.2 C Header
+2.1.2 C Header
qmckl_exit_code qmckl_ao_power ( @@ -682,8 +604,8 @@ the \(n\) points:
2.1.3 Source
+2.1.3 Source
integer function qmckl_ao_power_f(context, n, X, LMAX, P, ldp) result(info) @@ -724,7 +646,7 @@ the \(n\) points: do i=1,n P(1,i) = X(i) do k=2,LMAX(i) - P(k,i) = P(k-1,i) * X(i) + P(k,i) = P(k-1,i) * X(i) end do end do @@ -734,15 +656,15 @@ the \(n\) points:
2.1.4 C interface
+2.1.4 C interface
2.1.5 Fortran interface
+2.1.5 Fortran interface
2.1.6 Test
+2.1.6 Test
integer(c_int32_t) function test_qmckl_ao_power(context) bind(C) @@ -751,8 +673,8 @@ the \(n\) points: integer(qmckl_context), intent(in), value :: context - integer*8 :: n, LDP - integer, allocatable :: LMAX(:) + integer*8 :: n, LDP + integer, allocatable :: LMAX(:) double precision, allocatable :: X(:), P(:,:) integer*8 :: i,j double precision :: epsilon @@ -769,7 +691,7 @@ the \(n\) points: LMAX(j) = 1 + int(mod(j, 5),4) end do - test_qmckl_ao_power = qmckl_ao_power(context, n, X, LMAX, P, LDP) + test_qmckl_ao_power = qmckl_ao_power(context, n, X, LMAX, P, LDP) if (test_qmckl_ao_power /= QMCKL_SUCCESS) return test_qmckl_ao_power = QMCKL_FAILURE @@ -793,8 +715,8 @@ the \(n\) points:
2.2 Value, Gradient and Laplacian of a polynomial
+2.2 Value, Gradient and Laplacian of a polynomial
A polynomial is centered on a nucleus \(\mathbf{R}_i\) @@ -802,7 +724,7 @@ A polynomial is centered on a nucleus \(\mathbf{R}_i\)
\[ - P_l(\mathbf{r},\mathbf{R}_i) = (x-X_i)^a (y-Y_i)^b (z-Z_i)^c + P_l(\mathbf{r},\mathbf{R}_i) = (x-X_i)^a (y-Y_i)^b (z-Z_i)^c \]
@@ -810,24 +732,24 @@ A polynomial is centered on a nucleus \(\mathbf{R}_i\) The gradients with respect to electron coordinates are -\begin{eqnarray*} +\begin{eqnarray*} \frac{\partial }{\partial x} P_l\left(\mathbf{r},\mathbf{R}_i \right) & = & a (x-X_i)^{a-1} (y-Y_i)^b (z-Z_i)^c \\ \frac{\partial }{\partial y} P_l\left(\mathbf{r},\mathbf{R}_i \right) & = & b (x-X_i)^a (y-Y_i)^{b-1} (z-Z_i)^c \\ \frac{\partial }{\partial z} P_l\left(\mathbf{r},\mathbf{R}_i \right) & = & c (x-X_i)^a (y-Y_i)^b (z-Z_i)^{c-1} \\ -\end{eqnarray*} +\end{eqnarray*}and the Laplacian is
-\begin{eqnarray*} -\left( \frac{\partial }{\partial x^2} + - \frac{\partial }{\partial y^2} + +\begin{eqnarray*} +\left( \frac{\partial }{\partial x^2} + + \frac{\partial }{\partial y^2} + \frac{\partial }{\partial z^2} \right) P_l - \left(\mathbf{r},\mathbf{R}_i \right) & = & + \left(\mathbf{r},\mathbf{R}_i \right) & = & a(a-1) (x-X_i)^{a-2} (y-Y_i)^b (z-Z_i)^c + \\ && b(b-1) (x-X_i)^a (y-Y_i)^{b-1} (z-Z_i)^c + \\ && c(c-1) (x-X_i)^a (y-Y_i)^b (z-Z_i)^{c-1}. @@ -839,7 +761,7 @@ Laplacians at a given point in space, of all polynomials with an angular momentum up tolmax
.
-2.2.1 Requirements
+2.2.1 Requirements
context
is notQMCKL_NULL_CONTEXT
@@ -944,8 +866,8 @@ For example, with a=0, b=2 and c=1 the string is "yyz"
2.2.2 C Header
+2.2.2 C Header
qmckl_exit_code qmckl_ao_polynomial_vgl ( @@ -963,8 +885,8 @@ For example, with a=0, b=2 and c=1 the string is "yyz"
2.2.3 Source
+2.2.3 Source
integer function qmckl_ao_polynomial_vgl_f(context, X, R, lmax, n, L, ldl, VGL, ldv) result(info) @@ -1024,9 +946,9 @@ For example, with a=0, b=2 and c=1 the string is "yyz" else if (lmax > 0) then pows(-2:0,1:3) = 1.d0 do i=1,lmax - pows(i,1) = pows(i-1,1) * Y(1) - pows(i,2) = pows(i-1,2) * Y(2) - pows(i,3) = pows(i-1,3) * Y(3) + pows(i,1) = pows(i-1,1) * Y(1) + pows(i,2) = pows(i-1,2) * Y(2) + pows(i,3) = pows(i-1,3) * Y(3) end do VGL(1:5,1:4) = 0.d0 @@ -1099,16 +1021,16 @@ For example, with a=0, b=2 and c=1 the string is "yyz"
2.2.4 C interface
+2.2.4 C interface
2.2.5 Fortran interface
+2.2.5 Fortran interface
2.2.6 Test
+2.2.6 Test
integer(c_int32_t) function test_qmckl_ao_polynomial_vgl(context) bind(C) @@ -1185,13 +1107,13 @@ For example, with a=0, b=2 and c=1 the string is "yyz" test_qmckl_ao_polynomial_vgl = QMCKL_FAILURE w = 0.d0 if (L(1,j) > 1) then - w = w + L(1,j) * (L(1,j)-1) * Y(1)**(L(1,j)-2) * Y(2)**L(2,j) * Y(3)**L(3,j) + w = w + L(1,j) * (L(1,j)-1) * Y(1)**(L(1,j)-2) * Y(2)**L(2,j) * Y(3)**L(3,j) end if if (L(2,j) > 1) then - w = w + L(2,j) * (L(2,j)-1) * Y(1)**L(1,j) * Y(2)**(L(2,j)-2) * Y(3)**L(3,j) + w = w + L(2,j) * (L(2,j)-1) * Y(1)**L(1,j) * Y(2)**(L(2,j)-2) * Y(3)**L(3,j) end if if (L(3,j) > 1) then - w = w + L(3,j) * (L(3,j)-1) * Y(1)**L(1,j) * Y(2)**L(2,j) * Y(3)**(L(3,j)-2) + w = w + L(3,j) * (L(3,j)-1) * Y(1)**L(1,j) * Y(2)**L(2,j) * Y(3)**(L(3,j)-2) end if if (dabs(1.d0 - VGL(5,j) / w) > epsilon ) return end do @@ -1213,12 +1135,12 @@ munit_assert_int(0, ==, test_qmckl_ao_polynomial_vgl(context));
3 Radial part
+3 Radial part
3.1 Gaussian basis functions
+3.1 Gaussian basis functions
qmckl_ao_gaussian_vgl
computes the values, gradients and
@@ -1450,21 +1372,20 @@ Requirements
3.2 TODO Slater basis functions
+3.2 TODO Slater basis functions
3.3 TODO Radial functions on a grid
+3.3 TODO Radial functions on a grid
4 Combining radial and polynomial parts
+4 Combining radial and polynomial parts
Context
Table of Contents
1 Context handling
+1 Context handling
The context variable is a handle for the state of the library,
@@ -338,7 +260,7 @@ A value of QMCKL_NULL_CONTEXT
for the context is equivalent to a
typedef int64_t qmckl_context ; +typedef int64_t qmckl_context ; #define QMCKL_NULL_CONTEXT (qmckl_context) 0
ctx
is a qmckl_context_struct*
pointer.
1.1 Data structure
+1.1 Data structure
The context keeps a ``date'' that allows to check which data needs @@ -367,7 +289,7 @@ coordinates are updated.
When a new element is added to the context, the functions -qmcklcontextcreate, qmcklcontextdestroy and qmcklcontextcopy +qmcklcontextcreate, qmcklcontextdestroy and qmcklcontextcopy should be updated inorder to make deep copies.
@@ -416,8 +338,8 @@ if the context is valid,QMCKL_NULL_CONTEXT
otherwise.
1.2 Creation
+1.2 Creation
To create a new context, qmckl_context_create()
should be used.
@@ -447,7 +369,7 @@ To create a new context, qmckl_context_create()
should be used.
pthread_mutexattr_t attr;
int rc;
- rc = pthread_mutexattr_init(&attr);
+ rc = pthread_mutexattr_init(&attr);
assert (rc == 0);
(void) pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
@@ -456,7 +378,7 @@ To create a new context, qmckl_context_create()
should be used.
assert (rc == 0);
(void) pthread_mutexattr_destroy(&attr);
- }
+ }
/* Initialize data */
ctx->tag = VALID_TAG;
@@ -476,7 +398,7 @@ To create a new context, qmckl_context_create()
should be used.
qmckl_memory_info_struct * new_array = calloc(size, sizeof(qmckl_memory_info_struct));
if (new_array == NULL) {
free(ctx);
- return QMCKL_NULL_CONTEXT;
+ return QMCKL_NULL_CONTEXT;
}
memset( &(new_array[0]), 0, size * sizeof(qmckl_memory_info_struct) );
@@ -491,8 +413,8 @@ To create a new context, qmckl_context_create()
should be used.
1.3 Locking
+1.3 Locking
For thread safety, the context may be locked/unlocked. The lock is @@ -537,8 +459,8 @@ number of times the thread has locked it is saved in the
1.4 TODO Copy
+1.4 TODO Copy
qmckl_context_copy
makes a deep copy of a context. It returns
@@ -569,8 +491,8 @@ number of times the thread has locked it is saved in the
return QMCKL_NULL_CONTEXT;
}
- * Copy the old context on the new one *
- * TODO Deep copies should be done here *
+ * Copy the old context on the new one *
+ * TODO Deep copies should be done here *
memcpy(new_ctx, old_ctx, sizeof(qmckl_context_struct));
qmckl_unlock( (qmckl_context) new_ctx );
@@ -586,8 +508,8 @@ number of times the thread has locked it is saved in the
1.5 Destroy
+1.5 Destroy
The context is destroyed with qmckl_context_destroy
, leaving the ancestors untouched.
@@ -640,8 +562,7 @@ It frees the context, and returns the previous context.
Inter-particle distances
Table of Contents
-
-
- 1. Squared distance +
- 1. Squared distance -
- 2. Distance +
- 2. Distance @@ -361,12 +283,12 @@ for the JavaScript code in this tag.
1 Squared distance
+1 Squared distance
1.1 qmckl_distance_sq
+1.1 qmckl_distance_sq
qmckl_distance_sq
computes the matrix of the squared distances
@@ -379,7 +301,7 @@ between all pairs of points in two sets, one point within each set:
\]
1.1.1 Requirements
+1.1.1 Requirements
context
is notQMCKL_NULL_CONTEXT
@@ -491,8 +413,8 @@ between all pairs of points in two sets, one point within each set:
1.1.2 C header
+1.1.2 C header
qmckl_exit_code qmckl_distance ( @@ -512,8 +434,8 @@ between all pairs of points in two sets, one point within each set:
1.1.3 Source
+1.1.3 Source
integer function qmckl_distance_sq_f(context, transa, transb, m, n, & @@ -570,7 +492,7 @@ between all pairs of points in two sets, one point within each set: if (transab < 0) then info = QMCKL_INVALID_ARG_1 - return + return endif if (iand(transab,1) == 0 .and. LDA < 3) then @@ -648,8 +570,8 @@ between all pairs of points in two sets, one point within each set:
1.1.4 Performance
+1.1.4 Performance
This function might be more efficient when A
and B
are
@@ -659,12 +581,12 @@ transposed.
2 Distance
+2 Distance
2.1 qmckl_distance
+2.1 qmckl_distance
qmckl_distance
computes the matrix of the distances between all
@@ -677,7 +599,7 @@ pairs of points in two sets, one point within each set:
\]
2.1.1 Requirements
+2.1.1 Requirements
context
is notQMCKL_NULL_CONTEXT
@@ -789,8 +711,8 @@ pairs of points in two sets, one point within each set:
2.1.2 C header
+2.1.2 C header
qmckl_exit_code qmckl_distance ( @@ -810,8 +732,8 @@ pairs of points in two sets, one point within each set:
2.1.3 Source
+2.1.3 Source
integer function qmckl_distance_f(context, transa, transb, m, n, & @@ -868,7 +790,7 @@ pairs of points in two sets, one point within each set: if (transab < 0) then info = QMCKL_INVALID_ARG_1 - return + return endif if (iand(transab,1) == 0 .and. LDA < 3) then @@ -950,8 +872,8 @@ pairs of points in two sets, one point within each set:
2.1.4 Performance
+2.1.4 Performance
This function might be more efficient when A
and B
are
@@ -963,8 +885,7 @@ transposed.
Electrons
Table of Contents
-
-
- 1. Context +
- 1. Context -
- 2. Computation +
- 2. Computation @@ -334,8 +256,8 @@ for the JavaScript code in this tag.
1 Context
+1 Context
The following data stored in the context: @@ -421,8 +343,8 @@ The following data stored in the context:
1.1 Data structure
+1.1 Data structure
typedef struct qmckl_electron_struct {
@@ -450,8 +372,8 @@ struct is then initialized and provided == true
.
1.2 Access functions
+1.2 Access functions
When all the data relative to electrons have been set, the
@@ -465,8 +387,8 @@ following function returns true
.
1.3 Initialization functions
+1.3 Initialization functions
To set the data relative to the electrons in the context, the @@ -496,8 +418,8 @@ electrons have been set.
1.4 Test
+1.4 Test
/* Reference input data */ @@ -508,7 +430,7 @@ electrons have been set. #define num (up_num+down_num) double coord[walk_num*3*num] = - { 7.303633091022677881e+00, 1.375868694453235719e+01, 1.167371490471771217e-01, + { 7.303633091022677881e+00, 1.375868694453235719e+01, 1.167371490471771217e-01, 4.547755371567960836e+00, 3.245907105524011182e+00, 2.410764357550297110e-01, 5.932816068137344523e+00, 1.491671465549257469e+01, 3.825374039119375236e-01, 7.347336142660052083e+00, 1.341946976062362129e+00, 1.648917914228352322e+00, @@ -542,8 +464,8 @@ rc = qmckl_set_electron_coord (context, coord);
2 Computation
+2 Computation
The computed data is stored in the context so that it can be reused @@ -556,12 +478,12 @@ current date is stored.
2.1 Electron-electron distances
+2.1 Electron-electron distances
2.1.1 Get
+2.1.1 Get
qmckl_exit_code qmckl_get_electron_ee_distance(qmckl_context context, double* distance); @@ -570,10 +492,10 @@ current date is stored.
2.1.2 Compute
+2.1.2 Compute
Macro | -Code | -Description | -
---|---|---|
QMCKL_SUCCESS |
-0 | -'Success' | -
QMCKL_INVALID_ARG_1 |
-1 | -'Invalid argument 1' | -
QMCKL_INVALID_ARG_2 |
-2 | -'Invalid argument 2' | -
QMCKL_INVALID_ARG_3 |
-3 | -'Invalid argument 3' | -
QMCKL_INVALID_ARG_4 |
-4 | -'Invalid argument 4' | -
QMCKL_INVALID_ARG_5 |
-5 | -'Invalid argument 5' | -
QMCKL_INVALID_ARG_6 |
-6 | -'Invalid argument 6' | -
QMCKL_INVALID_ARG_7 |
-7 | -'Invalid argument 7' | -
QMCKL_INVALID_ARG_8 |
-8 | -'Invalid argument 8' | -
QMCKL_INVALID_ARG_9 |
-9 | -'Invalid argument 9' | -
QMCKL_INVALID_ARG_10 |
-10 | -'Invalid argument 10' | -
QMCKL_FAILURE |
-101 | -'Failure' | -
QMCKL_ERRNO |
-102 | -strerror(errno) | -
QMCKL_INVALID_CONTEXT |
-103 | -'Invalid context' | -
QMCKL_ALLOCATION_FAILED |
-104 | -'Allocation failed' | -
QMCKL_DEALLOCATION_FAILED |
-105 | -'De-allocation failed' | -
QMCKL_INVALID_EXIT_CODE |
-106 | -'Invalid exit code' | -
-The qmckl_string_of_error
converts an exit code into a string. The
-string is assumed to be large enough to contain the error message
-(typically 128 characters).
-
1 Decoding errors
+1 Decoding errors
To decode the error messages, qmckl_string_of_error
converts an
-error code into a string.
+error code into a string.
@@ -575,8 +336,8 @@ The text strings are extracted from the previous table.
2 Data structure in context
+2 Data structure in context
The strings are declared with a maximum fixed size to avoid @@ -599,8 +360,8 @@ dynamic memory allocation.
3 Updating errors in the context
+3 Updating errors in the context
The error is updated in the context using qmckl_set_error
.
@@ -646,8 +407,8 @@ explaining the error. The exit code can't be QMCKL_SUCCESS
.
4 Failing
+4 Failing
To make a function fail, the qmckl_failwith
function should be
@@ -678,11 +439,11 @@ Upon failure, a QMCKL_NULL_CONTEXT
is returned.
return QMCKL_INVALID_CONTEXT;
if (message == NULL) {
- qmckl_exit_code rc =
+ qmckl_exit_code rc =
qmckl_set_error(context, exit_code, function, qmckl_string_of_error(exit_code));
assert (rc == QMCKL_SUCCESS);
} else {
- qmckl_exit_code rc =
+ qmckl_exit_code rc =
qmckl_set_error(context, exit_code, function, message);
assert (rc == QMCKL_SUCCESS);
}
@@ -700,7 +461,7 @@ For example, this function can be used as
if (x < 0) { return qmckl_failwith(context, QMCKL_INVALID_ARG_2, - "qmckl_function", + "qmckl_function", "Expected x >= 0"); }@@ -709,8 +470,7 @@ For example, this function can be used as
Memory management
Table of Contents
1 Memory data structure for the context
+1 Memory data structure for the context
Every time a new block of memory is allocated, the information
relative to the allocation is stored in a new qmckl_memory_info_struct
.
-A qmckl_memory_info_struct
contains the pointer to the memory block,
+A qmckl_memory_info_struct
contains the pointer to the memory block,
its size in bytes, and extra implementation-specific information such as
alignment, pinning, if the memory should be allocated on CPU or GPU
etc.
@@ -361,8 +283,8 @@ array, and the number of allocated blocks.
2 Passing info to allocation routines
+2 Passing info to allocation routines
Passing information to the allocation routine should be done by
@@ -371,8 +293,8 @@ passing an instance of a qmckl_memory_info_struct
.
3 Allocation/deallocation functions
+3 Allocation/deallocation functions
Memory allocation inside the library should be done with
@@ -446,7 +368,7 @@ If the allocation failed, the NULL
pointer is returned.
/* Create a context */ -qmckl_context context = qmckl_context_create(); +qmckl_context context = qmckl_context_create(); qmckl_memory_info_struct info = qmckl_memory_info_struct_zero; info.size = (size_t) 3; @@ -534,8 +456,7 @@ allocation and needs to be updated.
Numerical precision
Table of Contents
1 Control of the numerical precision
+1 Control of the numerical precision
Controlling numerical precision enables optimizations. Here, the @@ -353,7 +275,7 @@ Arithmetic (IEEE 754), refers to the number of exponent bits.
-#define QMCKL_DEFAULT_PRECISION 53 +#define QMCKL_DEFAULT_RANGE 11 ++
typedef struct qmckl_numprec_struct {
uint32_t precision;
@@ -397,8 +325,8 @@ integer. The update functions return QMCKL_SUCCESS
or
2 Precision
+2 Precision
qmckl_context_set_numprec_precision
modifies the parameter for the
@@ -485,8 +413,8 @@ numerical precision in the context.
3 Range
+3 Range
qmckl_set_numprec_range
modifies the parameter for the numerical
@@ -561,8 +489,8 @@ range in a given context.
4 Helper functions
+4 Helper functions
qmckl_get_numprec_epsilon
returns \(\epsilon = 2^{1-n}\) where n
is the precision.
@@ -580,8 +508,7 @@ We need to remove the sign bit from the precision.