Skip to content

File halftype.h

File List > algebra > constants > halftype.h

Go to the documentation of this file

#ifndef TEMPLAT_LATTICE_ALGEBRA_CONSTANTS_HALFTYPE_H
#define TEMPLAT_LATTICE_ALGEBRA_CONSTANTS_HALFTYPE_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, Year: 2019

#include "TempLat/lattice/algebra/helpers/isvariadicindex.h"
#include "TempLat/parallel/device.h"

namespace TempLat
{
  struct HalfType {
    static std::string toString() { return "(HalfType)1/2"; }
    template <typename... IDX>
      requires IsVariadicIndex<IDX...>
    DEVICE_INLINE_FUNCTION static constexpr auto eval(const IDX &...i)
    {
      return 0.5;
    }
    inline explicit operator double() const { return value; }
    inline explicit operator float() const { return value; }
    static constexpr double value = 0.5;
  };
} // namespace TempLat

#endif