blob: c466c14c8a0da552f5a393d0358ae38e435ad23b [file] [log] [blame]
Gael Guennebaudcd221a62016-06-01 17:09:48 +02001namespace Eigen {
2
3/** \eigenManualPage CoeffwiseMathFunctions Catalog of coefficient-wise math functions
4
5
6<span style="font-size:300%; color:red; font-weight: 900;">!WORK IN PROGRESS!</span>
7
8This table presents a catalog of the coefficient-wise math functions supported by %Eigen.
9In this table, \c a, \c b, refer to Array objects or expressions, and \c m refers to a linear algebra Matrix/Vector object. Standard scalar types are abbreviated as follows:
10 - \c int: \c ui32
11 - \c float: \c f
12 - \c double: \c d
13 - \c std::complex<float>: \c cf
14 - \c std::complex<double>: \c cd
15
16For each row, the first column list the equivalent calls for arrays, and matrices when supported. Of course, all functions are available for matrices by first casting it as an array: \c m.array().
17
18The third column gives some hints in the underlying scalar implementation. In most cases, %Eigen does not implement itself the math function but relies on the STL for standard scalar types, or user-provided functions for custom scalar types.
19For instance, some simply calls the respective function of the STL while preserving <a href="http://en.cppreference.com/w/cpp/language/adl">argument-dependent lookup</a> for custom types.
20The following:
21\code
22using std::foo;
23foo(a[i]);
24\endcode
25means that the STL's function \c std::foo will be potentially called if it is compatible with the underlying scalar type. If not, then the user must ensure that an overload of the function foo is available for the given scalar type (usually defined in the same namespace as the given scalar type).
26This also means that, unless specified, if the function \c std::foo is available only in some recent c++ versions (e.g., c++11), then the respective %Eigen's function/method will be usable on standard types only if the compiler support the required c++ version.
27
28<table class="manual-hl">
29<tr>
30<th>API</th><th>Description</th><th>Default scalar implementation</th><th>SIMD</th>
31</tr>
32<tr><td colspan="4"></td></tr>
33<tr><th colspan="4">Basic operations</th></tr>
34<tr>
35 <td class="code">
36 \anchor cwisetable_abs
37 a.\link ArrayBase::abs abs\endlink(); \n
38 \link Eigen::abs abs\endlink(a); \n
39 m.\link MatrixBase::cwiseAbs cwiseAbs\endlink();
40 </td>
41 <td>absolute value (\f$ |a_i| \f$) </td>
42 <td class="code">
43 using <a href="http://en.cppreference.com/w/cpp/numeric/math/fabs">std::abs</a>; \n
44 abs(a[i]);
45 </td>
46 <td>SSE2, AVX (ui32,f,d)</td>
47</tr>
48<tr>
49<th colspan="4">Exponential functions</th>
50</tr>
51<tr>
52 <td class="code">
53 \anchor cwisetable_exp
54 a.\link ArrayBase::exp exp\endlink(); \n
55 \link Eigen::exp exp\endlink(a);
56 </td>
57 <td>\f$ e \f$ raised to the given power (\f$ e^{a_i} \f$) </td>
58 <td class="code">
59 using <a href="http://en.cppreference.com/w/cpp/numeric/math/exp">std::exp</a>; \n
60 exp(a[i]);
61 </td>
62 <td>SSE2, AVX (f,d)</td>
63</tr>
64<tr>
65 <td class="code">
66 \anchor cwisetable_log
67 a.\link ArrayBase::log log\endlink(); \n
68 \link Eigen::log log\endlink(a);
69 </td>
70 <td>natural (base \f$ e \f$) logarithm (\f$ ln({a_i}) \f$)</td>
71 <td class="code">
72 using <a href="http://en.cppreference.com/w/cpp/numeric/math/log">std::log</a>; \n
73 log(a[i]);
74 </td>
75 <td>SSE2, AVX (f,d)</td>
76</tr>
77<tr>
78 <td class="code">
79 \anchor cwisetable_log1p
80 a.\link ArrayBase::log1p log1p\endlink(); \n
81 \link Eigen::log1p log1p\endlink(a);
82 </td>
83 <td>natural (base \f$ e \f$) logarithm of 1 plus \n the given number (\f$ ln({1+a_i}) \f$)</td>
84 <td>built-in generic implementation based on \c log,\n
85 plus \c using <a href="http://en.cppreference.com/w/cpp/numeric/math/log1p">\c std::log1p </a>; \cpp11</td>
86 <td></td>
87</tr>
88<tr>
89<th colspan="4">Power functions</th>
90</tr>
91<tr>
92<th colspan="4">Trigonometric functions</th>
93</tr>
94<tr>
95<th colspan="4">Hyperbolic functions</th>
96</tr>
97<tr>
98<th colspan="4">Error and gamma functions</th>
99</tr>
100<tr>
101 <td class="code">
102 \anchor cwisetable_erf
103 a.\link ArrayBase::erf erf\endlink(); \n
104 \link Eigen::erf erf\endlink(a);
105 </td>
106 <td>error function</td>
107 <td class="code">
108 using <a href="http://en.cppreference.com/w/cpp/numeric/math/erf">std::erf</a>; \cpp11 \n
109 erf(a[i]);
110 </td>
111 <td></td>
112</tr>
113<tr>
114 <td class="code">
115 \anchor cwisetable_erfc
116 a.\link ArrayBase::erfc erfc\endlink(); \n
117 \link Eigen::erfc erfc\endlink(a);
118 </td>
119 <td>complementary error function</td>
120 <td class="code">
121 using <a href="http://en.cppreference.com/w/cpp/numeric/math/erfc">std::erfc</a>; \cpp11 \n
122 erfc(a[i]);
123 </td>
124 <td></td>
125</tr>
126<tr>
127<th colspan="4">Nearest integer floating point operations</th>
128</tr>
129<tr>
130<th colspan="4">Floating point manipulation functions</th>
131</tr>
132<tr>
133<th colspan="4">Classification and comparison</th>
134</tr>
135<tr>
136<th colspan="4">Miscellaneous</th>
137</tr>
138<tr>
139 <td class="code">
140 \anchor cwisetable_zeta
141 a.\link ArrayBase::zeta zeta\endlink(b); \n
142 \link Eigen::zeta zeta\endlink(a,b);
143 </td>
144 <td><a href="https://en.wikipedia.org/wiki/Hurwitz_zeta_function">Hurwitz zeta function</a> \n \f$ \zeta(a_i,b_i)=\sum_{k=0}^{\infty}(b_i+k)^{\text{-}a_i} \f$</td>
145 <td>
146 built-in for float and double
147 </td>
148 <td></td>
149</tr>
150<tr><td colspan="4"></td></tr>
151</table>
152
153\n
154
155*/
156
157}