NumCpp  2.12.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
logspace.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include "NumCpp/Core/Enums.hpp"
34#include "NumCpp/NdArray.hpp"
36
37namespace nc
38{
39 //============================================================================
40 // Method Description:
57 template<typename dtype>
58 NdArray<double>
59 logspace(dtype start, dtype stop, uint32 num = 50, EndPoint endPoint = EndPoint::YES, double base = 10.)
60 {
62
63 auto spacedValues = linspace(static_cast<double>(start), static_cast<double>(stop), num, endPoint);
64 stl_algorithms::for_each(spacedValues.begin(),
65 spacedValues.end(),
66 [base](auto& value) -> void { value = utils::powerf(base, value); });
67
68 return spacedValues;
69 }
70} // namespace nc
#define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype)
Definition: StaticAsserts.hpp:56
void for_each(InputIt first, InputIt last, UnaryFunction f)
Definition: StlAlgorithms.hpp:225
Definition: Cartesian.hpp:40
NdArray< dtype > linspace(dtype inStart, dtype inStop, uint32 inNum=50, EndPoint endPoint=EndPoint::YES)
Definition: linspace.hpp:61
std::uint32_t uint32
Definition: Types.hpp:40
NdArray< double > logspace(dtype start, dtype stop, uint32 num=50, EndPoint endPoint=EndPoint::YES, double base=10.)
Definition: logspace.hpp:59
EndPoint
End Point boolean.
Definition: Enums.hpp:74