File complexconjugate.h
File List > algebra > operators > complexconjugate.h
Go to the documentation of this file
#ifndef TEMPLAT_LATTICE_ALGEBRA_OPERATORS_COMPLEXCONJUGATE_H
#define TEMPLAT_LATTICE_ALGEBRA_OPERATORS_COMPLEXCONJUGATE_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): Wessel Valkenburg, Franz R. Sattler, Year: 2025
#include "TempLat/lattice/algebra/complexalgebra/helpers/hascomplexfieldget.h"
#include "TempLat/lattice/algebra/matrix3x3algebra/helpers/hassymtracelessget.h"
#include "TempLat/lattice/algebra/conditional/conditionalunarygetter.h"
#include "TempLat/lattice/algebra/helpers/getgetreturntype.h"
#include "TempLat/lattice/algebra/operators/unaryoperator.h"
#include "TempLat/lattice/algebra/constants/halftype.h"
#include "TempLat/lattice/algebra/constants/zerotype.h"
#include "TempLat/lattice/algebra/constants/onetype.h"
namespace TempLat
{
using device::conj;
namespace Operators
{
template <typename R> class ComplexConjugate : public UnaryOperator<R>
{
public:
// Put public methods here. These should change very little over time.
using UnaryOperator<R>::mR;
ComplexConjugate(const R &a) : UnaryOperator<R>(a) {}
template <typename... IDX>
requires requires(std::decay_t<R> r, IDX... idx) {
requires IsVariadicIndex<IDX...>;
DoEval::eval(r, idx...);
}
DEVICE_FORCEINLINE_FUNCTION auto eval(const IDX &...idx) const
{
return conj(DoEval::eval(mR, idx...));
}
template <typename U> auto d(const U &other) = delete;
};
} // namespace Operators
template <typename T>
requires(ConditionalUnaryGetter<T> && !HasComplexFieldGet<T> && !HasSymTracelessGet<T>)
auto conj(const T &a)
{
return Operators::ComplexConjugate<T>(a);
}
constexpr inline ZeroType conj(ZeroType a) { return ZeroType(); }
constexpr inline OneType conj(OneType a) { return OneType(); }
constexpr inline HalfType conj(HalfType a) { return HalfType(); }
} // namespace TempLat
#endif