NumCpp  2.3.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
lcm.hpp
Go to the documentation of this file.
1 #pragma once
29 
32 #include "NumCpp/NdArray.hpp"
33 
34 #include "boost/integer/common_factor_rt.hpp"
35 
36 namespace nc
37 {
38  //============================================================================
39  // Method Description:
49  template<typename dtype>
50  dtype lcm(dtype inValue1, dtype inValue2) noexcept
51  {
52  STATIC_ASSERT_INTEGER(dtype);
53 
54  return boost::integer::lcm(inValue1, inValue2);
55  }
56 
57  //============================================================================
58  // Method Description:
67  template<typename dtype>
68  dtype lcm(const NdArray<dtype>& inArray)
69  {
70  STATIC_ASSERT_INTEGER(dtype);
71 
72  return boost::integer::lcm_range(inArray.cbegin(), inArray.cend()).first;
73  }
74 } // namespace nc
STATIC_ASSERT_INTEGER
#define STATIC_ASSERT_INTEGER(dtype)
Definition: StaticAsserts.hpp:40
StaticAsserts.hpp
Error.hpp
nc::NdArray< dtype >
NdArray.hpp
nc::lcm
dtype lcm(dtype inValue1, dtype inValue2) noexcept
Definition: lcm.hpp:50
nc::NdArray::cend
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1490
nc::lcm
dtype lcm(const NdArray< dtype > &inArray)
Definition: lcm.hpp:68
nc
Definition: Coordinate.hpp:44
nc::NdArray::cbegin
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1146