NumCpp  2.14.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions/powerf.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include <string>
31
34#include "NumCpp/Core/Shape.hpp"
35#include "NumCpp/Core/Types.hpp"
36#include "NumCpp/NdArray.hpp"
38
39namespace nc
40{
41 //============================================================================
42 // Method Description:
51 template<typename dtype1, typename dtype2>
53 {
55 }
56
57 //============================================================================
58 // Method Description:
67 template<typename dtype1, typename dtype2>
69 {
70 NdArray<decltype(powerf(dtype1{ 0 }, dtype2{ 0 }))> returnArray(inArray.shape());
72 inArray.cend(),
73 returnArray.begin(),
75 { return nc::powerf(inValue, inExponent); });
76
77 return returnArray;
78 }
79
80 //============================================================================
81 // Method Description:
90 template<typename dtype1, typename dtype2>
92 {
93 if (inArray.shape() != inExponents.shape())
94 {
95 THROW_INVALID_ARGUMENT_ERROR("input array shapes are not consistant.");
96 }
97
98 NdArray<decltype(powerf(dtype1{ 0 }, dtype2{ 0 }))> returnArray(inArray.shape());
100 inArray.cend(),
101 inExponents.cbegin(),
102 returnArray.begin(),
104 { return nc::powerf(inValue, inExponent); });
105
106 return returnArray;
107 }
108} // namespace nc
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition Error.hpp:37
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition StlAlgorithms.hpp:775
auto powerf(dtype1 inValue, const dtype2 inPower) noexcept
Definition Utils/powerf.hpp:47
Definition Cartesian.hpp:40
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59
auto powerf(dtype1 inValue, dtype2 inExponent) noexcept
Definition Functions/powerf.hpp:52