42namespace triqs::mesh {
45 using dcomplex = std::complex<double>;
46 using all_t = nda::range::all_t;
48 using nda::array_view;
52 using nda::matrix_const_view;
53 using nda::matrix_view;
70 template <
typename... Ts> [[nodiscard]] uint64_t
hash(Ts &&...ts) {
return (std::hash<std::decay_t<Ts>>()(std::forward<Ts>(ts)) + ...); }
80 [[nodiscard]] C2PY_IGNORE
inline std::size_t
hash_bytes(std::span<std::byte const> bytes) {
81 return std::hash<std::string_view>{}(std::string_view{
reinterpret_cast<char const *
>(bytes.data()), bytes.size()});
93 template <nda::MemoryArray R> [[nodiscard]] std::size_t
hash_bytes(R
const &r) {
94 EXPECTS(r.is_contiguous());
95 return hash_bytes(std::as_bytes(std::span{r.data(),
static_cast<std::size_t
>(r.size())}));
114 return (res >= 0 ? res : res + y);
124 template <MeshWithValues M> [[nodiscard]]
auto values(M
const &m) {
125 auto res = nda::vector<typename M::value_t>(m.size());
126 for (
auto i : nda::range(m.size())) res(i) = m[i].value();
137 template <Mesh M> [[nodiscard]] M
copy(M
const &m) {
return m; }
148 template <Mesh M>
void copy_from(M &m1, M
const &m2) { m1 = m2; }
200 if constexpr (
sizeof...(Ts) == 1)
211 [[nodiscard]]
auto sum_to_regular(std::ranges::forward_range
auto &&rg,
auto f) {
212 auto it = std::ranges::begin(rg);
213 auto e = std::ranges::end(rg);
214 auto res = nda::make_regular(f(*it));
215 for (++it; it != e; ++it) res += f(*it);
k_expr<' *', long, R > operator*(Int l, R &&r)
Lazy multiplication of a triqs::mesh::BzMeshPoint object with a scalar.
int sign(statistic_enum s)
Get the sign associated with the given particle statistics.
auto values(M const &m)
Get the values of all mesh points in a mesh.
auto closest_mesh_pt(Ts &&...ts)
Construct a triqs::mesh::closest_mesh_point_t object for a single value or a std::tuple of triqs::mes...
void copy_from(M &m1, M const &m2)
Copy one mesh into another (for Python bindings).
statistic_enum
Enum to specify particle statistics.
static constexpr int n_variables
Constexpr variable that holds the number of meshes in a triqs::mesh::Mesh type ( for non-product mes...
std::size_t hash_bytes(std::span< std::byte const > bytes)
Hash the raw bytes of a span via the standard library's std::hash<std::string_view>.
uint64_t hash(Ts &&...ts)
Generic hash function for multiple arguments.
static constexpr bool is_product
Constexpr bool that is true if the given triqs::mesh::Mesh type is a product of meshes,...
long positive_modulo(long x, long y)
Calculate the positive modulo of two integer numbers.
M copy(M const &m)
Get a copy of a mesh (for Python bindings).
Common macros used in TRIQS.
Provides concepts for mesh points and meshes.
Lazy struct used in various function overloads as a placeholder for the closest mesh point to a given...
T value
Use the mesh point closest to this value.