NumCpp  1.0
A C++ implementation of the Python Numpy library
log1p.hpp
Go to the documentation of this file.
1 #pragma once
30 
31 #include "NumCpp/NdArray.hpp"
34 
35 #include <cmath>
36 
37 namespace nc
38 {
39  //============================================================================
40  // Method Description:
53  template<typename dtype>
54  auto log1p(dtype inValue) noexcept
55  {
57 
58  return std::log1p(inValue);
59  }
60 
61  //============================================================================
62  // Method Description:
75  template<typename dtype>
76  auto log1p(const NdArray<dtype>& inArray)
77  {
78  NdArray<decltype(log1p(dtype{0}))> returnArray(inArray.shape());
79  stl_algorithms::transform(inArray.cbegin(), inArray.cend(), returnArray.begin(),
80  [](dtype inValue) noexcept -> auto
81  {
82  return log1p(inValue);
83  });
84 
85  return returnArray;
86  }
87 }
StaticAsserts.hpp
nc::NdArray::shape
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4296
STATIC_ASSERT_ARITHMETIC
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:38
nc::NdArray< dtype >
nc::log1p
auto log1p(dtype inValue) noexcept
Definition: log1p.hpp:54
NdArray.hpp
nc::NdArray::cend
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1491
nc
Definition: Coordinate.hpp:45
nc::stl_algorithms::transform
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction) noexcept
Definition: StlAlgorithms.hpp:703
nc::NdArray::cbegin
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1147
StlAlgorithms.hpp
nc::NdArray::begin
iterator begin() noexcept
Definition: NdArrayCore.hpp:1091
nc::log1p
auto log1p(const NdArray< dtype > &inArray)
Definition: log1p.hpp:76