NumCpp  2.14.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lcm.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include <numeric>
31
32#if defined(__cpp_lib_gcd_lcm) || !defined(NUMCPP_NO_USE_BOOST)
33
36#include "NumCpp/NdArray.hpp"
37
38#ifndef NUMCPP_NO_USE_BOOST
39#include "boost/integer/common_factor_rt.hpp"
40#endif
41
42namespace nc
43{
44 //============================================================================
45 // Method Description:
56 template<typename dtype>
58 {
60
61#ifdef __cpp_lib_gcd_lcm
62 return std::lcm(inValue1, inValue2);
63#else
64 return boost::integer::lcm(inValue1, inValue2);
65#endif
66 }
67
68#ifndef NUMCPP_NO_USE_BOOST
69 //============================================================================
70 // Method Description:
79 template<typename dtype>
81 {
83
84 return boost::integer::lcm_range(inArray.cbegin(), inArray.cend()).first;
85 }
86#endif // #ifndef NUMCPP_NO_USE_BOOST
87} // namespace nc
88
89#endif // #if defined(__cpp_lib_gcd_lcm) || !defined(NUMCPP_NO_USE_BOOST)
#define STATIC_ASSERT_INTEGER(dtype)
Definition StaticAsserts.hpp:43
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
Definition Cartesian.hpp:40
dtype lcm(dtype inValue1, dtype inValue2) noexcept
Definition lcm.hpp:57
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59