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
ldexp.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include <cmath>
31#include <string>
32
36#include "NumCpp/Core/Types.hpp"
37#include "NumCpp/NdArray.hpp"
38
39namespace nc
40{
41 //============================================================================
42 // Method Description:
52 template<typename dtype>
54 {
56
57 return static_cast<dtype>(std::ldexp(static_cast<double>(inValue1), inValue2));
58 }
59
60 //============================================================================
61 // Method Description:
71 template<typename dtype>
73 {
74 if (inArray1.shape() != inArray2.shape())
75 {
76 THROW_INVALID_ARGUMENT_ERROR("input array shapes are not consistant.");
77 }
78
81 inArray1.cend(),
82 inArray2.cbegin(),
83 returnArray.begin(),
85 { return ldexp(inValue1, inValue2); });
86
87 return returnArray;
88 }
89} // namespace nc
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition Error.hpp:37
#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:139
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition StlAlgorithms.hpp:775
Definition Cartesian.hpp:40
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59
std::uint8_t uint8
Definition Types.hpp:42
dtype ldexp(dtype inValue1, uint8 inValue2) noexcept
Definition ldexp.hpp:53