NumCpp  2.1.0
A C++ implementation of the Python Numpy library
array_equiv.hpp
Go to the documentation of this file.
1 #pragma once
30 
34 #include "NumCpp/NdArray.hpp"
35 
36 #include <complex>
37 
38 namespace nc
39 {
40  //============================================================================
41  // Method Description:
55  template<typename dtype>
56  bool array_equiv(const NdArray<dtype>& inArray1, const NdArray<dtype>& inArray2) noexcept
57  {
59 
60  if (inArray1.size() != inArray2.size())
61  {
62  return false;
63  }
64 
66  {
67  return stl_algorithms::equal(inArray1.cbegin(), inArray1.cend(), inArray2.cbegin());
68  }
69 
70 
71  const auto b = [](dtype value1, dtype value2) noexcept -> bool
72  {
73  return utils::essentiallyEqual(value1, value2);
74  };
75 
76  return stl_algorithms::equal(inArray1.cbegin(), inArray1.cend(), inArray2.cbegin(), b);
77 
78  }
79 } // namespace nc
StaticAsserts.hpp
nc::utils::essentiallyEqual
bool essentiallyEqual(dtype inValue1, dtype inValue2) noexcept
Definition: essentiallyEqual.hpp:53
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX
#define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype)
Definition: StaticAsserts.hpp:51
nc::array_equiv
bool array_equiv(const NdArray< dtype > &inArray1, const NdArray< dtype > &inArray2) noexcept
Definition: array_equiv.hpp:56
nc::NdArray< dtype >
NdArray.hpp
nc
Definition: Coordinate.hpp:45
nc::DtypeInfo
Holds info about the dtype.
Definition: DtypeInfo.hpp:41
DtypeInfo.hpp
StlAlgorithms.hpp
nc::stl_algorithms::equal
bool equal(InputIt1 first1, InputIt1 last1, InputIt2 first2) noexcept
Definition: StlAlgorithms.hpp:136