rexlib
0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
rexlib
core
operation
shape_rule
core_dimensions.hpp
1
// SPDX-License-Identifier: GPL-3.0-only
2
3
#pragma once
4
5
#include <rexlib/core/operation/shape_rule/any_extent_domain.hpp>
6
#include <rexlib/core/operation/shape_rule/axis_run.hpp>
7
#include <rexlib/core/operation/shape_rule/extent_slot.hpp>
8
9
#include <rexlib/core/meta/type_list.hpp>
10
#include <rexlib/core/platform/constexpr.hpp>
11
12
#include <cstddef>
13
#include <type_traits>
14
15
namespace
rexlib
16
{
17
18
namespace
detail
19
{
20
21
template
<
typename
T>
22
struct
is_axis_run
23
: std::false_type
24
{
25
};
26
27
template
<
typename
Domain>
28
struct
is_axis_run
<
axis_run
<
Domain
>>
29
: std::true_type
30
{
31
};
32
33
template
<
typename
...
Slots
>
34
struct
core_run_split
35
{
36
static
REXLIB_CONST_CONSTEXPR
bool
has_run =
false
;
37
38
using
run_domain_type
=
any_extent_domain
;
39
using
slot_list_type
=
type_list
<
Slots
...>;
40
};
41
42
template
<
typename
Domain
,
typename
...
Slots
>
43
struct
core_run_split
<
axis_run
<
Domain
>,
Slots
...>
44
{
45
static
REXLIB_CONST_CONSTEXPR
bool
has_run =
true
;
46
47
using
run_domain_type
=
Domain
;
48
using
slot_list_type
=
type_list
<
Slots
...>;
49
};
50
51
template
<
typename
Slots>
52
struct
slots_without_run
;
53
54
template
<
typename
...
Slots
>
55
struct
slots_without_run
<
type_list
<
Slots
...>>
56
: std::is_same<
57
type_list<std::false_type, typename is_axis_run<Slots>::type...>,
58
type_list<typename is_axis_run<Slots>::type..., std::false_type>
59
>
60
{
61
};
62
63
}
// namespace detail
64
76
template
<
typename
...
Slots
>
77
struct
core_dimensions
78
{
79
using
slot_list_type =
80
typename
detail::core_run_split
<
Slots
...>::slot_list_type;
81
using
run_domain_type =
82
typename
detail::core_run_split
<
Slots
...>::run_domain_type;
83
84
static
REXLIB_CONST_CONSTEXPR
bool
has_run =
85
detail::core_run_split
<
Slots
...>::has_run;
86
static
REXLIB_CONST_CONSTEXPR std::size_t axis_count =
87
type_list_size<slot_list_type>::value
;
88
89
static_assert
(
90
detail::slots_without_run<slot_list_type>::value
,
91
"A run may only lead the core dimensions, so the axes of one cannot "
92
"be told from those of the other."
93
);
94
};
95
96
}
// namespace rexlib
rexlib::array
Container for multidimensional numeric data.
Definition
array.hpp:31
rexlib
Arrays, the operations on them and the devices that run those operations.
Definition
cpu_device.hpp:10
rexlib::any_extent_domain
Domain admitting every extent.
Definition
any_extent_domain.hpp:16
rexlib::axis_run
Leading core axes as many as the operation instance names.
Definition
axis_run.hpp:22
rexlib::core_dimensions
The core axes of one operand.
Definition
core_dimensions.hpp:78
rexlib::detail::core_run_split
Definition
core_dimensions.hpp:35
rexlib::detail::is_axis_run
Definition
core_dimensions.hpp:24
rexlib::detail::slots_without_run
Definition
core_dimensions.hpp:52
rexlib::type_list_size
Utility class to obtain the size of a type_list.
Definition
type_list.hpp:28
rexlib::type_list
Helper class to pass a heterogeneous sequence of types to a function.
Definition
type_list.hpp:20
Generated by
1.9.8