rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
array_descriptor.hpp
1// SPDX-License-Identifier: GPL-3.0-only
2
3#pragma once
4
5#include "../layout/strided_layout.hpp"
6#include "../numerical/numerical_type.hpp"
7#include "../platform/dynamic_shared_object.h"
8
9namespace rexlib
10{
11
22{
23public:
31
42 ) noexcept;
43
50
55
62 std::size_t hash() const noexcept;
63
71
79
80 friend bool operator==(
83 ) noexcept
84 {
85 return
86 lhs.get_data_type() == rhs.get_data_type() &&
87 lhs.get_layout() == rhs.get_layout();
88 }
89
90 friend bool operator!=(
91 const array_descriptor &lhs,
93 ) noexcept
94 {
95 return !(lhs == rhs);
96 }
97
98private:
99 strided_layout m_layout;
100 numerical_type m_data_type;
101};
102
115REXLIB_API
119);
120
130
140
141} // namespace rexlib
142
143namespace std
144{
145
146template<>
147struct hash<rexlib::array_descriptor>
148{
149 std::size_t operator()(
150 const rexlib::array_descriptor &descriptor
151 ) const noexcept
152 {
153 return descriptor.hash();
154 }
155};
156
157} // namespace std
Description of the memory representation of a multidimensional array.
Definition array_descriptor.hpp:22
std::size_t hash() const noexcept
Get the hash value for this descriptor.
const strided_layout & get_layout() const noexcept
Get the layout of the array.
numerical_type get_data_type() const noexcept
Get the data type of the array.
array_descriptor() noexcept
Default construct the descriptor with an empty layout and unknown numerical type.
Container for multidimensional numeric data.
Definition array.hpp:31
Definition strided_layout.hpp:21
Arrays, the operations on them and the devices that run those operations.
Definition cpu_device.hpp:10
bool is_initialized(const array_descriptor &descriptor) noexcept
Check if the array descriptor is initialized.
std::size_t compute_storage_requirement(const array_descriptor &descriptor)
Compute the number of bytes required to store the given descriptor.
numerical_type
Representation of all considered numerical types for computations.
Definition numerical_type.hpp:19
array_descriptor make_contiguous_array_descriptor(span< const std::size_t > extents, numerical_type data_type)
Create an array descriptor with a contiguous layout.