rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
Public Member Functions | List of all members
rexlib::ops::linspace_operation Class Referencefinal

Write evenly spaced samples of the segment from start to stop. More...

#include <rexlib/ops/creation/linspace_operation.hpp>

Inheritance diagram for rexlib::ops::linspace_operation:
rexlib::parametric_operation< linspace_operation, linspace_operation_traits > rexlib::basic_operation< Derived, Traits > rexlib::operation

Public Member Functions

 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.
 
const scalar_value & get_stop () const noexcept
 Get the end of the sampled segment.
 
std::size_t get_count () const noexcept
 Get the number of samples written.
 
bool get_endpoint () const noexcept
 Check whether the stop is itself a sample.
 
- Public Member Functions inherited from rexlib::parametric_operation< linspace_operation, linspace_operation_traits >
 parametric_operation (Args &&... args)
 Construct the operation by constructing its parameters.
 
const parameters_type & get_parameters () const noexcept
 Get the parameters of the operation.
 
const operation_signature & get_signature () const noexcept override
 Get the signature deciding the shape and data type of the operands of this operation.
 
- Public Member Functions inherited from rexlib::basic_operation< Derived, Traits >
const operation_descriptor & get_descriptor () const noexcept override
 Get the description of this operation.
 
operation_id get_id () const noexcept override
 Get the identifier of Derived.
 
- Public Member Functions inherited from rexlib::operation
 operation (const operation &other)=delete
 
 operation (operation &&other)=delete
 
operation & operator= (const operation &other)=delete
 
operation & operator= (operation &&other)=delete
 

Additional Inherited Members

- Public Types inherited from rexlib::parametric_operation< linspace_operation, linspace_operation_traits >
using parameters_type = typename Traits::parameters_type
 
using signature_type = rule_signature< shape_rule_type, type_rule_type, parameters_type >
 
- Public Types inherited from rexlib::basic_operation< Derived, Traits >
using traits_type = Traits
 
using shape_rule_type = typename Traits::shape_rule_type
 
using type_rule_type = typename Traits::type_rule_type
 
- Static Public Member Functions inherited from rexlib::basic_operation< Derived, Traits >
static const operation_descriptor & get_static_descriptor () noexcept
 Get the description shared by every instance.
 
- Static Public Attributes inherited from rexlib::basic_operation< Derived, Traits >
static REXLIB_CONST_CONSTEXPR std::size_t output_operand_count
 
static REXLIB_CONST_CONSTEXPR std::size_t input_operand_count
 

Detailed Description

Write evenly spaced samples of the segment from start to stop.

Unlike arange_operation this is told how many samples it wants and works the spacing out from them, which is what makes the two complementary rather than redundant: one is exact about the step and approximate about the length, the other the other way round.

When the stop is included it is written verbatim into the last element rather than being left to fall out of the arithmetic, so that both ends of the segment are exact whatever the spacing rounds to. A single sample has no interval to span and takes the start.

The domain is the inexact types. Evenly spaced samples of a segment are generally not whole numbers, so an integer result would be a truncation dressed up as a sequence; arange_operation is the one that enumerates integers. Complex samples are admitted: a segment of the complex plane is as well defined as one of the real line.

Constructor & Destructor Documentation

◆ linspace_operation()

rexlib::ops::linspace_operation::linspace_operation ( const scalar_value &  start,
const scalar_value &  stop,
std::size_t  count,
bool  endpoint = true 
)

Construct a linspace operation.

Parameters
startValue of the first element.
stopEnd of the segment being sampled.
countNumber of samples to write.
endpointWhether stop is itself a sample. When it is not, the samples are those of the half open segment, so that consecutive blocks of them tile the line without repeating a value.

Member Function Documentation

◆ get_count()

std::size_t rexlib::ops::linspace_operation::get_count ( ) const
noexcept

Get the number of samples written.

Returns
std::size_t The sample count.

◆ get_endpoint()

bool rexlib::ops::linspace_operation::get_endpoint ( ) const
noexcept

Check whether the stop is itself a sample.

Returns
bool The endpoint flag.

◆ get_start()

const scalar_value & rexlib::ops::linspace_operation::get_start ( ) const
noexcept

Get the value of the first element.

Returns
const scalar_value& The start of the segment.

◆ get_stop()

const scalar_value & rexlib::ops::linspace_operation::get_stop ( ) const
noexcept

Get the end of the sampled segment.

Returns
const scalar_value& The stop.

The documentation for this class was generated from the following file: