rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
linspace_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(
22 ops_component,
23 REXLIB_OPERANDS("result"),
24 REXLIB_OPERANDS(),
26 sequence_length,
27 nullary_free_rule<inexact_type_domain>
28);
29
49REXLIB_BEGIN_TEMPLATE_BASE
51 : public parametric_operation<linspace_operation, linspace_operation_traits>
52{
53public:
65 const scalar_value &start,
66 const scalar_value &stop,
67 std::size_t count,
68 bool endpoint = true
69 );
70
77
84
90 std::size_t get_count() const noexcept;
91
97 bool get_endpoint() const noexcept;
98
101 scalar_value m_start;
103 scalar_value m_stop;
104 bool m_endpoint;
105};
107
108} // namespace ops
109} // namespace rexlib
Container for multidimensional numeric data.
Definition array.hpp:31
Write evenly spaced samples of the segment from start to stop.
Definition linspace_operation.hpp:52
linspace_operation(const scalar_value &start, const scalar_value &stop, std::size_t count, bool endpoint=true)
Construct a linspace 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 linspace(const scalar_value &start, const scalar_value &stop, std::size_t count, numerical_type data_type, memory_resource_affinity affinity, const execution_context &context, array *out=nullptr)
Create a one dimensional array of evenly spaced samples.