Loading...
Searching...
No Matches
minimize_request.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) gpridge developers
3// See LICENSE for details.
4//
5// The per-thread minimizer request that
6// gpr_minimize_request_max_inner_steps sets, and the call frame that takes
7// it. This is internal to the library and its bindings. It is not part of the
8// C ABI and is not installed.
9
10#ifndef GPR_CAPI_MINIMIZE_REQUEST_HPP
11#define GPR_CAPI_MINIMIZE_REQUEST_HPP
12
13namespace gpr {
14namespace capi {
15namespace detail {
16
19int pending_minimize_request() noexcept;
20
22int take_minimize_request() noexcept;
23
38class MinimizeRequestScope {
39public:
40 MinimizeRequestScope() noexcept : max_inner_steps_(take_minimize_request())
41 {
42 }
43 MinimizeRequestScope(const MinimizeRequestScope&) = delete;
44 MinimizeRequestScope& operator=(const MinimizeRequestScope&) = delete;
45
47 [[nodiscard]] int max_inner_steps() const noexcept
48 {
49 return max_inner_steps_;
50 }
51
52private:
53 int max_inner_steps_;
54};
55
56} // namespace detail
57} // namespace capi
58} // namespace gpr
59
60#endif
Gaussian-process regression, kernels, priors, and the searches that run on the surrogate.
Definition Macros.h:16