working version with calibration done

Fork of Eurobot2013 by Oskar Weigl

Committer:
xiaxia686
Date:
Tue Apr 09 15:32:47 2013 +0000
Revision:
11:5ba926692210
Parent:
1:6799c07fe510
woking version (calibrated)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sv 1:6799c07fe510 1 /*
sv 1:6799c07fe510 2 * Tiny Vector Matrix Library
sv 1:6799c07fe510 3 * Dense Vector Matrix Libary of Tiny size using Expression Templates
sv 1:6799c07fe510 4 *
sv 1:6799c07fe510 5 * Copyright (C) 2001 - 2007 Olaf Petzold <opetzold@users.sourceforge.net>
sv 1:6799c07fe510 6 *
sv 1:6799c07fe510 7 * This library is free software; you can redistribute it and/or
sv 1:6799c07fe510 8 * modify it under the terms of the GNU Lesser General Public
sv 1:6799c07fe510 9 * License as published by the Free Software Foundation; either
sv 1:6799c07fe510 10 * version 2.1 of the License, or (at your option) any later version.
sv 1:6799c07fe510 11 *
sv 1:6799c07fe510 12 * This library is distributed in the hope that it will be useful,
sv 1:6799c07fe510 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
sv 1:6799c07fe510 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
sv 1:6799c07fe510 15 * Lesser General Public License for more details.
sv 1:6799c07fe510 16 *
sv 1:6799c07fe510 17 * You should have received a copy of the GNU Lesser General Public
sv 1:6799c07fe510 18 * License along with this library; if not, write to the Free Software
sv 1:6799c07fe510 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
sv 1:6799c07fe510 20 *
sv 1:6799c07fe510 21 * $Id: VectorBinaryFunctions.h,v 1.17 2007-06-23 15:58:58 opetzold Exp $
sv 1:6799c07fe510 22 */
sv 1:6799c07fe510 23
sv 1:6799c07fe510 24 #ifndef TVMET_VECTOR_BINARY_FUNCTIONS_H
sv 1:6799c07fe510 25 #define TVMET_VECTOR_BINARY_FUNCTIONS_H
sv 1:6799c07fe510 26
sv 1:6799c07fe510 27 #include <tvmet/NumericTraits.h>
sv 1:6799c07fe510 28 #include <tvmet/Extremum.h>
sv 1:6799c07fe510 29
sv 1:6799c07fe510 30 namespace tvmet {
sv 1:6799c07fe510 31
sv 1:6799c07fe510 32
sv 1:6799c07fe510 33 /*********************************************************
sv 1:6799c07fe510 34 * PART I: DECLARATION
sv 1:6799c07fe510 35 *********************************************************/
sv 1:6799c07fe510 36
sv 1:6799c07fe510 37 /*
sv 1:6799c07fe510 38 * binary_function(Vector<T1, Sz>, Vector<T1, Sz>)
sv 1:6799c07fe510 39 * binary_function(Vector<T, Sz>, XprVector<E>)
sv 1:6799c07fe510 40 * binary_function(XprVector<E>, Vector<T, Sz>)
sv 1:6799c07fe510 41 */
sv 1:6799c07fe510 42 #define TVMET_DECLARE_MACRO(NAME) \
sv 1:6799c07fe510 43 template<class T1, class T2, std::size_t Sz> \
sv 1:6799c07fe510 44 inline \
sv 1:6799c07fe510 45 XprVector< \
sv 1:6799c07fe510 46 XprBinOp< \
sv 1:6799c07fe510 47 Fcnl_##NAME<T1, T2>, \
sv 1:6799c07fe510 48 VectorConstReference<T1, Sz>, \
sv 1:6799c07fe510 49 VectorConstReference<T2, Sz> \
sv 1:6799c07fe510 50 >, \
sv 1:6799c07fe510 51 Sz \
sv 1:6799c07fe510 52 > \
sv 1:6799c07fe510 53 NAME(const Vector<T1, Sz>& lhs, \
sv 1:6799c07fe510 54 const Vector<T2, Sz>& rhs) TVMET_CXX_ALWAYS_INLINE; \
sv 1:6799c07fe510 55 \
sv 1:6799c07fe510 56 template<class E, class T, std::size_t Sz> \
sv 1:6799c07fe510 57 inline \
sv 1:6799c07fe510 58 XprVector< \
sv 1:6799c07fe510 59 XprBinOp< \
sv 1:6799c07fe510 60 Fcnl_##NAME<typename E::value_type, T>, \
sv 1:6799c07fe510 61 VectorConstReference<T, Sz>, \
sv 1:6799c07fe510 62 XprVector<E, Sz> \
sv 1:6799c07fe510 63 >, \
sv 1:6799c07fe510 64 Sz \
sv 1:6799c07fe510 65 > \
sv 1:6799c07fe510 66 NAME(const XprVector<E, Sz>& lhs, \
sv 1:6799c07fe510 67 const Vector<T, Sz>& rhs) TVMET_CXX_ALWAYS_INLINE; \
sv 1:6799c07fe510 68 \
sv 1:6799c07fe510 69 template<class E, class T, std::size_t Sz> \
sv 1:6799c07fe510 70 inline \
sv 1:6799c07fe510 71 XprVector< \
sv 1:6799c07fe510 72 XprBinOp< \
sv 1:6799c07fe510 73 Fcnl_##NAME<T, typename E::value_type>, \
sv 1:6799c07fe510 74 VectorConstReference<T, Sz>, \
sv 1:6799c07fe510 75 XprVector<E, Sz> \
sv 1:6799c07fe510 76 >, \
sv 1:6799c07fe510 77 Sz \
sv 1:6799c07fe510 78 > \
sv 1:6799c07fe510 79 NAME(const Vector<T, Sz>& lhs, \
sv 1:6799c07fe510 80 const XprVector<E, Sz>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 81
sv 1:6799c07fe510 82 TVMET_DECLARE_MACRO(atan2)
sv 1:6799c07fe510 83 TVMET_DECLARE_MACRO(drem)
sv 1:6799c07fe510 84 TVMET_DECLARE_MACRO(fmod)
sv 1:6799c07fe510 85 TVMET_DECLARE_MACRO(hypot)
sv 1:6799c07fe510 86 TVMET_DECLARE_MACRO(jn)
sv 1:6799c07fe510 87 TVMET_DECLARE_MACRO(yn)
sv 1:6799c07fe510 88 TVMET_DECLARE_MACRO(pow)
sv 1:6799c07fe510 89 #if defined(TVMET_HAVE_COMPLEX)
sv 1:6799c07fe510 90 TVMET_DECLARE_MACRO(polar)
sv 1:6799c07fe510 91 #endif
sv 1:6799c07fe510 92
sv 1:6799c07fe510 93 #undef TVMET_DECLARE_MACRO
sv 1:6799c07fe510 94
sv 1:6799c07fe510 95
sv 1:6799c07fe510 96 /*
sv 1:6799c07fe510 97 * binary_function(Vector<T, Sz>, POD)
sv 1:6799c07fe510 98 */
sv 1:6799c07fe510 99 #define TVMET_DECLARE_MACRO(NAME, TP) \
sv 1:6799c07fe510 100 template<class T, std::size_t Sz> \
sv 1:6799c07fe510 101 inline \
sv 1:6799c07fe510 102 XprVector< \
sv 1:6799c07fe510 103 XprBinOp< \
sv 1:6799c07fe510 104 Fcnl_##NAME<T, TP >, \
sv 1:6799c07fe510 105 VectorConstReference<T, Sz>, \
sv 1:6799c07fe510 106 XprLiteral< TP > \
sv 1:6799c07fe510 107 >, \
sv 1:6799c07fe510 108 Sz \
sv 1:6799c07fe510 109 > \
sv 1:6799c07fe510 110 NAME(const Vector<T, Sz>& lhs, TP rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 111
sv 1:6799c07fe510 112 TVMET_DECLARE_MACRO(atan2, int)
sv 1:6799c07fe510 113 TVMET_DECLARE_MACRO(drem, int)
sv 1:6799c07fe510 114 TVMET_DECLARE_MACRO(fmod, int)
sv 1:6799c07fe510 115 TVMET_DECLARE_MACRO(hypot, int)
sv 1:6799c07fe510 116 TVMET_DECLARE_MACRO(jn, int)
sv 1:6799c07fe510 117 TVMET_DECLARE_MACRO(yn, int)
sv 1:6799c07fe510 118 TVMET_DECLARE_MACRO(pow, int)
sv 1:6799c07fe510 119
sv 1:6799c07fe510 120 #if defined(TVMET_HAVE_LONG_LONG)
sv 1:6799c07fe510 121 TVMET_DECLARE_MACRO(atan2, long long int)
sv 1:6799c07fe510 122 TVMET_DECLARE_MACRO(drem, long long int)
sv 1:6799c07fe510 123 TVMET_DECLARE_MACRO(fmod, long long int)
sv 1:6799c07fe510 124 TVMET_DECLARE_MACRO(hypot, long long int)
sv 1:6799c07fe510 125 TVMET_DECLARE_MACRO(jn, long long int)
sv 1:6799c07fe510 126 TVMET_DECLARE_MACRO(yn, long long int)
sv 1:6799c07fe510 127 TVMET_DECLARE_MACRO(pow, long long int)
sv 1:6799c07fe510 128 #endif // defined(TVMET_HAVE_LONG_LONG)
sv 1:6799c07fe510 129
sv 1:6799c07fe510 130 TVMET_DECLARE_MACRO(atan2, float)
sv 1:6799c07fe510 131 TVMET_DECLARE_MACRO(drem, float)
sv 1:6799c07fe510 132 TVMET_DECLARE_MACRO(fmod, float)
sv 1:6799c07fe510 133 TVMET_DECLARE_MACRO(hypot, float)
sv 1:6799c07fe510 134 TVMET_DECLARE_MACRO(jn, float)
sv 1:6799c07fe510 135 TVMET_DECLARE_MACRO(yn, float)
sv 1:6799c07fe510 136 TVMET_DECLARE_MACRO(pow, float)
sv 1:6799c07fe510 137
sv 1:6799c07fe510 138 TVMET_DECLARE_MACRO(atan2, double)
sv 1:6799c07fe510 139 TVMET_DECLARE_MACRO(drem, double)
sv 1:6799c07fe510 140 TVMET_DECLARE_MACRO(fmod, double)
sv 1:6799c07fe510 141 TVMET_DECLARE_MACRO(hypot, double)
sv 1:6799c07fe510 142 TVMET_DECLARE_MACRO(jn, double)
sv 1:6799c07fe510 143 TVMET_DECLARE_MACRO(yn, double)
sv 1:6799c07fe510 144 TVMET_DECLARE_MACRO(pow, double)
sv 1:6799c07fe510 145
sv 1:6799c07fe510 146 #if defined(TVMET_HAVE_LONG_DOUBLE)
sv 1:6799c07fe510 147 TVMET_DECLARE_MACRO(atan2, long double)
sv 1:6799c07fe510 148 TVMET_DECLARE_MACRO(drem, long double)
sv 1:6799c07fe510 149 TVMET_DECLARE_MACRO(fmod, long double)
sv 1:6799c07fe510 150 TVMET_DECLARE_MACRO(hypot, long double)
sv 1:6799c07fe510 151 TVMET_DECLARE_MACRO(jn, long double)
sv 1:6799c07fe510 152 TVMET_DECLARE_MACRO(yn, long double)
sv 1:6799c07fe510 153 TVMET_DECLARE_MACRO(pow, long double)
sv 1:6799c07fe510 154 #endif // defined(TVMET_HAVE_LONG_DOUBLE)
sv 1:6799c07fe510 155
sv 1:6799c07fe510 156 #undef TVMET_DECLARE_MACRO
sv 1:6799c07fe510 157
sv 1:6799c07fe510 158
sv 1:6799c07fe510 159 /*
sv 1:6799c07fe510 160 * complex support
sv 1:6799c07fe510 161 */
sv 1:6799c07fe510 162
sv 1:6799c07fe510 163 #if defined(TVMET_HAVE_COMPLEX) && defined(TVMET_HAVE_COMPLEX_MATH1)
sv 1:6799c07fe510 164 template<class T, std::size_t Sz>
sv 1:6799c07fe510 165 XprVector<
sv 1:6799c07fe510 166 XprBinOp<
sv 1:6799c07fe510 167 Fcnl_pow<T, std::complex<T> >,
sv 1:6799c07fe510 168 VectorConstReference<T, Sz>,
sv 1:6799c07fe510 169 XprLiteral< std::complex<T> >
sv 1:6799c07fe510 170 >,
sv 1:6799c07fe510 171 Sz
sv 1:6799c07fe510 172 >
sv 1:6799c07fe510 173 pow(const Vector<T, Sz>& lhs,
sv 1:6799c07fe510 174 const std::complex<T>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 175
sv 1:6799c07fe510 176
sv 1:6799c07fe510 177 template<class T, std::size_t Sz>
sv 1:6799c07fe510 178 XprVector<
sv 1:6799c07fe510 179 XprBinOp<
sv 1:6799c07fe510 180 Fcnl_pow<std::complex<T>, std::complex<T> >,
sv 1:6799c07fe510 181 VectorConstReference<std::complex<T>, Sz>,
sv 1:6799c07fe510 182 XprLiteral< std::complex<T> >
sv 1:6799c07fe510 183 >,
sv 1:6799c07fe510 184 Sz
sv 1:6799c07fe510 185 >
sv 1:6799c07fe510 186 pow(const Vector<std::complex<T>, Sz>& lhs,
sv 1:6799c07fe510 187 const std::complex<T>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 188
sv 1:6799c07fe510 189
sv 1:6799c07fe510 190 template<class T, std::size_t Sz>
sv 1:6799c07fe510 191 XprVector<
sv 1:6799c07fe510 192 XprBinOp<
sv 1:6799c07fe510 193 Fcnl_pow<std::complex<T>, T>,
sv 1:6799c07fe510 194 VectorConstReference<std::complex<T>, Sz>,
sv 1:6799c07fe510 195 XprLiteral<T>
sv 1:6799c07fe510 196 >,
sv 1:6799c07fe510 197 Sz
sv 1:6799c07fe510 198 >
sv 1:6799c07fe510 199 pow(const Vector<std::complex<T>, Sz>& lhs,
sv 1:6799c07fe510 200 const T& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 201
sv 1:6799c07fe510 202
sv 1:6799c07fe510 203 template<class T, std::size_t Sz>
sv 1:6799c07fe510 204 XprVector<
sv 1:6799c07fe510 205 XprBinOp<
sv 1:6799c07fe510 206 Fcnl_pow<std::complex<T>, int>,
sv 1:6799c07fe510 207 VectorConstReference<std::complex<T>, Sz>,
sv 1:6799c07fe510 208 XprLiteral<int>
sv 1:6799c07fe510 209 >,
sv 1:6799c07fe510 210 Sz
sv 1:6799c07fe510 211 >
sv 1:6799c07fe510 212 pow(const Vector<std::complex<T>, Sz>& lhs,
sv 1:6799c07fe510 213 int rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 214
sv 1:6799c07fe510 215
sv 1:6799c07fe510 216 template<class T, std::size_t Sz>
sv 1:6799c07fe510 217 XprVector<
sv 1:6799c07fe510 218 XprBinOp<
sv 1:6799c07fe510 219 Fcnl_polar<T, T>,
sv 1:6799c07fe510 220 VectorConstReference<T, Sz>,
sv 1:6799c07fe510 221 XprLiteral<T>
sv 1:6799c07fe510 222 >,
sv 1:6799c07fe510 223 Sz
sv 1:6799c07fe510 224 >
sv 1:6799c07fe510 225 polar(const Vector<T, Sz>& lhs, const T& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 226
sv 1:6799c07fe510 227 #endif // defined(TVMET_HAVE_COMPLEX) && defined(TVMET_HAVE_COMPLEX_MATH1)
sv 1:6799c07fe510 228
sv 1:6799c07fe510 229 #if defined(TVMET_HAVE_COMPLEX) && defined(TVMET_HAVE_COMPLEX_MATH2)
sv 1:6799c07fe510 230 // to be written (atan2)
sv 1:6799c07fe510 231 #endif // defined(TVMET_HAVE_COMPLEX) && defined(TVMET_HAVE_COMPLEX_MATH2)
sv 1:6799c07fe510 232
sv 1:6799c07fe510 233
sv 1:6799c07fe510 234 /*********************************************************
sv 1:6799c07fe510 235 * PART II: IMPLEMENTATION
sv 1:6799c07fe510 236 *********************************************************/
sv 1:6799c07fe510 237
sv 1:6799c07fe510 238 /*
sv 1:6799c07fe510 239 * binary_function(Vector<T1, Sz>, Vector<T1, Sz>)
sv 1:6799c07fe510 240 * binary_function(Vector<T, Sz>, XprVector<E>)
sv 1:6799c07fe510 241 * binary_function(XprVector<E>, Vector<T, Sz>)
sv 1:6799c07fe510 242 */
sv 1:6799c07fe510 243 #define TVMET_IMPLEMENT_MACRO(NAME) \
sv 1:6799c07fe510 244 template<class T1, class T2, std::size_t Sz> \
sv 1:6799c07fe510 245 inline \
sv 1:6799c07fe510 246 XprVector< \
sv 1:6799c07fe510 247 XprBinOp< \
sv 1:6799c07fe510 248 Fcnl_##NAME<T1, T2>, \
sv 1:6799c07fe510 249 VectorConstReference<T1, Sz>, \
sv 1:6799c07fe510 250 VectorConstReference<T2, Sz> \
sv 1:6799c07fe510 251 >, \
sv 1:6799c07fe510 252 Sz \
sv 1:6799c07fe510 253 > \
sv 1:6799c07fe510 254 NAME(const Vector<T1, Sz>& lhs, const Vector<T2, Sz>& rhs) { \
sv 1:6799c07fe510 255 typedef XprBinOp < \
sv 1:6799c07fe510 256 Fcnl_##NAME<T1, T2>, \
sv 1:6799c07fe510 257 VectorConstReference<T1, Sz>, \
sv 1:6799c07fe510 258 VectorConstReference<T2, Sz> \
sv 1:6799c07fe510 259 > expr_type; \
sv 1:6799c07fe510 260 return XprVector<expr_type, Sz>( \
sv 1:6799c07fe510 261 expr_type(lhs.const_ref(), rhs.const_ref())); \
sv 1:6799c07fe510 262 } \
sv 1:6799c07fe510 263 \
sv 1:6799c07fe510 264 template<class E, class T, std::size_t Sz> \
sv 1:6799c07fe510 265 inline \
sv 1:6799c07fe510 266 XprVector< \
sv 1:6799c07fe510 267 XprBinOp< \
sv 1:6799c07fe510 268 Fcnl_##NAME<typename E::value_type, T>, \
sv 1:6799c07fe510 269 VectorConstReference<T, Sz>, \
sv 1:6799c07fe510 270 XprVector<E, Sz> \
sv 1:6799c07fe510 271 >, \
sv 1:6799c07fe510 272 Sz \
sv 1:6799c07fe510 273 > \
sv 1:6799c07fe510 274 NAME(const XprVector<E, Sz>& lhs, const Vector<T, Sz>& rhs) { \
sv 1:6799c07fe510 275 typedef XprBinOp< \
sv 1:6799c07fe510 276 Fcnl_##NAME<typename E::value_type, T>, \
sv 1:6799c07fe510 277 XprVector<E, Sz>, \
sv 1:6799c07fe510 278 VectorConstReference<T, Sz> \
sv 1:6799c07fe510 279 > expr_type; \
sv 1:6799c07fe510 280 return XprVector<expr_type, Sz>( \
sv 1:6799c07fe510 281 expr_type(lhs, rhs.const_ref())); \
sv 1:6799c07fe510 282 } \
sv 1:6799c07fe510 283 \
sv 1:6799c07fe510 284 template<class E, class T, std::size_t Sz> \
sv 1:6799c07fe510 285 inline \
sv 1:6799c07fe510 286 XprVector< \
sv 1:6799c07fe510 287 XprBinOp< \
sv 1:6799c07fe510 288 Fcnl_##NAME<T, typename E::value_type>, \
sv 1:6799c07fe510 289 VectorConstReference<T, Sz>, \
sv 1:6799c07fe510 290 XprVector<E, Sz> \
sv 1:6799c07fe510 291 >, \
sv 1:6799c07fe510 292 Sz \
sv 1:6799c07fe510 293 > \
sv 1:6799c07fe510 294 NAME(const Vector<T, Sz>& lhs, const XprVector<E, Sz>& rhs) { \
sv 1:6799c07fe510 295 typedef XprBinOp< \
sv 1:6799c07fe510 296 Fcnl_##NAME<T, typename E::value_type>, \
sv 1:6799c07fe510 297 VectorConstReference<T, Sz>, \
sv 1:6799c07fe510 298 XprVector<E, Sz> \
sv 1:6799c07fe510 299 > expr_type; \
sv 1:6799c07fe510 300 return XprVector<expr_type, Sz>( \
sv 1:6799c07fe510 301 expr_type(lhs.const_ref(), rhs)); \
sv 1:6799c07fe510 302 }
sv 1:6799c07fe510 303
sv 1:6799c07fe510 304 TVMET_IMPLEMENT_MACRO(atan2)
sv 1:6799c07fe510 305 TVMET_IMPLEMENT_MACRO(drem)
sv 1:6799c07fe510 306 TVMET_IMPLEMENT_MACRO(fmod)
sv 1:6799c07fe510 307 TVMET_IMPLEMENT_MACRO(hypot)
sv 1:6799c07fe510 308 TVMET_IMPLEMENT_MACRO(jn)
sv 1:6799c07fe510 309 TVMET_IMPLEMENT_MACRO(yn)
sv 1:6799c07fe510 310 TVMET_IMPLEMENT_MACRO(pow)
sv 1:6799c07fe510 311 #if defined(TVMET_HAVE_COMPLEX)
sv 1:6799c07fe510 312 TVMET_IMPLEMENT_MACRO(polar)
sv 1:6799c07fe510 313 #endif
sv 1:6799c07fe510 314
sv 1:6799c07fe510 315 #undef TVMET_IMPLEMENT_MACRO
sv 1:6799c07fe510 316
sv 1:6799c07fe510 317
sv 1:6799c07fe510 318 /*
sv 1:6799c07fe510 319 * binary_function(Vector<T, Sz>, POD)
sv 1:6799c07fe510 320 */
sv 1:6799c07fe510 321 #define TVMET_IMPLEMENT_MACRO(NAME, TP) \
sv 1:6799c07fe510 322 template<class T, std::size_t Sz> \
sv 1:6799c07fe510 323 inline \
sv 1:6799c07fe510 324 XprVector< \
sv 1:6799c07fe510 325 XprBinOp< \
sv 1:6799c07fe510 326 Fcnl_##NAME<T, TP >, \
sv 1:6799c07fe510 327 VectorConstReference<T, Sz>, \
sv 1:6799c07fe510 328 XprLiteral< TP > \
sv 1:6799c07fe510 329 >, \
sv 1:6799c07fe510 330 Sz \
sv 1:6799c07fe510 331 > \
sv 1:6799c07fe510 332 NAME(const Vector<T, Sz>& lhs, TP rhs) { \
sv 1:6799c07fe510 333 typedef XprBinOp< \
sv 1:6799c07fe510 334 Fcnl_##NAME<T, TP >, \
sv 1:6799c07fe510 335 VectorConstReference<T, Sz>, \
sv 1:6799c07fe510 336 XprLiteral< TP > \
sv 1:6799c07fe510 337 > expr_type; \
sv 1:6799c07fe510 338 return XprVector<expr_type, Sz>( \
sv 1:6799c07fe510 339 expr_type(lhs.const_ref(), XprLiteral< TP >(rhs))); \
sv 1:6799c07fe510 340 }
sv 1:6799c07fe510 341
sv 1:6799c07fe510 342 TVMET_IMPLEMENT_MACRO(atan2, int)
sv 1:6799c07fe510 343 TVMET_IMPLEMENT_MACRO(drem, int)
sv 1:6799c07fe510 344 TVMET_IMPLEMENT_MACRO(fmod, int)
sv 1:6799c07fe510 345 TVMET_IMPLEMENT_MACRO(hypot, int)
sv 1:6799c07fe510 346 TVMET_IMPLEMENT_MACRO(jn, int)
sv 1:6799c07fe510 347 TVMET_IMPLEMENT_MACRO(yn, int)
sv 1:6799c07fe510 348 TVMET_IMPLEMENT_MACRO(pow, int)
sv 1:6799c07fe510 349
sv 1:6799c07fe510 350 #if defined(TVMET_HAVE_LONG_LONG)
sv 1:6799c07fe510 351 TVMET_IMPLEMENT_MACRO(atan2, long long int)
sv 1:6799c07fe510 352 TVMET_IMPLEMENT_MACRO(drem, long long int)
sv 1:6799c07fe510 353 TVMET_IMPLEMENT_MACRO(fmod, long long int)
sv 1:6799c07fe510 354 TVMET_IMPLEMENT_MACRO(hypot, long long int)
sv 1:6799c07fe510 355 TVMET_IMPLEMENT_MACRO(jn, long long int)
sv 1:6799c07fe510 356 TVMET_IMPLEMENT_MACRO(yn, long long int)
sv 1:6799c07fe510 357 TVMET_IMPLEMENT_MACRO(pow, long long int)
sv 1:6799c07fe510 358 #endif // defined(TVMET_HAVE_LONG_LONG)
sv 1:6799c07fe510 359
sv 1:6799c07fe510 360 TVMET_IMPLEMENT_MACRO(atan2, float)
sv 1:6799c07fe510 361 TVMET_IMPLEMENT_MACRO(drem, float)
sv 1:6799c07fe510 362 TVMET_IMPLEMENT_MACRO(fmod, float)
sv 1:6799c07fe510 363 TVMET_IMPLEMENT_MACRO(hypot, float)
sv 1:6799c07fe510 364 TVMET_IMPLEMENT_MACRO(jn, float)
sv 1:6799c07fe510 365 TVMET_IMPLEMENT_MACRO(yn, float)
sv 1:6799c07fe510 366 TVMET_IMPLEMENT_MACRO(pow, float)
sv 1:6799c07fe510 367
sv 1:6799c07fe510 368 TVMET_IMPLEMENT_MACRO(atan2, double)
sv 1:6799c07fe510 369 TVMET_IMPLEMENT_MACRO(drem, double)
sv 1:6799c07fe510 370 TVMET_IMPLEMENT_MACRO(fmod, double)
sv 1:6799c07fe510 371 TVMET_IMPLEMENT_MACRO(hypot, double)
sv 1:6799c07fe510 372 TVMET_IMPLEMENT_MACRO(jn, double)
sv 1:6799c07fe510 373 TVMET_IMPLEMENT_MACRO(yn, double)
sv 1:6799c07fe510 374 TVMET_IMPLEMENT_MACRO(pow, double)
sv 1:6799c07fe510 375
sv 1:6799c07fe510 376 #if defined(TVMET_HAVE_LONG_DOUBLE)
sv 1:6799c07fe510 377 TVMET_IMPLEMENT_MACRO(atan2, long double)
sv 1:6799c07fe510 378 TVMET_IMPLEMENT_MACRO(drem, long double)
sv 1:6799c07fe510 379 TVMET_IMPLEMENT_MACRO(fmod, long double)
sv 1:6799c07fe510 380 TVMET_IMPLEMENT_MACRO(hypot, long double)
sv 1:6799c07fe510 381 TVMET_IMPLEMENT_MACRO(jn, long double)
sv 1:6799c07fe510 382 TVMET_IMPLEMENT_MACRO(yn, long double)
sv 1:6799c07fe510 383 TVMET_IMPLEMENT_MACRO(pow, long double)
sv 1:6799c07fe510 384 #endif // defined(TVMET_HAVE_LONG_DOUBLE)
sv 1:6799c07fe510 385
sv 1:6799c07fe510 386 #undef TVMET_IMPLEMENT_MACRO
sv 1:6799c07fe510 387
sv 1:6799c07fe510 388
sv 1:6799c07fe510 389 /*
sv 1:6799c07fe510 390 * complex support
sv 1:6799c07fe510 391 */
sv 1:6799c07fe510 392
sv 1:6799c07fe510 393 #if defined(TVMET_HAVE_COMPLEX) && defined(TVMET_HAVE_COMPLEX_MATH1)
sv 1:6799c07fe510 394 /**
sv 1:6799c07fe510 395 * \fn pow(const Vector<T, Sz>& lhs, const std::complex<T>& rhs)
sv 1:6799c07fe510 396 * \ingroup _binary_function
sv 1:6799c07fe510 397 */
sv 1:6799c07fe510 398 template<class T, std::size_t Sz>
sv 1:6799c07fe510 399 inline
sv 1:6799c07fe510 400 XprVector<
sv 1:6799c07fe510 401 XprBinOp<
sv 1:6799c07fe510 402 Fcnl_pow<T, std::complex<T> >,
sv 1:6799c07fe510 403 VectorConstReference<T, Sz>,
sv 1:6799c07fe510 404 XprLiteral< std::complex<T> >
sv 1:6799c07fe510 405 >,
sv 1:6799c07fe510 406 Sz
sv 1:6799c07fe510 407 >
sv 1:6799c07fe510 408 pow(const Vector<T, Sz>& lhs, const std::complex<T>& rhs) {
sv 1:6799c07fe510 409 typedef XprBinOp<
sv 1:6799c07fe510 410 Fcnl_pow<T, std::complex<T> >,
sv 1:6799c07fe510 411 VectorConstReference<T, Sz>,
sv 1:6799c07fe510 412 XprLiteral< std::complex<T> >
sv 1:6799c07fe510 413 > expr_type;
sv 1:6799c07fe510 414 return XprVector<expr_type, Sz>(
sv 1:6799c07fe510 415 expr_type(lhs.const_ref(), XprLiteral< std::complex<T> >(rhs)));
sv 1:6799c07fe510 416 }
sv 1:6799c07fe510 417
sv 1:6799c07fe510 418
sv 1:6799c07fe510 419 /**
sv 1:6799c07fe510 420 * \fn pow(const Vector<std::complex<T>, Sz>& lhs, const std::complex<T>& rhs)
sv 1:6799c07fe510 421 * \ingroup _binary_function
sv 1:6799c07fe510 422 */
sv 1:6799c07fe510 423 template<class T, std::size_t Sz>
sv 1:6799c07fe510 424 inline
sv 1:6799c07fe510 425 XprVector<
sv 1:6799c07fe510 426 XprBinOp<
sv 1:6799c07fe510 427 Fcnl_pow<std::complex<T>, std::complex<T> >,
sv 1:6799c07fe510 428 VectorConstReference<std::complex<T>, Sz>,
sv 1:6799c07fe510 429 XprLiteral< std::complex<T> >
sv 1:6799c07fe510 430 >,
sv 1:6799c07fe510 431 Sz
sv 1:6799c07fe510 432 >
sv 1:6799c07fe510 433 pow(const Vector<std::complex<T>, Sz>& lhs, const std::complex<T>& rhs) {
sv 1:6799c07fe510 434 typedef XprBinOp<
sv 1:6799c07fe510 435 Fcnl_pow<std::complex<T>, std::complex<T> >,
sv 1:6799c07fe510 436 VectorConstReference<std::complex<T>, Sz>,
sv 1:6799c07fe510 437 XprLiteral< std::complex<T> >
sv 1:6799c07fe510 438 > expr_type;
sv 1:6799c07fe510 439 return XprVector<expr_type, Sz>(
sv 1:6799c07fe510 440 expr_type(lhs.const_ref(), XprLiteral< std::complex<T> >(rhs)));
sv 1:6799c07fe510 441 }
sv 1:6799c07fe510 442
sv 1:6799c07fe510 443
sv 1:6799c07fe510 444 /**
sv 1:6799c07fe510 445 * \fn pow(const Vector<std::complex<T>, Sz>& lhs, const T& rhs)
sv 1:6799c07fe510 446 * \ingroup _binary_function
sv 1:6799c07fe510 447 */
sv 1:6799c07fe510 448 template<class T, std::size_t Sz>
sv 1:6799c07fe510 449 inline
sv 1:6799c07fe510 450 XprVector<
sv 1:6799c07fe510 451 XprBinOp<
sv 1:6799c07fe510 452 Fcnl_pow<std::complex<T>, T>,
sv 1:6799c07fe510 453 VectorConstReference<std::complex<T>, Sz>,
sv 1:6799c07fe510 454 XprLiteral<T>
sv 1:6799c07fe510 455 >,
sv 1:6799c07fe510 456 Sz
sv 1:6799c07fe510 457 >
sv 1:6799c07fe510 458 pow(const Vector<std::complex<T>, Sz>& lhs, const T& rhs) {
sv 1:6799c07fe510 459 typedef XprBinOp<
sv 1:6799c07fe510 460 Fcnl_pow<std::complex<T>, T>,
sv 1:6799c07fe510 461 VectorConstReference<std::complex<T>, Sz>,
sv 1:6799c07fe510 462 XprLiteral<T>
sv 1:6799c07fe510 463 > expr_type;
sv 1:6799c07fe510 464 return XprVector<expr_type, Sz>(
sv 1:6799c07fe510 465 expr_type(lhs.const_ref(), XprLiteral<T>(rhs)));
sv 1:6799c07fe510 466 }
sv 1:6799c07fe510 467
sv 1:6799c07fe510 468
sv 1:6799c07fe510 469 /**
sv 1:6799c07fe510 470 * \fn pow(const Vector<std::complex<T>, Sz>& lhs, int rhs)
sv 1:6799c07fe510 471 * \ingroup _binary_function
sv 1:6799c07fe510 472 */
sv 1:6799c07fe510 473 template<class T, std::size_t Sz>
sv 1:6799c07fe510 474 inline
sv 1:6799c07fe510 475 XprVector<
sv 1:6799c07fe510 476 XprBinOp<
sv 1:6799c07fe510 477 Fcnl_pow<std::complex<T>, int>,
sv 1:6799c07fe510 478 VectorConstReference<std::complex<T>, Sz>,
sv 1:6799c07fe510 479 XprLiteral<int>
sv 1:6799c07fe510 480 >,
sv 1:6799c07fe510 481 Sz
sv 1:6799c07fe510 482 >
sv 1:6799c07fe510 483 pow(const Vector<std::complex<T>, Sz>& lhs, int rhs) {
sv 1:6799c07fe510 484 typedef XprBinOp<
sv 1:6799c07fe510 485 Fcnl_pow<std::complex<T>, int>,
sv 1:6799c07fe510 486 VectorConstReference<std::complex<T>, Sz>,
sv 1:6799c07fe510 487 XprLiteral<int>
sv 1:6799c07fe510 488 > expr_type;
sv 1:6799c07fe510 489 return XprVector<expr_type, Sz>(
sv 1:6799c07fe510 490 expr_type(lhs.const_ref(), XprLiteral<int>(rhs)));
sv 1:6799c07fe510 491 }
sv 1:6799c07fe510 492
sv 1:6799c07fe510 493
sv 1:6799c07fe510 494 /**
sv 1:6799c07fe510 495 * \fn polar(const Vector<T, Sz>& lhs, const T& rhs)
sv 1:6799c07fe510 496 * \ingroup _binary_function
sv 1:6799c07fe510 497 */
sv 1:6799c07fe510 498 template<class T, std::size_t Sz>
sv 1:6799c07fe510 499 inline
sv 1:6799c07fe510 500 XprVector<
sv 1:6799c07fe510 501 XprBinOp<
sv 1:6799c07fe510 502 Fcnl_polar<T, T>,
sv 1:6799c07fe510 503 VectorConstReference<T, Sz>,
sv 1:6799c07fe510 504 XprLiteral<T>
sv 1:6799c07fe510 505 >,
sv 1:6799c07fe510 506 Sz
sv 1:6799c07fe510 507 >
sv 1:6799c07fe510 508 polar(const Vector<T, Sz>& lhs, const T& rhs) {
sv 1:6799c07fe510 509 typedef XprBinOp<
sv 1:6799c07fe510 510 Fcnl_polar<T, T>,
sv 1:6799c07fe510 511 VectorConstReference<T, Sz>,
sv 1:6799c07fe510 512 XprLiteral<T>
sv 1:6799c07fe510 513 > expr_type;
sv 1:6799c07fe510 514 return XprVector<expr_type, Sz>(
sv 1:6799c07fe510 515 expr_type(lhs.const_ref(), XprLiteral<T>(rhs)));
sv 1:6799c07fe510 516 }
sv 1:6799c07fe510 517 #endif // defined(TVMET_HAVE_COMPLEX) && defined(TVMET_HAVE_COMPLEX_MATH1)
sv 1:6799c07fe510 518
sv 1:6799c07fe510 519 #if defined(TVMET_HAVE_COMPLEX) && defined(TVMET_HAVE_COMPLEX_MATH2)
sv 1:6799c07fe510 520 // to be written (atan2)
sv 1:6799c07fe510 521 #endif // defined(TVMET_HAVE_COMPLEX) && defined(TVMET_HAVE_COMPLEX_MATH2)
sv 1:6799c07fe510 522
sv 1:6799c07fe510 523
sv 1:6799c07fe510 524 } // namespace tvmet
sv 1:6799c07fe510 525
sv 1:6799c07fe510 526 #endif // TVMET_VECTOR_BINARY_FUNCTIONS_H
sv 1:6799c07fe510 527
sv 1:6799c07fe510 528 // Local Variables:
sv 1:6799c07fe510 529 // mode:C++
sv 1:6799c07fe510 530 // tab-width:8
sv 1:6799c07fe510 531 // End: