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 
13 namespace Eigen {
14 
15 namespace internal {
16 
17 // default functor traits for STL functors:
18 
19 template<typename T>
20 struct functor_traits<std::multiplies<T> >
21 { enum { Cost = NumTraits<T>::MulCost, PacketAccess = false }; };
22 
23 template<typename T>
24 struct functor_traits<std::divides<T> >
25 { enum { Cost = NumTraits<T>::MulCost, PacketAccess = false }; };
26 
27 template<typename T>
28 struct functor_traits<std::plus<T> >
29 { enum { Cost = NumTraits<T>::AddCost, PacketAccess = false }; };
30 
31 template<typename T>
32 struct functor_traits<std::minus<T> >
33 { enum { Cost = NumTraits<T>::AddCost, PacketAccess = false }; };
34 
35 template<typename T>
36 struct functor_traits<std::negate<T> >
37 { enum { Cost = NumTraits<T>::AddCost, PacketAccess = false }; };
38 
39 template<typename T>
40 struct functor_traits<std::logical_or<T> >
41 { enum { Cost = 1, PacketAccess = false }; };
42 
43 template<typename T>
44 struct functor_traits<std::logical_and<T> >
45 { enum { Cost = 1, PacketAccess = false }; };
46 
47 template<typename T>
48 struct functor_traits<std::logical_not<T> >
49 { enum { Cost = 1, PacketAccess = false }; };
50 
51 template<typename T>
52 struct functor_traits<std::greater<T> >
53 { enum { Cost = 1, PacketAccess = false }; };
54 
55 template<typename T>
56 struct functor_traits<std::less<T> >
57 { enum { Cost = 1, PacketAccess = false }; };
58 
59 template<typename T>
60 struct functor_traits<std::greater_equal<T> >
61 { enum { Cost = 1, PacketAccess = false }; };
62 
63 template<typename T>
64 struct functor_traits<std::less_equal<T> >
65 { enum { Cost = 1, PacketAccess = false }; };
66 
67 template<typename T>
68 struct functor_traits<std::equal_to<T> >
69 { enum { Cost = 1, PacketAccess = false }; };
70 
71 template<typename T>
72 struct functor_traits<std::not_equal_to<T> >
73 { enum { Cost = 1, PacketAccess = false }; };
74 
75 #if (__cplusplus < 201103L) && (EIGEN_COMP_MSVC <= 1900)
76 // std::binder* are deprecated since c++11 and will be removed in c++17
77 template<typename T>
78 struct functor_traits<std::binder2nd<T> >
79 { enum { Cost = functor_traits<T>::Cost, PacketAccess = false }; };
80 
81 template<typename T>
82 struct functor_traits<std::binder1st<T> >
83 { enum { Cost = functor_traits<T>::Cost, PacketAccess = false }; };
84 #endif
85 
86 template<typename T>
87 struct functor_traits<std::unary_negate<T> >
88 { enum { Cost = 1 + functor_traits<T>::Cost, PacketAccess = false }; };
89 
90 template<typename T>
91 struct functor_traits<std::binary_negate<T> >
92 { enum { Cost = 1 + functor_traits<T>::Cost, PacketAccess = false }; };
93 
94 #ifdef EIGEN_STDEXT_SUPPORT
95 
96 template<typename T0,typename T1>
97 struct functor_traits<std::project1st<T0,T1> >
98 { enum { Cost = 0, PacketAccess = false }; };
99 
100 template<typename T0,typename T1>
101 struct functor_traits<std::project2nd<T0,T1> >
102 { enum { Cost = 0, PacketAccess = false }; };
103 
104 template<typename T0,typename T1>
105 struct functor_traits<std::select2nd<std::pair<T0,T1> > >
106 { enum { Cost = 0, PacketAccess = false }; };
107 
108 template<typename T0,typename T1>
109 struct functor_traits<std::select1st<std::pair<T0,T1> > >
110 { enum { Cost = 0, PacketAccess = false }; };
111 
112 template<typename T0,typename T1>
113 struct functor_traits<std::unary_compose<T0,T1> >
115 
116 template<typename T0,typename T1,typename T2>
117 struct functor_traits<std::binary_compose<T0,T1,T2> >
119 
120 #endif // EIGEN_STDEXT_SUPPORT
121 
122 // allow to add new functors and specializations of functor_traits from outside Eigen.
123 // this macro is really needed because functor_traits must be specialized after it is declared but before it is used...
124 #ifdef EIGEN_FUNCTORS_PLUGIN
125 #include EIGEN_FUNCTORS_PLUGIN
126 #endif
127 
128 } // end namespace internal
129 
130 } // end namespace Eigen
131 
132 #endif // EIGEN_STL_FUNCTORS_H
Definition: LDLT.h:16
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Definition: NumTraits.h:150


hebiros
Author(s): Xavier Artache , Matthew Tesch
autogenerated on Thu Sep 3 2020 04:09:03