NumCpp  2.1.0
A C++ implementation of the Python Numpy library
floor.hpp
Go to the documentation of this file.
1 #pragma once
30 
33 #include "NumCpp/NdArray.hpp"
34 
35 #include <cmath>
36 
37 namespace nc
38 {
39  //============================================================================
40  // Method Description:
48  template<typename dtype>
49  dtype floor(dtype inValue) noexcept
50  {
52 
53  return std::floor(inValue);
54  }
55 
56  //============================================================================
57  // Method Description:
65  template<typename dtype>
67  {
68  NdArray<dtype> returnArray(inArray.shape());
69  stl_algorithms::transform(inArray.cbegin(), inArray.cend(), returnArray.begin(),
70  [](dtype inValue) noexcept -> dtype
71  {
72  return floor(inValue);
73  });
74 
75  return returnArray;
76  }
77 } // namespace nc
StaticAsserts.hpp
nc::NdArray::shape
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4312
STATIC_ASSERT_ARITHMETIC
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:38
nc::NdArray< dtype >
nc::floor
NdArray< dtype > floor(const NdArray< dtype > &inArray)
Definition: floor.hpp:66
nc::stl_algorithms::transform
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:703
nc::floor
dtype floor(dtype inValue) noexcept
Definition: floor.hpp:49
NdArray.hpp
nc::NdArray::cend
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1491
nc
Definition: Coordinate.hpp:45
nc::NdArray::cbegin
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1147
StlAlgorithms.hpp
nc::NdArray::begin
iterator begin() noexcept
Definition: NdArrayCore.hpp:1091