NumCpp  1.0
A C++ implementation of the Python Numpy library
cbrt.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:
49  template<typename dtype>
50  double cbrt(dtype inValue) noexcept
51  {
53 
54  return std::cbrt(static_cast<double>(inValue));
55  }
56 
57  //============================================================================
58  // Method Description:
67  template<typename dtype>
69  {
70  NdArray<double> returnArray(inArray.shape());
71  stl_algorithms::transform(inArray.cbegin(), inArray.cend(), returnArray.begin(),
72  [](dtype inValue) noexcept -> double
73  {
74  return cbrt(inValue);
75  });
76 
77  return returnArray;
78  }
79 }
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< double >
NdArray.hpp
nc::cbrt
double cbrt(dtype inValue) noexcept
Definition: cbrt.hpp:50
nc::NdArray::cend
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1491
nc
Definition: Coordinate.hpp:45
nc::cbrt
NdArray< double > cbrt(const NdArray< dtype > &inArray)
Definition: cbrt.hpp:68
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