TR-mbed 1.0
Loading...
Searching...
No Matches
StlFunctors.h
Go to the documentation of this file.
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
5//
6// This Source Code Form is subject to the terms of the Mozilla
7// Public License v. 2.0. If a copy of the MPL was not distributed
8// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
10#ifndef EIGEN_STL_FUNCTORS_H
11#define EIGEN_STL_FUNCTORS_H
12
13namespace Eigen {
14
15// Portable replacements for certain functors.
16namespace numext {
17
18template<typename T = void>
19struct equal_to {
20 typedef bool result_type;
21 EIGEN_DEVICE_FUNC bool operator()(const T& lhs, const T& rhs) const {
22 return lhs == rhs;
23 }
24};
25
26template<typename T = void>
28 typedef bool result_type;
29 EIGEN_DEVICE_FUNC bool operator()(const T& lhs, const T& rhs) const {
30 return lhs != rhs;
31 }
32};
33
34}
35
36
37namespace internal {
38
39// default functor traits for STL functors:
40
41template<typename T>
44
45template<typename T>
48
49template<typename T>
51{ enum { Cost = NumTraits<T>::AddCost, PacketAccess = false }; };
52
53template<typename T>
54struct functor_traits<std::minus<T> >
55{ enum { Cost = NumTraits<T>::AddCost, PacketAccess = false }; };
56
57template<typename T>
59{ enum { Cost = NumTraits<T>::AddCost, PacketAccess = false }; };
60
61template<typename T>
63{ enum { Cost = 1, PacketAccess = false }; };
64
65template<typename T>
67{ enum { Cost = 1, PacketAccess = false }; };
68
69template<typename T>
71{ enum { Cost = 1, PacketAccess = false }; };
72
73template<typename T>
75{ enum { Cost = 1, PacketAccess = false }; };
76
77template<typename T>
79{ enum { Cost = 1, PacketAccess = false }; };
80
81template<typename T>
83{ enum { Cost = 1, PacketAccess = false }; };
84
85template<typename T>
87{ enum { Cost = 1, PacketAccess = false }; };
88
89template<typename T>
90struct functor_traits<std::equal_to<T> >
91{ enum { Cost = 1, PacketAccess = false }; };
92
93template<typename T>
94struct functor_traits<numext::equal_to<T> >
95 : functor_traits<std::equal_to<T> > {};
96
97template<typename T>
98struct functor_traits<std::not_equal_to<T> >
99{ enum { Cost = 1, PacketAccess = false }; };
100
101template<typename T>
102struct functor_traits<numext::not_equal_to<T> >
103 : functor_traits<std::not_equal_to<T> > {};
104
105#if (EIGEN_COMP_CXXVER < 11)
106// std::binder* are deprecated since c++11 and will be removed in c++17
107template<typename T>
110
111template<typename T>
114#endif
115
116#if (EIGEN_COMP_CXXVER < 17)
117// std::unary_negate is deprecated since c++17 and will be removed in c++20
118template<typename T>
121
122// std::binary_negate is deprecated since c++17 and will be removed in c++20
123template<typename T>
126#endif
127
128#ifdef EIGEN_STDEXT_SUPPORT
129
130template<typename T0,typename T1>
131struct functor_traits<std::project1st<T0,T1> >
132{ enum { Cost = 0, PacketAccess = false }; };
133
134template<typename T0,typename T1>
135struct functor_traits<std::project2nd<T0,T1> >
136{ enum { Cost = 0, PacketAccess = false }; };
137
138template<typename T0,typename T1>
139struct functor_traits<std::select2nd<std::pair<T0,T1> > >
140{ enum { Cost = 0, PacketAccess = false }; };
141
142template<typename T0,typename T1>
143struct functor_traits<std::select1st<std::pair<T0,T1> > >
144{ enum { Cost = 0, PacketAccess = false }; };
145
146template<typename T0,typename T1>
147struct functor_traits<std::unary_compose<T0,T1> >
149
150template<typename T0,typename T1,typename T2>
151struct functor_traits<std::binary_compose<T0,T1,T2> >
153
154#endif // EIGEN_STDEXT_SUPPORT
155
156// allow to add new functors and specializations of functor_traits from outside Eigen.
157// this macro is really needed because functor_traits must be specialized after it is declared but before it is used...
158#ifdef EIGEN_FUNCTORS_PLUGIN
159#include EIGEN_FUNCTORS_PLUGIN
160#endif
161
162} // end namespace internal
163
164} // end namespace Eigen
165
166#endif // EIGEN_STL_FUNCTORS_H
#define EIGEN_DEVICE_FUNC
Definition Macros.h:976
T negate(const T &x)
Definition packetmath_test_shared.h:24
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
Definition BandTriangularSolver.h:13
Definition BFloat16.h:88
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition NumTraits.h:233
Definition XprHelper.h:176
@ PacketAccess
Definition XprHelper.h:180
@ Cost
Definition XprHelper.h:179
Definition ForwardDeclarations.h:17
Definition StlFunctors.h:19
bool result_type
Definition StlFunctors.h:20
EIGEN_DEVICE_FUNC bool operator()(const T &lhs, const T &rhs) const
Definition StlFunctors.h:21
Definition StlFunctors.h:27
EIGEN_DEVICE_FUNC bool operator()(const T &lhs, const T &rhs) const
Definition StlFunctors.h:29
bool result_type
Definition StlFunctors.h:28