NumCpp  2.8.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 
30 #include <complex>
31 
35 #include "NumCpp/NdArray.hpp"
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  const auto comparitor = [](dtype value1, dtype value2) noexcept -> bool
69  { return utils::essentiallyEqual(value1, value2); };
70 
71  return stl_algorithms::equal(inArray1.cbegin(), inArray1.cend(), inArray2.cbegin(), comparitor);
72  }
73 } // namespace nc
#define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype)
Definition: StaticAsserts.hpp:49
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:142
bool essentiallyEqual(dtype inValue1, dtype inValue2) noexcept
Definition: essentiallyEqual.hpp:51
Definition: Coordinate.hpp:45
bool array_equiv(const NdArray< dtype > &inArray1, const NdArray< dtype > &inArray2) noexcept
Definition: array_equiv.hpp:54