File u1exponential.h
File List > algebra > gaugealgebra > u1exponential.h
Go to the documentation of this file
#ifndef COSMOINTERFACE_COMPLEXFIELDALGEBRA_U1WRAPPER_H
#define COSMOINTERFACE_COMPLEXFIELDALGEBRA_U1WRAPPER_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/util/rangeiteration/make_list_tag.h"
#include "TempLat/lattice/algebra/helpers/doeval.h"
#include "TempLat/lattice/algebra/complexalgebra/complexfieldunaryoperator.h"
#include "TempLat/lattice/algebra/complexalgebra/helpers/complexgetgetreturntype.h"
namespace TempLat
{
template <typename R> class U1Exponential : public ComplexFieldUnaryOperator<R>
{
public:
using SV = typename GetGetReturnType<R>::type;
// Put public methods here. These should change very little over time.
using ComplexFieldUnaryOperator<R>::mR;
U1Exponential(const R &pR) : ComplexFieldUnaryOperator<R>(pR) {}
auto ComplexFieldGet(Tag<0> t) const { return cos(mR); }
auto ComplexFieldGet(Tag<1> t) const { return sin(mR); }
template <typename... IDX>
requires requires(std::decay_t<R> r, IDX... idx) {
requires IsVariadicIndex<IDX...>;
DoEval::eval(r, idx...);
}
DEVICE_INLINE_FUNCTION auto eval(const IDX &...idx) const
{
const auto val = DoEval::eval(mR, idx...);
return device::array<decltype(val), 2>{device::cos(val), device::sin(val)};
}
std::string toString() const { return "U1(" + GetString::get(mR) + ")"; }
};
template <typename R> auto complexPhase(R &&r) { return U1Exponential<R>(std::forward<R>(r)); }
} // namespace TempLat
#endif