31namespace triqs::mesh {
44 template <
char OP,
typename L>
51 [[nodiscard]] uint64_t
mesh_hash()
const {
return l.mesh_hash(); };
54 [[nodiscard]]
auto value()
const {
return -l.value(); }
57 [[nodiscard]]
auto index()
const {
return -l.index(); }
67 template <
char OP,
typename L,
typename R>
struct k_expr {
80 template <
typename L1,
typename R1>
k_expr(L1 &&l1, R1 &&r1) : l{std::forward<L1>(l1)}, r{std::forward<R1>(r1)} {}
92 [[nodiscard]]
auto value()
const {
93 if constexpr (OP ==
'+') {
94 return nda::make_regular(l.value() + r.value());
95 }
else if constexpr (OP ==
'-') {
96 return nda::make_regular(l.value() - r.value());
98 return nda::make_regular(l * r.value());
111 if constexpr (
requires { l.mesh_hash(); }) { EXPECTS(l.mesh_hash() == r.mesh_hash()) };
112 if constexpr (OP ==
'+') {
113 return l.index() + r.index();
114 }
else if constexpr (OP ==
'-') {
115 return l.index() - r.index();
117 return l * r.index();
122 [[nodiscard]] uint64_t
mesh_hash()
const {
return r.mesh_hash(); };
constexpr bool is_k_expr
Type trait to check if a type is a triqs::mesh::k_expr or triqs::mesh::k_expr_unary.
Unary minus -vector expression.
auto value() const
Get the reciprocal vector (see triqs::mesh::brzone::mesh_point_t::value()).
auto index() const
Get the index of the reciprocal vector (see triqs::mesh::brzone::mesh_point_t::index()).
uint64_t mesh_hash() const
Get the hash value of the mesh to which the operand belongs.
uint64_t mesh_hash() const
Get the hash value of the mesh to which the right hand side operand belongs.
auto index() const
Get the index of the -vector corresponding to the evaluated expression.
k_expr(L1 &&l1, R1 &&r1)
Construct a binary -vector expression with the given operands.
auto value() const
Evaluate the expression template depending on the operator tag.