Program Listing for File batch_policy.hpp¶
↰ Return to documentation for file (SeQuant/core/batch_policy.hpp)
#ifndef SEQUANT_CORE_BATCH_POLICY_HPP
#define SEQUANT_CORE_BATCH_POLICY_HPP
#include <SeQuant/core/utility/aggregate.hpp>
#include <cstddef>
#include <functional>
#include <limits>
namespace sequant {
class Index;
class Tensor;
enum class BatchScheduler { forest_descent, ordered };
struct BatchPolicy {
SEQUANT_DESIGNATED_INIT_ONLY;
std::function<bool(Index const&)> is_batchable_contracted_index =
[](Index const&) { return false; };
std::function<bool(Index const&)> is_batchable_external_index =
[](Index const&) { return false; };
std::function<bool(Index const&)> is_batchable_index() const {
auto contracted = is_batchable_contracted_index;
auto external = is_batchable_external_index;
return [contracted, external](Index const& ix) {
return contracted(ix) || external(ix);
};
}
std::function<std::size_t(Index const&)> batch_target_size = {};
std::function<bool(Tensor const&)> is_volatile_leaf = {};
bool batch_spectator_indices = false;
bool persistent_only = false;
double accumulation_factor = 0.0;
BatchScheduler scheduler = BatchScheduler::forest_descent;
double peak_threshold = std::numeric_limits<double>::infinity();
};
} // namespace sequant
#endif // SEQUANT_CORE_BATCH_POLICY_HPP