VCTR
Loading...
Searching...
No Matches
vctr::generators::Linspace Struct Reference

Collection of static methods for generating evenly spaced numbers. More...

Static Public Member Functions

template<is::realNumber ElementType>
static Vector< ElementType > makeVector (ElementType start, ElementType stop, size_t num, bool includeEnd=true)
 Returns a Vector with evenly spaced numbers between start and stop.
 
template<is::realNumber ElementType, size_t num>
static constexpr Array< ElementType, num > makeArray (ElementType start, ElementType stop, bool includeEnd=true)
 Like makeVector, but returns an Array.
 
template<is::realNumber ElementType>
static Vector< ElementType > makeVector (ElementType start, ElementType stop, bool includeEnd=true)
 Returns a Vector with values between start and stop and a step of 1.
 

Detailed Description

Collection of static methods for generating evenly spaced numbers.

Member Function Documentation

◆ makeArray()

template<is::realNumber ElementType, size_t num>
static constexpr Array< ElementType, num > vctr::generators::Linspace::makeArray ( ElementType  start,
ElementType  stop,
bool  includeEnd = true 
)
inlinestaticconstexpr

Like makeVector, but returns an Array.

◆ makeVector() [1/2]

template<is::realNumber ElementType>
static Vector< ElementType > vctr::generators::Linspace::makeVector ( ElementType  start,
ElementType  stop,
bool  includeEnd = true 
)
inlinestatic

Returns a Vector with values between start and stop and a step of 1.

Properties:

  • The number of elements is stop - start + 1.
  • If start and stop are identical, the container will be filled with that value.
  • Ranges can have a negative increment, i.e., start > stop is explicitly allowed.

@Note: stop - start must not be fractional.

Template Parameters
ElementTypeElement type contained in the vector.
Parameters
startFirst value of the interval; always included.
stopLast value of the interval; only included if includeEnd is true.
includeEndIf this is true, the numbers lie on the closed interval [start, stop]; otherwise the interval is half-open [start, stop).

◆ makeVector() [2/2]

template<is::realNumber ElementType>
static Vector< ElementType > vctr::generators::Linspace::makeVector ( ElementType  start,
ElementType  stop,
size_t  num,
bool  includeEnd = true 
)
inlinestatic

Returns a Vector with evenly spaced numbers between start and stop.

Properties:

  • If start and stop are identical, the container will be filled with that value.
  • Ranges can have a negative increment, i.e., start > stop is explicitly allowed.
Template Parameters
ElementTypeElement type contained in the vector.
Parameters
startFirst value of the interval; always included.
stopLast value of the interval; only included if includeEnd is true.
numNumber of elements (length of the vector), must be > 0.
includeEndIf this is true, both start and stop are included; otherwise only start is included.

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