HILA
Loading...
Searching...
No Matches
ensure_loop_functions.h
1#ifndef ENSURE_LOOP_FUNCTIONS
2#define ENSURE_LOOP_FUNCTIONS
3
4#ifdef HILAPP
5
6#include "field.h"
7
8// This file contains dummy functions, the purpose of which is just to
9// excercise hilapp code generation for specific loop functions. This is
10// needed because calls to these functions may be generated by hilapp and it's easier to let
11// generic code generation handle this.
12//
13// For vectorized code generation, include loops without and with coordinate dependent if
14//
15// These can be called only by hilapp, so insert calls within #ifdef HILAPP .. #endif
16//
17// call these as e.g. "ensure_unary_minus_is_loop_function<T>();"
18
19
20template <typename T>
21void ensure_unary_minus_is_loop_function() {
22 if constexpr (hila::has_unary_minus<T>::value) {
23 Field<T> f;
24 onsites(ALL) f[X] = -f[X];
25 onsites(ALL) if (X.coordinate(e_x) == 0) f[X] = -f[X];
26 }
27}
28
29template <typename T>
30void ensure_assign_zero_is_loop_function() {
31 if constexpr (hila::has_assign_zero<T>::value) {
32 Field<T> f;
33 onsites(ALL) f[X] = 0;
34 onsites(ALL) if (X.coordinate(e_x) == 0) f[X] = 0;
35 }
36}
37
38#endif
39#endif
The field class implements the standard methods for accessing Fields. Hilapp replaces the parity acce...
Definition field.h:61
hila::has_assign_zero<T>::value returns true if '= 0 is defined for T
Conditionally reture bool type false if type T does't have unary - operator.
constexpr Parity ALL
bit pattern: 011
This files containts definitions for the Field class and the classes required to define it such as fi...