File su2doubletbinaryoperator.h
File List > algebra > su2algebra > su2doubletbinaryoperator.h
Go to the documentation of this file
#ifndef TEMPLAT_LATTICE_ALGEBRA_SU2ALGEBRA_SU2DOUBLETBINARYOPERATOR_H
#define TEMPLAT_LATTICE_ALGEBRA_SU2ALGEBRA_SU2DOUBLETBINARYOPERATOR_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, Franz R. Sattler, Year: 2025
#include "TempLat/lattice/algebra/su2algebra/helpers/su2doubletget.h"
#include "TempLat/lattice/algebra/su2algebra/helpers/su2get.h"
#include "TempLat/lattice/algebra/su2algebra/helpers/su2getgetreturntype.h"
#include "TempLat/lattice/algebra/helpers/getkir.h"
#include "TempLat/lattice/algebra/helpers/getdx.h"
#include "TempLat/lattice/algebra/helpers/getndim.h"
#include "TempLat/lattice/algebra/helpers/gettoolbox.h"
#include "TempLat/util/containsspace.h"
#include "TempLat/lattice/algebra/helpers/getstring.h"
namespace TempLat
{
template <typename R, typename T> class SU2DoubletBinaryOperator
{
public:
// Put public methods here. These should change very little over time.
SU2DoubletBinaryOperator(const R &pR, const T &pT) : mR(pR), mT(pT) {}
static constexpr size_t size = 4;
using Getter = SU2DoubletGetter;
static consteval size_t getNDim() { return std::max(GetNDim::get<R>(), GetNDim::get<T>()); }
virtual std::string operatorString() const { return " "; }
std::string toString() const
{
std::string tt = GetString::get(mR);
if (ContainsSpace::test(tt)) tt = "(" + tt + ")";
std::string ss = GetString::get(mT);
if (ContainsSpace::test(ss)) ss = "(" + ss + ")";
std::string result = tt + " " + operatorString() + " " + ss;
return result;
}
auto getDx() const { return GetDx::getDx(mR); }
auto getKIR() const { return GetKIR::getKIR(mR); }
inline auto getToolBox() const
{
using AT = decltype(GetToolBox::get(mR));
using BT = decltype(GetToolBox::get(mT));
if constexpr (!std::is_same_v<AT, std::nullptr_t>)
return GetToolBox::get(mR);
else if constexpr (!std::is_same_v<BT, std::nullptr_t>)
return GetToolBox::get(mT);
else
return nullptr;
}
protected:
/* Put all member variables and private methods here. These may change arbitrarily. */
R mR;
T mT;
};
} // namespace TempLat
#endif