HILA
Loading...
Searching...
No Matches
suN_gauge_minmax_test/src/minmax.cpp
1#include "hila.h"
2
3#include <random>
4
5
6static_assert(NDIM == 4, "NDIM must be 4 here");
7
8using ftype=float;
10
11int main(int argc, char *argv[]) {
12
13 // initialize system
14 hila::initialize(argc,argv);
15
16 int lsize=12;
17
18 lattice.setup({lsize, lsize, lsize, lsize});
19
20 // Random numbers are used here - use time to seed
22
23 // lattice field
24 mygroup S=0;
25 S.random();
27 Field<ftype> maxabsU;
28 foralldir(d) {
29 onsites(ALL) U[d][X]=S;
30
31 U[d][{(int)d,1,1,1}]=1.0;
32 }
33
34 ftype val1,val2,val3,val4,val5,val6;
35 CoordinateVector loc1, loc2, loc3, loc4, loc5, loc6;
36 foralldir(d) {
37 onsites(ALL) maxabsU[X]=U[d][X].max_abs();
38
39 val1=maxabsU.min(ODD, loc1);
40 val2=maxabsU.min(EVEN,loc2);
41 val3=maxabsU.max(ODD, loc3);
42 val4=maxabsU.max(EVEN,loc4);
43 val5=maxabsU.min(ALL, loc5);
44 val6=maxabsU.max(ALL, loc6);
45
46 hila::out0<<"dir "<<(int)d<<":\n";
47 hila::out0<<"Min value of ODD sites "<<val1<<" at location: "<<loc1<<'\n';
48 hila::out0<<"Min value of EVEN sites "<<val2<<" at location: "<<loc2<<'\n';
49 hila::out0<<"Max value of ODD sites "<<val3<<" at location: "<<loc3<<'\n';
50 hila::out0<<"Max value of EVEN sites "<<val4<<" at location: "<<loc4<<'\n';
51 hila::out0<<"Min value of ALL sites "<<val5<<" at location: "<<loc5<<'\n';
52 hila::out0<<"Max value of ALL sites "<<val6<<" at location: "<<loc6<<'\n';
53 hila::out0<<"\n\n";
54
55 }
56
57
58
59 //hila::out0 << "Reduction test " << reduced << "\n";
61 return 0;
62}
The field class implements the standard methods for accessing Fields. Hilapp replaces the parity acce...
Definition field.h:61
T max(Parity par=ALL) const
Find maximum value from Field.
Definition reduction.h:424
T min(Parity par=ALL) const
Find minimum value from Field.
Definition reduction.h:404
Gauge field class.
Definition gaugefield.h:22
Class for SU(N) matrix.
Definition sun_matrix.h:110
const SU & random(int nhits=16)
Generate random SU(N) matrix.
Definition sun_matrix.h:211
void setup(const CoordinateVector &siz)
General lattice setup.
Definition lattice.cpp:33
constexpr Parity EVEN
bit pattern: 001
#define foralldir(d)
Macro to loop over (all) Direction(s)
Definition coordinates.h:78
constexpr Parity ODD
bit pattern: 010
constexpr Parity ALL
bit pattern: 011
std::ostream out0
This writes output only from main process (node 0)
void initialize(int argc, char **argv)
Read in command line arguments. Initialise default stream and MPI communication.
void seed_random(uint64_t seed, bool device_rng=true)
Seed random generators with 64-bit unsigned value. On MPI shuffles the seed so that different MPI ran...
Definition random.cpp:86
void finishrun()
Normal, controlled exit - all nodes must call this. Prints timing information and information about c...