NumCpp  2.10.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
log1p.hpp
Go to the documentation of this file.
1 #pragma once
29 
30 #include <cmath>
31 
34 #include "NumCpp/NdArray.hpp"
35 
36 namespace nc
37 {
38  //============================================================================
39  // Method Description:
50  template<typename dtype>
51  auto log1p(dtype inValue) noexcept
52  {
54 
55  return std::log1p(inValue);
56  }
57 
58  //============================================================================
59  // Method Description:
70  template<typename dtype>
71  auto log1p(const NdArray<dtype>& inArray)
72  {
73  NdArray<decltype(log1p(dtype{ 0 }))> returnArray(inArray.shape());
75  inArray.cbegin(),
76  inArray.cend(),
77  returnArray.begin(),
78  [](dtype inValue) noexcept -> auto{ return log1p(inValue); });
79 
80  return returnArray;
81  }
82 } // namespace nc
#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:138
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1308
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4402
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1616
iterator begin() noexcept
Definition: NdArrayCore.hpp:1258
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:775
Definition: Coordinate.hpp:45
auto log1p(const NdArray< dtype > &inArray)
Definition: log1p.hpp:71
auto log1p(dtype inValue) noexcept
Definition: log1p.hpp:51