batmat 0.0.19
Batched linear algebra routines
Loading...
Searching...
No Matches
lut.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <batmat/config.hpp>
4#include <guanaqo/lut.hpp>
5#include <type_traits>
6
7namespace batmat {
8
9template <index_t I>
10using index_constant = std::integral_constant<index_t, I>;
11
12/// Returns a 2D array of the form:
13///
14/// ~~~
15/// {{ f(0, 0), f(0, 1), ..., f(0, C - 1) },
16/// { f(1, 0), f(1, 1), ..., f(1, C - 1) },
17/// { ..., ..., ..., ... },
18/// { f(R - 1, 0), f(R - 1, 1)}, ..., f(R - 1, C - 1) }}
19/// ~~~
20///
21/// The argument @p f should be a function (or callable) that accepts two
22/// arguments of type @ref index_constant.
23/// @ingroup topic-utils
24template <int R, int C, class F>
25consteval auto make_2d_lut(F f) {
26 return guanaqo::make_2d_lut<index_t, R, C>(std::forward<F>(f));
27}
28
29/// Returns an array of the form:
30///
31/// ~~~
32/// { f(0), f(1), ..., f(C - 1) }
33/// ~~~
34///
35/// The argument @p f should be a function (or callable) that accepts an
36/// argument of type @ref index_constant.
37/// @ingroup topic-utils
38template <int N, class F>
39consteval auto make_1d_lut(F f) {
40 return guanaqo::make_1d_lut<index_t, N>(std::forward<F>(f));
41}
42
43} // namespace batmat
consteval auto make_1d_lut(F f)
consteval auto make_2d_lut(F f)
consteval auto make_1d_lut(F f)
Returns an array of the form:
Definition lut.hpp:39
consteval auto make_2d_lut(F f)
Returns a 2D array of the form:
Definition lut.hpp:25
std::integral_constant< index_t, I > index_constant
Definition lut.hpp:10