58 template<
typename dtype>
63 if (inStep > 0 && inStop < inStart)
68 if (inStep < 0 && inStop > inStart)
73 std::vector<dtype> values;
75 dtype theValue = inStart;
76 auto counter = dtype{ 1 };
80 while (theValue < inStop)
82 values.push_back(theValue);
83 theValue = inStart + inStep * counter++;
88 while (theValue > inStop)
90 values.push_back(theValue);
91 theValue = inStart + inStep * counter++;
115 template<
typename dtype>
123 return arange<dtype>(0, inStop, 1);
143 template<
typename dtype>
146 return arange<dtype>(inSlice.
start, inSlice.
stop, inSlice.
step);
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:37
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:39
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:139
A Class for slicing into NdArrays.
Definition: Slice.hpp:45
int32 step
Definition: Slice.hpp:50
int32 start
Definition: Slice.hpp:48
int32 stop
Definition: Slice.hpp:49
Definition: Cartesian.hpp:40
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition: arange.hpp:59