Skip to content

File plaquette.h

File List > algebra > gaugealgebra > plaquette.h

Go to the documentation of this file

#ifndef COSMOINTERFACE_GAUGEALGEBRA_PLAQUETTE_H
#define COSMOINTERFACE_GAUGEALGEBRA_PLAQUETTE_H

/* This file is part of TempLat, available at https://cosmolattice.github.io/templat .
   Copyright 2021-2026 The TempLat authors, see AUTHORS.md.
   Released under the MIT license, see LICENSE.md. */

// File info: Main contributor(s): Adrien Florio, Year: 2019

#include "TempLat/lattice/algebra/su2algebra/su2shift.h"
#include "TempLat/lattice/algebra/su2algebra/su2dagger.h"
#include "TempLat/lattice/algebra/su2algebra/su2multiply.h"

namespace TempLat
{
  template <int Mu, int Nu, typename R> auto plaq(R Us, Tag<Mu> mu, Tag<Nu> nu)
  {
    // Now one has to be careful how to compute chain of matrix multiplication. Better to group them in smaller
    // matrices, write (A*B)*(C*D) instead of
    //  A*B*C*D. Reason: first expression will not expand the algebra, second will. Actually, the fully expanded
    //  expression even causes some segfault from around 6 matrices chains, as you are using too much memory on the
    //  stack!
    return (Us(mu) * shift(Us(nu), mu)) * (dagger(shift(Us(mu), nu)) * dagger(Us(nu)));
  }
} // namespace TempLat

#endif