37#include <sys/utsname.h>
49 if (
sizeof(stype) ==
sizeof(
float) ) {
50 format = std::string(
"IEEE32BIG");
52 if (
sizeof(stype) ==
sizeof(
double) ) {
53 format = std::string(
"IEEE64BIG");
70 std::vector<int>, dimension,
71 std::vector<std::string>, boundary,
73 std::string, hdr_version,
74 std::string, storage_format,
78 uint32_t, scidac_checksuma,
79 uint32_t, scidac_checksumb,
80 unsigned int, sequence_number,
81 std::string, data_type,
82 std::string, ensemble_id,
83 std::string, ensemble_label,
84 std::string, ildg_lfn,
86 std::string, creator_hardware,
87 std::string, creation_date,
88 std::string, archive_date,
89 std::string, floating_point);
94 : nd(4), dimension(4,0), boundary(4,
""), data_start(0),
95 link_trace(0.), plaquette(0.), checksum(0),
96 scidac_checksuma(0), scidac_checksumb(0), sequence_number(0)
111 header.dimension.resize(nd);
112 header.boundary.resize(nd);
114 for(
int d=0;d<nd;d++) {
117 for(
int d=0;d<nd;d++) {
118 header.boundary[d] = std::string(
"PERIODIC");
125 struct passwd *pw = getpwuid (getuid());
126 if (pw)
header.creator = std::string(pw->pw_name);
129 std::time_t t = std::time(
nullptr);
130 std::tm tm_ = *std::localtime(&t);
131 std::ostringstream oss;
132 oss << std::put_time(&tm_,
"%c %Z");
133 header.creation_date = oss.str();
137 struct utsname name; uname(&name);
138 header.creator_hardware = std::string(name.nodename)+
"-";
139 header.creator_hardware+= std::string(name.machine)+
"-";
140 header.creator_hardware+= std::string(name.sysname)+
"-";
141 header.creator_hardware+= std::string(name.release);
144#define dump_meta_data(field, s) \
145 s << "BEGIN_HEADER" << std::endl; \
146 s << "HDR_VERSION = " << field.hdr_version << std::endl; \
147 s << "DATATYPE = " << field.data_type << std::endl; \
148 s << "STORAGE_FORMAT = " << field.storage_format << std::endl; \
149 for(int i=0;i<4;i++){ \
150 s << "DIMENSION_" << i+1 << " = " << field.dimension[i] << std::endl ; \
152 s << "LINK_TRACE = " << std::setprecision(10) << field.link_trace << std::endl; \
153 s << "PLAQUETTE = " << std::setprecision(10) << field.plaquette << std::endl; \
154 for(int i=0;i<4;i++){ \
155 s << "BOUNDARY_"<<i+1<<" = " << field.boundary[i] << std::endl; \
158 s << "CHECKSUM = "<< std::hex << std::setw(10) << field.checksum << std::dec<<std::endl; \
159 s << "SCIDAC_CHECKSUMA = "<< std::hex << std::setw(10) << field.scidac_checksuma << std::dec<<std::endl; \
160 s << "SCIDAC_CHECKSUMB = "<< std::hex << std::setw(10) << field.scidac_checksumb << std::dec<<std::endl; \
161 s << "ENSEMBLE_ID = " << field.ensemble_id << std::endl; \
162 s << "ENSEMBLE_LABEL = " << field.ensemble_label << std::endl; \
163 s << "SEQUENCE_NUMBER = " << field.sequence_number << std::endl; \
164 s << "CREATOR = " << field.creator << std::endl; \
165 s << "CREATOR_HARDWARE = "<< field.creator_hardware << std::endl; \
166 s << "CREATION_DATE = " << field.creation_date << std::endl; \
167 s << "ARCHIVE_DATE = " << field.archive_date << std::endl; \
168 s << "FLOATING_POINT = " << field.floating_point << std::endl; \
169 s << "END_HEADER" << std::endl;
175 header.floating_point = format;
196 header.floating_point = format;
208 for(
int mu=0;mu<
Nd;mu++){
210 cm(mu)()(1,0) = -
adj(cm(mu)()(0,y)) ;
211 cm(mu)()(1,1) =
adj(cm(mu)()(0,x)) ;
213 const int x=0 , y=1 , z=2 ;
214 cm(mu)()(2,x) =
adj(cm(mu)()(0,y)*cm(mu)()(1,z)-cm(mu)()(0,z)*cm(mu)()(1,y));
215 cm(mu)()(2,y) =
adj(cm(mu)()(0,z)*cm(mu)()(1,x)-cm(mu)()(0,x)*cm(mu)()(1,z));
216 cm(mu)()(2,z) =
adj(cm(mu)()(0,x)*cm(mu)()(1,y)-cm(mu)()(0,y)*cm(mu)()(1,x));
236 for(
int mu=0; mu<
Nd; mu++) {
239 for(
int k=0; k<
Nc; k++) {
240 for(
int i=0; i<
Nc-1; i++) {
241 for(
int j=0; j<
Nc-1; j++) {
242 int J = (j<k) ? j : j+1;
243 Su()()(i,j) =
SU()()(i,J);
259 std::vector<int> a(n,0);
262 for(
int j=0; j<n; j++) {
295 std::vector<int> indices(
Nc);
296 std::iota(indices.begin(), indices.end(), 0);
298 for(
int mu=0; mu<
Nd; mu++) {
299 for(
int k=0; k<
Nc; k++) {
300 std::vector<int> cols = indices;
301 cols.erase(cols.begin()+k);
302 cm(mu)()(
Nc-1,k) = 0;
307 std::vector<int>
perm = cols;
308 perm.emplace_back(k);
310 for(
int i=0;i<
Nc-1;i++) {
311 prod *= cm(mu)()(i,cols[i]) ;
316 while (std::next_permutation(cols.begin(), cols.end()));
336 for(
int mu=0;mu<
Nd;mu++){
337 for(
int i=0;i<N;i++){
338 for(
int j=0;j<N;j++){
339 cm(mu)()(i+N,j) = -
adj( cm(mu)()(i,j+N) );
340 cm(mu)()(i+N,j+N) =
adj( cm(mu)()(i,j) );
361template <
class fobj,
class sobj>
370 size_t fobj_words =
sizeof(out) /
sizeof(
fobj_stype);
371 size_t sobj_words =
sizeof(in) /
sizeof(
sobj_stype);
372 assert(fobj_words == sobj_words);
374 for (
unsigned int word = 0; word < sobj_words; word++)
375 out_buffer[word] = in_buffer[word];
380template <
class fobj,
class sobj>
389 size_t fobj_words =
sizeof(in) /
sizeof(
fobj_stype);
390 size_t sobj_words =
sizeof(out) /
sizeof(
sobj_stype);
391 assert(fobj_words == sobj_words);
393 for (
unsigned int word = 0; word < sobj_words; word++)
394 out_buffer[word] = in_buffer[word];
400template<
class fobj,
class sobj>
403 for (
int mu = 0; mu <
Nd; mu++) {
404 for (
int i = 0; i <
Nc; i++) {
405 for (
int j = 0; j <
Nc; j++) {
406 out(mu)()(i, j) = in(mu)()(i, j);
412template <
class fobj,
class sobj>
415 for (
int mu = 0; mu <
Nd; mu++) {
416 for (
int i = 0; i <
Nc; i++) {
417 for (
int j = 0; j <
Nc; j++) {
418 out(mu)()(i, j) = in(mu)()(i, j);
424template<
class fobj,
class sobj>
427 for (
int mu = 0; mu <
Nds; mu++) {
428 for (
int i = 0; i <
Nc; i++) {
429 for (
int j = 0; j <
Nc; j++) {
430 out(mu)()(i, j) = in(mu)()(i, j);
436template <
class fobj,
class sobj>
439 for (
int mu = 0; mu <
Nds; mu++) {
440 for (
int i = 0; i <
Nc; i++) {
441 for (
int j = 0; j <
Nc; j++) {
442 out(mu)()(i, j) = in(mu)()(i, j);
448template<
class fobj,
class sobj>
451 for(
int mu=0;mu<
Nd;mu++){
452 for(
int i=0;i<
Nc-1;i++){
453 for(
int j=0;j<
Nc;j++){
454 out(mu)()(i,j) = in(mu)(i)(j);
461template<
class fobj,
class sobj>
464 for(
int mu=0;mu<
Nd;mu++){
465 for(
int i=0;i<
Nc-1;i++){
466 for(
int j=0;j<
Nc;j++){
467 out(mu)(i)(j) = in(mu)()(i,j);
473template<
class fobj,
class sobj,
bool unique_su>
478template<
class fobj,
class sobj>
480 void operator() (fobj &in,sobj &out){
481 for(
int mu=0;mu<
Nd;mu++){
482 for(
int i=0;i<
Nc-1;i++){
483 for(
int j=0;j<
Nc;j++){
484 out(mu)()(i,j) = in(mu)(i)(j);
492template<
class fobj,
class sobj>
494 void operator() (fobj &in,sobj &out){
495 for(
int mu=0;mu<
Nd;mu++){
496 for(
int i=0;i<
Nc-1;i++){
497 for(
int j=0;j<
Nc;j++){
498 out(mu)()(i,j) = in(mu)(i)(j);
507template<
class fobj,
class sobj>
510 for(
int mu=0;mu<
Nd;mu++){
511 for(
int i=0;i<
Nc-1;i++){
512 for(
int j=0;j<
Nc;j++){
513 out(mu)(i)(j) = in(mu)()(i,j);
520template<
class fobj,
class sobj>
523 for(
int mu=0;mu<
Nd;mu++){
524 for(
int i=0;i<
Nc/2;i++){
525 for(
int j=0;j<
Nc;j++){
526 out(mu)()(i,j) = in(mu)(i)(j);
535template<
class fobj,
class sobj>
538 for(
int mu=0;mu<
Nd;mu++){
539 for(
int i=0;i<
Nc/2;i++){
540 for(
int j=0;j<
Nc;j++){
541 out(mu)(i)(j) = in(mu)()(i,j);
563template<
class vobj,
class group_name, MatrixFormat m_fmt, FloatingPo
intFormat fp_fmt>
567template<
class vobj,
class group_name, FloatingPo
intFormat fp_fmt>
571 using out_type =
typename std::tuple_element_t<static_cast<int>(fp_fmt), std::tuple<LorentzColourMatrixD,LorentzColourMatrixF>>;
580template<
class vobj, FloatingPo
intFormat fp_fmt>
584 using tmp_type =
typename std::tuple_element_t<static_cast<int>(fp_fmt), std::tuple<LorentzColourMatrixD,LorentzColourMatrixF>>;
585 using out_type =
typename std::tuple_element_t<static_cast<int>(fp_fmt), std::tuple<LorentzColour2x3D,LorentzColour2x3F>>;
598template<
class vobj, FloatingPo
intFormat fp_fmt>
602 using tmp_type =
typename std::tuple_element_t<static_cast<int>(fp_fmt), std::tuple<LorentzColourMatrixD,LorentzColourMatrixF>>;
603 using out_type =
typename std::tuple_element_t<static_cast<int>(fp_fmt), std::tuple<LorentzColourNx2ND,LorentzColourNx2NF>>;
GaugeGroup< ncolour, GroupName::SU > SU
GaugeGroup< ncolour, GroupName::Sp > Sp
Lattice< vobj > conjugate(const Lattice< vobj > &lhs)
Lattice< vobj > adj(const Lattice< vobj > &lhs)
RealD norm2(const Lattice< vobj > &arg)
Lattice< iScalar< iScalar< iScalar< Vec > > > > Determinant(const Lattice< iScalar< iScalar< iMatrix< Vec, N > > > > &Umu)
#define NAMESPACE_BEGIN(A)
iColourMatrix< Complex > ColourMatrix
iLorentzColourMatrix< Complex > LorentzColourMatrix
std::complex< RealD > ComplexD
std::complex< Real > Complex
accelerator_inline void pokeIndex(vtype &ret, const decltype(TensorIndexRecursion< Level >::peekIndex(ret, 0)) &arg, int i)
accelerator_inline auto peekIndex(const vtype &arg, int i) -> RemoveCRV(TensorIndexRecursion< Level >::peekIndex(arg, 0))
unsigned long _ndimension
GRID_SERIALIZABLE_CLASS_MEMBERS(FieldMetaData, int, nd, std::vector< int >, dimension, std::vector< std::string >, boundary, int, data_start, std::string, hdr_version, std::string, storage_format, double, link_trace, double, plaquette, uint32_t, checksum, uint32_t, scidac_checksuma, uint32_t, scidac_checksumb, unsigned int, sequence_number, std::string, data_type, std::string, ensemble_id, std::string, ensemble_label, std::string, ildg_lfn, std::string, creator, std::string, creator_hardware, std::string, creation_date, std::string, archive_date, std::string, floating_point)
void operator()(Lattice< vLorentzColourMatrixD > &data, FieldMetaData &header)
GridBase * Grid(void) const
static RealD avgPlaquette(const GaugeLorentz &Umu)
static RealD linkTrace(const GaugeLorentz &Umu)
GridTypeMapper< scalar_type >::Realified real_scalar_type
void operator()(fobj &in, sobj &out)
getPrecision< sobj >::real_scalar_type sobj_stype
getPrecision< fobj >::real_scalar_type fobj_stype
getPrecision< sobj >::real_scalar_type sobj_stype
void operator()(sobj &in, fobj &out)
getPrecision< fobj >::real_scalar_type fobj_stype
void operator()(fobj &in, sobj &out)
void operator()(sobj &in, fobj &out)
void operator()(fobj &in, sobj &out)
void operator()(sobj &in, fobj &out)
void operator()(sobj &in, fobj &out)
void operator()(fobj &in, sobj &out)
void operator()(sobj &in, fobj &out)
void operator()(fobj &in, sobj &out)
void operator()(sobj &in, fobj &out)