NumCpp  2.7.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
array_equiv.hpp
Go to the documentation of this file.
1 #pragma once
29 
33 #include "NumCpp/NdArray.hpp"
34 
35 #include <complex>
36 
37 namespace nc
38 {
39  //============================================================================
40  // Method Description:
53  template<typename dtype>
54  bool array_equiv(const NdArray<dtype>& inArray1, const NdArray<dtype>& inArray2) noexcept
55  {
57 
58  if (inArray1.size() != inArray2.size())
59  {
60  return false;
61  }
62 
64  {
65  return stl_algorithms::equal(inArray1.cbegin(), inArray1.cend(), inArray2.cbegin());
66  }
67 
68 
69  const auto b = [](dtype value1, dtype value2) noexcept -> bool
70  {
71  return utils::essentiallyEqual(value1, value2);
72  };
73 
74  return stl_algorithms::equal(inArray1.cbegin(), inArray1.cend(), inArray2.cbegin(), b);
75 
76  }
77 } // namespace nc
#define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype)
Definition: StaticAsserts.hpp:50
Holds info about the dtype.
Definition: DtypeInfo.hpp:41
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:72
bool equal(InputIt1 first1, InputIt1 last1, InputIt2 first2) noexcept
Definition: StlAlgorithms.hpp:135
bool essentiallyEqual(dtype inValue1, dtype inValue2) noexcept
Definition: essentiallyEqual.hpp:52
Definition: Coordinate.hpp:45
bool array_equiv(const NdArray< dtype > &inArray1, const NdArray< dtype > &inArray2) noexcept
Definition: array_equiv.hpp:54