SpinParser  1.0
TRIVertexTwoParticle.hpp
Go to the documentation of this file.
1 
9 #pragma once
10 #include <istream>
11 #include "lib/ValueBundle.hpp"
12 #include "lib/Assert.hpp"
13 #include "FrgCommon.hpp"
14 
24 template <int size> struct TRIVertexTwoParticleAccessBuffer
25 {
26 public:
31  {
32  for (int i = 0; i < 16 * size; ++i) (&sign[0][0][0])[i] = 1.0f;
33  }
34 
35  int frequencyOffsets[size];
36  float frequencyWeights[size];
37  float sign[size][4][4];
38  bool pairExchange;
39 };
40 
45 {
46 public:
50  enum struct FrequencyChannel
51  {
52  S,
53  T,
54  U,
55  All,
56  None
57  };
58 
63  {
64  //store width in all memory dimensions
66  _memoryStep[2] = 4 * _memoryStep[3];
67  _memoryStep[1] = 4 * _memoryStep[2];
69 
72 
73  //alloc and init memory
74  _data = new float[size];
75  memset(_data, 0, sizeof(float) * size);
76  }
77 
82  {
83  delete[] _data;
84  }
85 
97  void expandIterator(int iterator, LatticeIterator &i1, float &s, float &t, float &u, SpinComponent &s1, SpinComponent &s2) const
98  {
99  ASSERT(iterator >= 0 && iterator < size);
100  ASSERT(&s != &t);
101  ASSERT(&t != &u);
102  ASSERT(&s != &u);
103  ASSERT(&s1 != &s2);
104 
105  int it = iterator;
106 
107  int su = it / _memoryStep[0];
108  it = it % _memoryStep[0];
109  t = FrgCommon::frequency()._data[it / _memoryStep[1]];
110  it = it % _memoryStep[1];
111  s1 = static_cast<SpinComponent>(it / _memoryStep[2]);
112  it = it % _memoryStep[2];
113  s2 = static_cast<SpinComponent>(it / _memoryStep[3]);
114  it = it % _memoryStep[3];
116 
117  for (int so = 0; so <= su; ++so)
118  {
119  for (int uo = 0; uo <= so; ++uo)
120  {
121  if (su == so * (so + 1) / 2 + uo)
122  {
123  s = FrgCommon::frequency()._data[so];
124  u = FrgCommon::frequency()._data[uo];
125  return;
126  }
127  }
128  }
129  }
130 
139  void expandIterator(int iterator, float &s, float &t, float &u) const
140  {
141  ASSERT(iterator >= 0 && iterator < sizeFrequency);
142  ASSERT(iterator >= 0 && iterator < size);
143  ASSERT(&s != &t);
144  ASSERT(&t != &u);
145  ASSERT(&s != &u);
146 
147  int su = iterator / FrgCommon::frequency().size;
149 
150  for (int so = 0; so <= su; ++so)
151  {
152  for (int uo = 0; uo <= so; ++uo)
153  {
154  if (su == so * (so + 1) / 2 + uo)
155  {
156  s = FrgCommon::frequency()._data[so];
157  u = FrgCommon::frequency()._data[uo];
158  return;
159  }
160  }
161  }
162  }
163 
170  float &getValueRef(const int iterator) const
171  {
172  ASSERT(iterator >= 0 && iterator < size);
173 
174  return _data[iterator];
175  }
176 
190  float getValue(LatticeIterator i1, LatticeIterator i2, float s, float t, float u, SpinComponent s1, SpinComponent s2, const FrequencyChannel channel) const
191  {
192  ASSERT(channel == FrequencyChannel::S || channel == FrequencyChannel::T || channel == FrequencyChannel::U || channel == FrequencyChannel::None || channel == FrequencyChannel::All);
193 
194  //map to positive frequency sector
195  float sign = 1.0f;
196  if (s < 0)
197  {
198  s = -s;
199  std::swap(s1, s2);
200  std::swap(i1, i2);
201  }
202  if (t < 0)
203  {
204  t = -t;
205  sign *= _zeta(static_cast<int>(s1)) *_zeta(static_cast<int>(s2));
206  }
207  if (u < 0)
208  {
209  u = -u;
210  std::swap(s1, s2);
211  std::swap(i1, i2);
212  sign *= _zeta(static_cast<int>(s1)) *_zeta(static_cast<int>(s2));
213  }
214 
215  int siteOffset = FrgCommon::lattice().symmetryTransform(i1, i2, s1, s2);
216 
217  if (channel == FrequencyChannel::S)
218  {
219  int exactS = FrgCommon::frequency().offset(s);
220 
221  int lowerT, upperT;
222  float biasT;
223  int lowerU, upperU;
224  float biasU;
225 
226  FrgCommon::frequency().interpolateOffset(t, lowerT, upperT, biasT);
227  FrgCommon::frequency().interpolateOffset(u, lowerU, upperU, biasU);
228 
229  return sign * (
230  (1 - biasU) * (
231  (1 - biasT) * (_directAccessMapFrequencyExchange(siteOffset, exactS, lowerT, lowerU, s1, s2)) + biasT * (_directAccessMapFrequencyExchange(siteOffset, exactS, upperT, lowerU, s1, s2))
232  ) + biasU * (
233  (1 - biasT) * (_directAccessMapFrequencyExchange(siteOffset, exactS, lowerT, upperU, s1, s2)) + biasT * (_directAccessMapFrequencyExchange(siteOffset, exactS, upperT, upperU, s1, s2))
234  ));
235  }
236  else if (channel == FrequencyChannel::T)
237  {
238  int exactT = FrgCommon::frequency().offset(t);
239 
240  int lowerS, upperS;
241  float biasS;
242  int lowerU, upperU;
243  float biasU;
244 
245  FrgCommon::frequency().interpolateOffset(s, lowerS, upperS, biasS);
246  FrgCommon::frequency().interpolateOffset(u, lowerU, upperU, biasU);
247 
248  return sign * (
249  (1 - biasU) * (
250  (1 - biasS) * (_directAccessMapFrequencyExchange(siteOffset, lowerS, exactT, lowerU, s1, s2)) + biasS * (_directAccessMapFrequencyExchange(siteOffset, upperS, exactT, lowerU, s1, s2))
251  ) + biasU * (
252  (1 - biasS) * (_directAccessMapFrequencyExchange(siteOffset, lowerS, exactT, upperU, s1, s2)) + biasS * (_directAccessMapFrequencyExchange(siteOffset, upperS, exactT, upperU, s1, s2))
253  ));
254  }
255  else if (channel == FrequencyChannel::U)
256  {
257  int exactU = FrgCommon::frequency().offset(u);
258 
259  int lowerS, upperS;
260  float biasS;
261  int lowerT, upperT;
262  float biasT;
263 
264  FrgCommon::frequency().interpolateOffset(s, lowerS, upperS, biasS);
265  FrgCommon::frequency().interpolateOffset(t, lowerT, upperT, biasT);
266 
267  return sign * (
268  (1 - biasT) * (
269  (1 - biasS) * (_directAccessMapFrequencyExchange(siteOffset, lowerS, lowerT, exactU, s1, s2)) + biasS * (_directAccessMapFrequencyExchange(siteOffset, upperS, lowerT, exactU, s1, s2))
270  ) + biasT * (
271  (1 - biasS) * (_directAccessMapFrequencyExchange(siteOffset, lowerS, upperT, exactU, s1, s2)) + biasS * (_directAccessMapFrequencyExchange(siteOffset, upperS, upperT, exactU, s1, s2))
272  ));
273  }
274  else if (channel == FrequencyChannel::None)
275  {
276  int lowerS, upperS;
277  float biasS;
278  int lowerT, upperT;
279  float biasT;
280  int lowerU, upperU;
281  float biasU;
282 
283  FrgCommon::frequency().interpolateOffset(s, lowerS, upperS, biasS);
284  FrgCommon::frequency().interpolateOffset(t, lowerT, upperT, biasT);
285  FrgCommon::frequency().interpolateOffset(u, lowerU, upperU, biasU);
286 
287  return sign * (
288  (1 - biasU) * (
289  (1 - biasT) * (
290  (1 - biasS) * (_directAccessMapFrequencyExchange(siteOffset, lowerS, lowerT, lowerU, s1, s2)) + biasS * (_directAccessMapFrequencyExchange(siteOffset, upperS, lowerT, lowerU, s1, s2))
291  ) + biasT * (
292  (1 - biasS) * (_directAccessMapFrequencyExchange(siteOffset, lowerS, upperT, lowerU, s1, s2)) + biasS * (_directAccessMapFrequencyExchange(siteOffset, upperS, upperT, lowerU, s1, s2))
293  )
294  ) + biasU * (
295  (1 - biasT) * (
296  (1 - biasS) * (_directAccessMapFrequencyExchange(siteOffset, lowerS, lowerT, upperU, s1, s2)) + biasS * (_directAccessMapFrequencyExchange(siteOffset, upperS, lowerT, upperU, s1, s2))
297  ) + biasT * (
298  (1 - biasS) * (_directAccessMapFrequencyExchange(siteOffset, lowerS, upperT, upperU, s1, s2)) + biasS * (_directAccessMapFrequencyExchange(siteOffset, upperS, upperT, upperU, s1, s2))
299  )
300  ));
301  }
302  else if (channel == FrequencyChannel::All)
303  {
304  int exactS = FrgCommon::frequency().offset(s);
305  int exactT = FrgCommon::frequency().offset(t);
306  int exactU = FrgCommon::frequency().offset(u);
307  return sign * _directAccessMapFrequencyExchange(siteOffset, exactS, exactT, exactU, s1, s2);
308  }
309  else throw Exception(Exception::Type::ArgumentError, "Specified frequency channel does not exist");
310  }
311 
323  template <int n> float getValue(LatticeIterator i1, LatticeIterator i2, SpinComponent s1, SpinComponent s2, const TRIVertexTwoParticleAccessBuffer<n> &accessBuffer) const
324  {
325  if (accessBuffer.pairExchange)
326  {
327  std::swap(i1, i2);
328  std::swap(s1, s2);
329  }
330  int siteOffset = FrgCommon::lattice().symmetryTransform(i1, i2, s1, s2);
331  int spinOffset = (4 * static_cast<int>(s1) + static_cast<int>(s2)) *FrgCommon::lattice().size;
332 
333  float value = 0.0f;
334  for (int i = 0; i < n; ++i) value += accessBuffer.sign[i][static_cast<int>(s1)][static_cast<int>(s2)] * accessBuffer.frequencyWeights[i] * _data[accessBuffer.frequencyOffsets[i] + spinOffset + siteOffset];
335  return value;
336  }
337 
347  template <int n> float getValueLocal(SpinComponent s1, SpinComponent s2, const TRIVertexTwoParticleAccessBuffer<n> &accessBuffer) const
348  {
349  if (accessBuffer.pairExchange) std::swap(s1, s2);
350  int spinOffset = (4 * static_cast<int>(s1) + static_cast<int>(s2)) *FrgCommon::lattice().size;
351 
352  float value = 0.0f;
353  for (int i = 0; i < n; ++i) value += accessBuffer.sign[i][static_cast<int>(s1)][static_cast<int>(s2)] * accessBuffer.frequencyWeights[i] * _data[accessBuffer.frequencyOffsets[i] + spinOffset];
354  return value;
355  }
356 
364  template <int n> void getValueSuperbundle(const TRIVertexTwoParticleAccessBuffer<n> &accessBuffer, ValueSuperbundle<float, 16> &superbundle) const
365  {
366  ASSERT(superbundle.bundle(0).size() == FrgCommon::lattice().size);
367 
368  superbundle.reset();
370 
371  for (int i = 0; i < n; ++i)
372  {
373  for (int s1 = 0; s1 < 4; ++s1)
374  {
375  for (int s2 = 0; s2 < 4; ++s2)
376  {
377  for (int j = 0; j < FrgCommon::lattice().size; ++j)
378  {
379  int s1t = (accessBuffer.pairExchange) ? s2 : s1;
380  int s2t = (accessBuffer.pairExchange) ? s1 : s2;
381  if (s1t < 3) s1t = static_cast<int>(sites[j].spinPermutation[s1t]);
382  if (s2t < 3) s2t = static_cast<int>(sites[j].spinPermutation[s2t]);
383  int spinOffset = (4 * s1t + s2t) * FrgCommon::lattice().size;
384 
385  superbundle.bundle(4 * s1 + s2)[j] += accessBuffer.sign[i][s1][s2] * accessBuffer.frequencyWeights[i] * _data[accessBuffer.frequencyOffsets[i] + spinOffset + sites[j].rid];
386  }
387  }
388  }
389  }
390  }
391 
401  TRIVertexTwoParticleAccessBuffer<4> generateAccessBuffer(float s, float t, float u, const FrequencyChannel channel) const
402  {
403  ASSERT(channel == FrequencyChannel::S || channel == FrequencyChannel::T || channel == FrequencyChannel::U);
404 
406 
407  //map to positive frequency sector
408  if (s < 0)
409  {
410  s = -s;
411  ab.pairExchange = !ab.pairExchange;
412  }
413  if (t < 0)
414  {
415  t = -t;
416  for (int i = 0; i < 4; ++i)
417  {
418  for (int s1 = 0; s1 <= 3; ++s1)
419  {
420  for (int s2 = 0; s2 <= 3; ++s2)
421  {
422  ab.sign[i][s1][s2] *= _zeta(s1) * _zeta(s2);
423  }
424  }
425  }
426  }
427  if (u < 0)
428  {
429  u = -u;
430  ab.pairExchange = !ab.pairExchange;
431  for (int i = 0; i < 4; ++i)
432  {
433  for (int s1 = 0; s1 <= 3; ++s1)
434  {
435  for (int s2 = 0; s2 <= 3; ++s2)
436  {
437  ab.sign[i][s1][s2] *= _zeta(s1) * _zeta(s2);
438  }
439  }
440  }
441  }
442 
443  //interpolate frequency
444  if (channel == FrequencyChannel::S)
445  {
446  int exactS = FrgCommon::frequency().offset(s);
447  int lowerT, upperT;
448  float biasT;
449  int lowerU, upperU;
450  float biasU;
451  FrgCommon::frequency().interpolateOffset(t, lowerT, upperT, biasT);
452  FrgCommon::frequency().interpolateOffset(u, lowerU, upperU, biasU);
453 
454  ab.frequencyWeights[0] = (1 - biasU) * (1 - biasT);
455  _generateAccessBufferOffsetMapFrequencyExchange(exactS, lowerT, lowerU, 0, ab);
456  ab.frequencyWeights[1] = (1 - biasU) * biasT;
457  _generateAccessBufferOffsetMapFrequencyExchange(exactS, upperT, lowerU, 1, ab);
458  ab.frequencyWeights[2] = biasU * (1 - biasT);
459  _generateAccessBufferOffsetMapFrequencyExchange(exactS, lowerT, upperU, 2, ab);
460  ab.frequencyWeights[3] = biasU * biasT;
461  _generateAccessBufferOffsetMapFrequencyExchange(exactS, upperT, upperU, 3, ab);
462  }
463  else if (channel == FrequencyChannel::T)
464  {
465  int exactT = FrgCommon::frequency().offset(t);
466  int lowerS, upperS;
467  float biasS;
468  int lowerU, upperU;
469  float biasU;
470  FrgCommon::frequency().interpolateOffset(s, lowerS, upperS, biasS);
471  FrgCommon::frequency().interpolateOffset(u, lowerU, upperU, biasU);
472 
473  ab.frequencyWeights[0] = (1 - biasU) * (1 - biasS);
474  _generateAccessBufferOffsetMapFrequencyExchange(lowerS, exactT, lowerU, 0, ab);
475  ab.frequencyWeights[1] = (1 - biasU) * biasS;
476  _generateAccessBufferOffsetMapFrequencyExchange(upperS, exactT, lowerU, 1, ab);
477  ab.frequencyWeights[2] = biasU * (1 - biasS);
478  _generateAccessBufferOffsetMapFrequencyExchange(lowerS, exactT, upperU, 2, ab);
479  ab.frequencyWeights[3] = biasU * biasS;
480  _generateAccessBufferOffsetMapFrequencyExchange(upperS, exactT, upperU, 3, ab);
481 
482  }
483  else if (channel == FrequencyChannel::U)
484  {
485  int exactU = FrgCommon::frequency().offset(u);
486  int lowerS, upperS;
487  float biasS;
488  int lowerT, upperT;
489  float biasT;
490  FrgCommon::frequency().interpolateOffset(s, lowerS, upperS, biasS);
491  FrgCommon::frequency().interpolateOffset(t, lowerT, upperT, biasT);
492 
493  ab.frequencyWeights[0] = (1 - biasT) * (1 - biasS);
494  _generateAccessBufferOffsetMapFrequencyExchange(lowerS, lowerT, exactU, 0, ab);
495  ab.frequencyWeights[1] = (1 - biasT) * biasS;
496  _generateAccessBufferOffsetMapFrequencyExchange(upperS, lowerT, exactU, 1, ab);
497  ab.frequencyWeights[2] = biasT * (1 - biasS);
498  _generateAccessBufferOffsetMapFrequencyExchange(lowerS, upperT, exactU, 2, ab);
499  ab.frequencyWeights[3] = biasT * biasS;
500  _generateAccessBufferOffsetMapFrequencyExchange(upperS, upperT, exactU, 3, ab);
501  }
502 
503  return ab;
504  }
505 
515  {
517 
518  //map to positive frequency sector
519  if (s < 0)
520  {
521  s = -s;
522  ab.pairExchange = !ab.pairExchange;
523  }
524  if (t < 0)
525  {
526  t = -t;
527  for (int i = 0; i < 8; ++i)
528  {
529  for (int s1 = 0; s1 <= 3; ++s1)
530  {
531  for (int s2 = 0; s2 <= 3; ++s2)
532  {
533  if (ab.pairExchange) ab.sign[i][s1][s2] *= _zeta(s2) * _zeta(s1);
534  else ab.sign[i][s1][s2] *= _zeta(s1) * _zeta(s2);
535  }
536  }
537  }
538  }
539  if (u < 0)
540  {
541  u = -u;
542  ab.pairExchange = !ab.pairExchange;
543  for (int i = 0; i < 8; ++i)
544  {
545  for (int s1 = 0; s1 <= 3; ++s1)
546  {
547  for (int s2 = 0; s2 <= 3; ++s2)
548  {
549  if (ab.pairExchange) ab.sign[i][s1][s2] *= _zeta(s2) * _zeta(s1);
550  else ab.sign[i][s1][s2] *= _zeta(s1) * _zeta(s2);
551  }
552  }
553  }
554  }
555 
556  int lowerS, upperS;
557  float biasS;
558  int lowerT, upperT;
559  float biasT;
560  int lowerU, upperU;
561  float biasU;
562 
563  FrgCommon::frequency().interpolateOffset(s, lowerS, upperS, biasS);
564  FrgCommon::frequency().interpolateOffset(t, lowerT, upperT, biasT);
565  FrgCommon::frequency().interpolateOffset(u, lowerU, upperU, biasU);
566 
567  ab.frequencyWeights[0] = (1 - biasT) * (1 - biasS) * (1 - biasU);
568  _generateAccessBufferOffsetMapFrequencyExchange(lowerS, lowerT, lowerU, 0, ab);
569  ab.frequencyWeights[1] = (1 - biasT) * biasS * (1 - biasU);
570  _generateAccessBufferOffsetMapFrequencyExchange(upperS, lowerT, lowerU, 1, ab);
571  ab.frequencyWeights[2] = biasT * (1 - biasS) * (1 - biasU);
572  _generateAccessBufferOffsetMapFrequencyExchange(lowerS, upperT, lowerU, 2, ab);
573  ab.frequencyWeights[3] = biasT * biasS * (1 - biasU);
574  _generateAccessBufferOffsetMapFrequencyExchange(upperS, upperT, lowerU, 3, ab);
575  ab.frequencyWeights[4] = (1 - biasT) * (1 - biasS) * biasU;
576  _generateAccessBufferOffsetMapFrequencyExchange(lowerS, lowerT, upperU, 4, ab);
577  ab.frequencyWeights[5] = (1 - biasT) * biasS * biasU;
578  _generateAccessBufferOffsetMapFrequencyExchange(upperS, lowerT, upperU, 5, ab);
579  ab.frequencyWeights[6] = biasT * (1 - biasS) * biasU;
580  _generateAccessBufferOffsetMapFrequencyExchange(lowerS, upperT, upperU, 6, ab);
581  ab.frequencyWeights[7] = biasT * biasS * biasU;
582  _generateAccessBufferOffsetMapFrequencyExchange(upperS, upperT, upperU, 7, ab);
583 
584  return ab;
585  }
586 
598  float _directAccessMapFrequencyExchange(const int siteOffset, const int sOffset, const int tOffset, const int uOffset, const SpinComponent s1, const SpinComponent s2) const
599  {
600  ASSERT(siteOffset >= 0 && siteOffset < FrgCommon::lattice().size);
601  ASSERT(sOffset >= 0 && sOffset < FrgCommon::frequency().size);
602  ASSERT(tOffset >= 0 && tOffset < FrgCommon::frequency().size);
603  ASSERT(uOffset >= 0 && uOffset < FrgCommon::frequency().size);
604 
605  if (sOffset < uOffset) return -_zeta(static_cast<int>(s2)) *_directAccess(siteOffset, uOffset, tOffset, sOffset, s1, s2);
606  else return _directAccess(siteOffset, sOffset, tOffset, uOffset, s1, s2);
607  }
608 
620  float _directAccess(const int siteOffset, const int sOffset, const int tOffset, const int uOffset, const SpinComponent s1, const SpinComponent s2) const
621  {
622  ASSERT(siteOffset >= 0 && siteOffset < FrgCommon::lattice().size);
623  ASSERT(sOffset >= 0 && sOffset < FrgCommon::frequency().size);
624  ASSERT(tOffset >= 0 && tOffset < FrgCommon::frequency().size);
625  ASSERT(uOffset >= 0 && uOffset < FrgCommon::frequency().size);
626  ASSERT(sOffset >= uOffset);
627 
628  int suOffset = sOffset * (sOffset + 1) / 2 + uOffset;
629  return _data[suOffset * _memoryStep[0] + tOffset * _memoryStep[1] + static_cast<int>(s1) *_memoryStep[2] + static_cast<int>(s2) *_memoryStep[3] + siteOffset];
630  }
631 
643  template <int n> void _generateAccessBufferOffsetMapFrequencyExchange(const int sOffset, const int tOffset, const int uOffset, const int abIndex, TRIVertexTwoParticleAccessBuffer<n> &ab) const
644  {
645  ASSERT(sOffset >= 0 && sOffset < FrgCommon::frequency().size);
646  ASSERT(tOffset >= 0 && tOffset < FrgCommon::frequency().size);
647  ASSERT(uOffset >= 0 && uOffset < FrgCommon::frequency().size);
648  ASSERT(abIndex >= 0 && abIndex < n);
649 
650  if (sOffset < uOffset)
651  {
652  for (int s1 = 0; s1 <= 3; ++s1)
653  {
654  for (int s2 = 0; s2 <= 3; ++s2)
655  {
656  if (ab.pairExchange) ab.sign[abIndex][s1][s2] *= -_zeta(s1);
657  else ab.sign[abIndex][s1][s2] *= -_zeta(s2);
658  }
659  }
660  ab.frequencyOffsets[abIndex] = (uOffset * (uOffset + 1) / 2 + sOffset) * _memoryStep[0] + tOffset * _memoryStep[1];
661  }
662  else
663  {
664  ab.frequencyOffsets[abIndex] = (sOffset * (sOffset + 1) / 2 + uOffset) * _memoryStep[0] + tOffset * _memoryStep[1];
665  }
666  }
667 
674  float _zeta(const int s1) const
675  {
676  return (s1 <= 2) ? -1.0f : 1.0f;
677  }
678 
679  //vertex internal data
680  int size;
682 
683  float *_data;
684  int _memoryStep[4];
685 };
ASSERT
#define ASSERT(...)
Ensure that the first argument is true. Optionally provide a message as the second argument,...
Definition: Assert.hpp:26
TRIVertexTwoParticle::getValueLocal
float getValueLocal(SpinComponent s1, SpinComponent s2, const TRIVertexTwoParticleAccessBuffer< n > &accessBuffer) const
Access vertex value locally at arbitrary spin components via a given access buffer.
Definition: TRIVertexTwoParticle.hpp:347
LatticeSiteDescriptor::spinPermutation
SpinComponent spinPermutation[3]
Spin permutation involved in the transformation.
Definition: Lattice.hpp:160
FrgCommon::lattice
static const Lattice & lattice()
Retrieve the lattice representation.
Definition: FrgCommon.hpp:26
TRIVertexTwoParticle::FrequencyChannel::T
@ T
t-channel.
TRIVertexTwoParticle::sizeFrequency
int sizeFrequency
Size of the vertex in the frequency subspace (number of elements).
Definition: TRIVertexTwoParticle.hpp:681
SpinComponent
SpinComponent
Component of a spin operator.
Definition: Lattice.hpp:28
TRIVertexTwoParticle::generateAccessBuffer
TRIVertexTwoParticleAccessBuffer< 4 > generateAccessBuffer(float s, float t, float u, const FrequencyChannel channel) const
Generate an access buffer for a set of frequencies where one of them (specified by channel) exactly l...
Definition: TRIVertexTwoParticle.hpp:401
TRIVertexTwoParticleAccessBuffer
Buffer for frequency interpolation information.
Definition: TRIVertexTwoParticle.hpp:24
Lattice::symmetryTransform
int symmetryTransform(const LatticeIterator &i1, const LatticeIterator &i2) const
Transform a pair of lattice sites (i1,i2) and transform it to (0,i2'). The transformation may involve...
Definition: Lattice.hpp:397
ValueBundle.hpp
Lightweight library for value arrays and collections thereof.
FrgCommon::frequency
static const FrequencyDiscretization & frequency()
Retrieve the Matsubara frequency discretization.
Definition: FrgCommon.hpp:36
TRIVertexTwoParticle::getValueSuperbundle
void getValueSuperbundle(const TRIVertexTwoParticleAccessBuffer< n > &accessBuffer, ValueSuperbundle< float, 16 > &superbundle) const
Bundled vertex access on all lattice sites and spin components simultaneously via a given access buff...
Definition: TRIVertexTwoParticle.hpp:364
TRIVertexTwoParticleAccessBuffer::frequencyOffsets
int frequencyOffsets[size]
Linear memory offset (number of elements) in the frequency dimensions of the two-particle vertex.
Definition: TRIVertexTwoParticle.hpp:35
FrgCommon.hpp
Hub for central objects in pf-FRG calculations.
TRIVertexTwoParticle::FrequencyChannel::None
@ None
No channel.
TRIVertexTwoParticleAccessBuffer::sign
float sign[size][4][4]
Sign factors of the support values.
Definition: TRIVertexTwoParticle.hpp:37
TRIVertexTwoParticle::FrequencyChannel::All
@ All
All channels.
TRIVertexTwoParticle::_data
float * _data
Vertex data.
Definition: TRIVertexTwoParticle.hpp:683
TRIVertexTwoParticle::size
int size
Size of the vertex (number of elements).
Definition: TRIVertexTwoParticle.hpp:680
Lattice::fromParametrization
LatticeIterator fromParametrization(const int rid) const
Retrieve iterator to the specified representative.
Definition: Lattice.hpp:359
TRIVertexTwoParticle::FrequencyChannel
FrequencyChannel
Indicator for frequency channels that exactly lie on frequency mesh points.
Definition: TRIVertexTwoParticle.hpp:50
FrequencyDiscretization::interpolateOffset
void interpolateOffset(const float w, int &lowerOffset, int &upperOffset, float &bias) const
Perform an interpolation between mesh points for an arbitrary positive frequency.
Definition: FrequencyDiscretization.hpp:326
Exception
Descriptor object for exceptions.
Definition: Exception.hpp:17
ValueSuperbundle::bundle
ValueBundle< T > & bundle(const int m)
Return reference to ValueBundle.
Definition: ValueBundle.hpp:281
FrequencyDiscretization::_data
float * _data
Pointer to the first positive mesh point. Stored contiuously after FrequencyDiscretization::_dataNega...
Definition: FrequencyDiscretization.hpp:357
Assert.hpp
Lightweight macro library for assertions.
TRIVertexTwoParticle::getValue
float getValue(LatticeIterator i1, LatticeIterator i2, SpinComponent s1, SpinComponent s2, const TRIVertexTwoParticleAccessBuffer< n > &accessBuffer) const
Access vertex value at arbitrary lattice sites and spin components via a given access buffer.
Definition: TRIVertexTwoParticle.hpp:323
TRIVertexTwoParticle::_directAccess
float _directAccess(const int siteOffset, const int sOffset, const int tOffset, const int uOffset, const SpinComponent s1, const SpinComponent s2) const
Directly access a vertex via given spin components, frequency, and site offsets, where sOffset >= uOf...
Definition: TRIVertexTwoParticle.hpp:620
TRIVertexTwoParticleAccessBuffer::pairExchange
bool pairExchange
Site exchange indicator.
Definition: TRIVertexTwoParticle.hpp:38
TRIVertexTwoParticle::~TRIVertexTwoParticle
~TRIVertexTwoParticle()
Destroy the TRIVertexTwoParticle object.
Definition: TRIVertexTwoParticle.hpp:81
TRIVertexTwoParticle
Two-particle vertex implementation for time reversal invariant models.
Definition: TRIVertexTwoParticle.hpp:44
TRIVertexTwoParticle::getValueRef
float & getValueRef(const int iterator) const
Directly access a vertex value via a linear iterator in the range [0,size).
Definition: TRIVertexTwoParticle.hpp:170
TRIVertexTwoParticleAccessBuffer::TRIVertexTwoParticleAccessBuffer
TRIVertexTwoParticleAccessBuffer()
Construct a new TRIVertexTwoParticleAccessBuffer object and initialize the sign factors to plus one.
Definition: TRIVertexTwoParticle.hpp:30
TRIVertexTwoParticle::_memoryStep
int _memoryStep[4]
Memory stride width.
Definition: TRIVertexTwoParticle.hpp:684
TRIVertexTwoParticle::FrequencyChannel::S
@ S
s-channel.
Exception::Type::ArgumentError
@ ArgumentError
Argument error, raised when a function is invoked with an invalid argument.
LatticeIterator
Lattice iterator object.
Definition: Lattice.hpp:166
Lattice::getInvertedSites
const LatticeSiteDescriptor * getInvertedSites() const
List of two-spin correlators (i2,i1), where i1=(0,0,0,0) is the reference site and the list includes ...
Definition: Lattice.hpp:481
TRIVertexTwoParticle::getValue
float getValue(LatticeIterator i1, LatticeIterator i2, float s, float t, float u, SpinComponent s1, SpinComponent s2, const FrequencyChannel channel) const
Access vertex value at arbitrary lattice sites, frequencies, and spin components.
Definition: TRIVertexTwoParticle.hpp:190
TRIVertexTwoParticle::expandIterator
void expandIterator(int iterator, LatticeIterator &i1, float &s, float &t, float &u, SpinComponent &s1, SpinComponent &s2) const
Expand a linear iterator in the range [0,size) that iterates over all vertex entries.
Definition: TRIVertexTwoParticle.hpp:97
TRIVertexTwoParticle::_generateAccessBufferOffsetMapFrequencyExchange
void _generateAccessBufferOffsetMapFrequencyExchange(const int sOffset, const int tOffset, const int uOffset, const int abIndex, TRIVertexTwoParticleAccessBuffer< n > &ab) const
Calculate the total memory offset from given frequency offsets, where sOffset may be lesser than uOff...
Definition: TRIVertexTwoParticle.hpp:643
TRIVertexTwoParticle::_directAccessMapFrequencyExchange
float _directAccessMapFrequencyExchange(const int siteOffset, const int sOffset, const int tOffset, const int uOffset, const SpinComponent s1, const SpinComponent s2) const
Directly access a vertex via given spin components, frequency, and site offsets, where sOffset may be...
Definition: TRIVertexTwoParticle.hpp:598
Lattice::size
int size
Number representative sites.
Definition: Lattice.hpp:538
LatticeSiteDescriptor
Structure to specify a symmetry-transformed lattice site.
Definition: Lattice.hpp:157
TRIVertexTwoParticle::TRIVertexTwoParticle
TRIVertexTwoParticle()
Construct a new TRIVertexTwoParticle object and initialize all entries to zero.
Definition: TRIVertexTwoParticle.hpp:62
ValueSuperbundle::reset
ValueSuperbundle & reset()
Write zeros to all ValueBundles.
Definition: ValueBundle.hpp:291
Lattice::getSites
const LatticeSiteDescriptor * getSites() const
List of two-spin correlators (i1,i2), where i1=(0,0,0,0) is the reference site and the list includes ...
Definition: Lattice.hpp:491
FrequencyDiscretization::size
int size
Number of positive mesh points.
Definition: FrequencyDiscretization.hpp:356
FrequencyDiscretization::offset
int offset(const float w) const
Return the number of iterator increments of a mesh point associated with a given frequency value,...
Definition: FrequencyDiscretization.hpp:306
TRIVertexTwoParticle::generateAccessBuffer
TRIVertexTwoParticleAccessBuffer< 8 > generateAccessBuffer(float s, float t, float u) const
Generate an access buffer for an arbitrary set of frequencies.
Definition: TRIVertexTwoParticle.hpp:514
LatticeSiteDescriptor::rid
int rid
Representative id of the transformed lattice site.
Definition: Lattice.hpp:159
TRIVertexTwoParticle::FrequencyChannel::U
@ U
u-channel.
ValueSuperbundle
Collection of ValueBundles.
Definition: ValueBundle.hpp:240
TRIVertexTwoParticle::expandIterator
void expandIterator(int iterator, float &s, float &t, float &u) const
Expand a linear iterator in the range [0,sizeFrequency) that iterates over all paramtetrized frequenc...
Definition: TRIVertexTwoParticle.hpp:139
TRIVertexTwoParticle::_zeta
float _zeta(const int s1) const
Helper function for vertex symmetries. Returns -1 if the argument is spin-like and +1 if it is densit...
Definition: TRIVertexTwoParticle.hpp:674
TRIVertexTwoParticleAccessBuffer::frequencyWeights
float frequencyWeights[size]
Weight factors of the support values.
Definition: TRIVertexTwoParticle.hpp:36