rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
numerical_type_traits.hpp
1// SPDX-License-Identifier: GPL-3.0-only
2
3#pragma once
4
5#include "numerical_type.hpp"
6#include "fixed_width_float.hpp"
7
8#include <complex>
9
10namespace rexlib
11{
12
21template <typename T>
23
24template <>
26 : std::integral_constant<numerical_type, numerical_type::boolean>
27{
28};
29
30template <>
32 : std::integral_constant<numerical_type, numerical_type::char8>
33{
34};
35
36template <>
38 : std::integral_constant<numerical_type, numerical_type::int8>
39{
40};
41
42template <>
44 : std::integral_constant<numerical_type, numerical_type::uint8>
45{
46};
47
48template <>
50 : std::integral_constant<numerical_type, numerical_type::int16>
51{
52};
53
54template <>
56 : std::integral_constant<numerical_type, numerical_type::uint16>
57{
58};
59
60template <>
62 : std::integral_constant<numerical_type, numerical_type::int32>
63{
64};
65
66template <>
68 : std::integral_constant<numerical_type, numerical_type::uint32>
69{
70};
71
72template <>
74 : std::integral_constant<numerical_type, numerical_type::int64>
75{
76};
77
78template <>
80 : std::integral_constant<numerical_type, numerical_type::uint64>
81{
82};
83
84template <>
86 : std::integral_constant<numerical_type, numerical_type::float16>
87{
88};
89
90template <>
92 : std::integral_constant<numerical_type, numerical_type::float32>
93{
94};
95
96template <>
98 : std::integral_constant<numerical_type, numerical_type::float64>
99{
100};
101
102template <>
103struct numerical_type_of<std::complex<float16_t>>
104 : std::integral_constant<numerical_type, numerical_type::complex_float16>
105{
106};
107
108template <>
109struct numerical_type_of<std::complex<float32_t>>
110 : std::integral_constant<numerical_type, numerical_type::complex_float32>
111{
112};
113
114template <>
115struct numerical_type_of<std::complex<float64_t>>
116 : std::integral_constant<numerical_type, numerical_type::complex_float64>
117{
118};
119
120
121
140template <numerical_type Type>
142
143template <>
145{
146 using type = bool;
147};
148
149template <>
151{
152 using type = char;
153};
154
155template <>
157{
158 using type = std::int8_t;
159};
160
161template <>
163{
164 using type = std::uint8_t;
165};
166
167template <>
169{
170 using type = std::int16_t;
171};
172
173template <>
175{
176 using type = std::uint16_t;
177};
178
179template <>
181{
182 using type = std::int32_t;
183};
184
185template <>
187{
188 using type = std::uint32_t;
189};
190
191template <>
193{
194 using type = std::int64_t;
195};
196
197template <>
199{
200 using type = std::uint64_t;
201};
202
203template <>
205{
206 using type = float16_t;
207};
208
209template <>
211{
212 using type = float32_t;
213};
214
215template <>
217{
218 using type = float64_t;
219};
220
221template <>
222struct native_type_of<numerical_type::complex_float16>
223{
224 using type = std::complex<float16_t>;
225};
226
227template <>
228struct native_type_of<numerical_type::complex_float32>
229{
230 using type = std::complex<float32_t>;
231};
232
233template <>
234struct native_type_of<numerical_type::complex_float64>
235{
236 using type = std::complex<float64_t>;
237};
238
239} // namespace rexlib
Container for multidimensional numeric data.
Definition array.hpp:31
16 bit floating point number representation.
Definition fixed_width_float.hpp:22
Arrays, the operations on them and the devices that run those operations.
Definition cpu_device.hpp:10
numerical_type
Representation of all considered numerical types for computations.
Definition numerical_type.hpp:19
double float64_t
64 bit floating point number representation.
Definition fixed_width_float.hpp:56
float float32_t
32 bit floating point number representation.
Definition fixed_width_float.hpp:50
Convert numerical_type-s to static types.
Definition numerical_type_traits.hpp:141
Convert static types to numerical_type.
Definition numerical_type_traits.hpp:22