rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
arange_operation.hpp
1// SPDX-License-Identifier: GPL-3.0-only
2
3#pragma once
4
5#include <rexlib/core/numerical/scalar_value.hpp>
6#include <rexlib/core/operation/operation_declaration_macros.hpp>
7#include <rexlib/core/platform/dynamic_shared_object.h>
8#include <rexlib/ops/ops_component.hpp>
9#include <rexlib/ops/parameters/sequence_length.hpp>
10#include <rexlib/ops/rules/shape_rules.hpp>
11#include <rexlib/ops/rules/type_rules.hpp>
12
13#include <cstddef>
14
15namespace rexlib
16{
17namespace ops
18{
19
20REXLIB_DECLARE_PARAMETRIC_OPERATION_TRAITS(
21 arange,
22 ops_component,
23 REXLIB_OPERANDS("result"),
24 REXLIB_OPERANDS(),
26 sequence_length,
27 nullary_free_rule<real_arithmetic_type_domain>
28);
29
46REXLIB_BEGIN_TEMPLATE_BASE
48 : public parametric_operation<arange_operation, arange_operation_traits>
49{
50public:
62 const scalar_value &start,
63 const scalar_value &step,
64 std::size_t count
65 );
66
73
80
86 std::size_t get_count() const noexcept;
87
90 scalar_value m_start;
92 scalar_value m_step;
93};
95
96} // namespace ops
97} // namespace rexlib
Container for multidimensional numeric data.
Definition array.hpp:31
Write the arithmetic progression start + i * step.
Definition arange_operation.hpp:49
arange_operation(const scalar_value &start, const scalar_value &step, std::size_t count)
Construct an arange operation.
const scalar_value & get_start() const noexcept
Get the value of the first element.
CRTP base for operations whose signature depends on parameters.
Definition parametric_operation.hpp:43
Owns a copy of a dynamically typed scalar value.
Definition scalar_value.hpp:35
operand_shape_rule< type_list< extent_from_operation< count_of > >, type_list< core_dimensions< axis_same_as< 0 > > >, type_list<> > sequence_shape_rule
Sequence of as many values as the operation names.
Definition shape_rules.hpp:286
Arrays, the operations on them and the devices that run those operations.
Definition cpu_device.hpp:10
array arange(const scalar_value &start, const scalar_value &stop, const scalar_value &step, numerical_type data_type, memory_resource_affinity affinity, const execution_context &context, array *out=nullptr)
Create a one dimensional array holding an arithmetic progression.