TRIQS/triqs_modest 3.3.0
Brillouin zone summation
Loading...
Searching...
No Matches
enumerate_slice.hpp
Go to the documentation of this file.
1// Copyright (c) 2025--present, The Simons Foundation
2// This file is part of TRIQS/modest and is licensed under the terms of GPLv3 or later.
3// SPDX-License-Identifier: GPL-3.0-or-later
4// See LICENSE in the root of this distribution for details.
5
6#pragma once
7#include <nda/nda.hpp>
8#include <triqs/utility/generator.hpp>
9
10using itertools::range;
11
12namespace triqs {
19 inline generator<std::pair<long, nda::range>> enumerated_sub_slices(auto sub_div) {
20 long m_start = 0, n = 0;
21 for (auto p : sub_div) {
22 co_yield {n, {m_start, m_start + p}};
23 m_start += p;
24 ++n;
25 }
26 }
27} // namespace triqs
generator< std::pair< long, nda::range > > enumerated_sub_slices(auto sub_div)