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 Field<T> f;
32 onsites(ALL) f[X] = 0;
33 onsites(ALL) if (X.coordinate(e_x) == 0) f[X] = 0;
34}
35
36#endif
37#endif
The field class implements the standard methods for accessing Fields. Hilapp replaces the parity acce...
Definition field.h:61
constexpr Parity ALL
bit pattern: 011
This files containts definitions for the Field class and the classes required to define it such as fi...