00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #define LASS_NUM_INVLOG2 1.442695040888963407359924681001892137426645954152985934135449406931109219181185079885526622893506344
00047 #define LASS_NUM_INVLOG10 0.434294481903251827651128918916605082294397005803666566114453783165864649208870774729224949338431748
00048
00049 namespace impl
00050 {
00051
00052 template <typename T>
00053 struct IntPow
00054 {
00055 typedef typename NumTraits<T>::signedType TSigned;
00056 typedef typename NumTraits<T>::unsignedType TUnsigned;
00057
00058 static T eval(TSigned x, TSigned p)
00059 {
00060 LASS_ASSERT(p >= 0);
00061 return eval(x, static_cast<TUnsigned>(p));
00062 }
00063
00064 static T eval(TSigned x, TUnsigned p)
00065 {
00066 if (p == 0)
00067 {
00068 return 1;
00069 }
00070
00071 TSigned result = 0;
00072 TSigned partialPower = 1;
00073 do
00074 {
00075 partialPower *= x;
00076 if (p & 0x1)
00077 {
00078 result += partialPower;
00079 }
00080 p >>= 1;
00081 }
00082 while (p);
00083 return result;
00084 }
00085 };
00086
00087 template <typename T>
00088 struct IntDiv
00089 {
00090 typedef typename NumTraits<T>::signedType TSigned;
00091 typedef typename NumTraits<T>::unsignedType TUnsigned;
00092
00093 static T eval(TSigned x, TSigned m)
00094 {
00095 LASS_ASSERT(m > 0);
00096 const TSigned tempDiv = x / m;
00097 return x % m >= 0 ? tempDiv : (tempDiv - 1);
00098 }
00099
00100 static T eval(TSigned x, TUnsigned m)
00101 {
00102 LASS_ASSERT(m > 0);
00103 const TSigned signedMod = static_cast<TSigned>(m);
00104 LASS_ASSERT(signedMod >= 0);
00105 const TSigned tempDiv = x / signedMod;
00106 return x % signedMod >= 0 ? tempDiv : (tempDiv - 1);
00107 }
00108 };
00109
00110 template <typename T>
00111 struct IntMod
00112 {
00113 typedef typename NumTraits<T>::signedType TSigned;
00114 typedef typename NumTraits<T>::unsignedType TUnsigned;
00115
00116 static T eval(TSigned x, TSigned m)
00117 {
00118 LASS_ASSERT(m > 0);
00119 const TSigned tempMod = x % m;
00120 return tempMod >= 0 ? tempMod : (tempMod + m);
00121 }
00122
00123 static T eval(TSigned x, TUnsigned m)
00124 {
00125 LASS_ASSERT(m > 0);
00126 const TSigned signedMod = static_cast<TSigned>(m);
00127 LASS_ASSERT(signedMod >= 0);
00128 const TSigned tempMod = x % signedMod;
00129 return tempMod >= 0 ? tempMod : (tempMod + signedMod);
00130 }
00131 };
00132
00133 }
00134
00135
00136
00137
00138
00139
00140 template <typename T> inline T abs(const T& x)
00141 {
00142 return x < T() ? -x : x;
00143 }
00144
00145
00146
00147
00148 template <typename T> inline T sign(const T& x)
00149 {
00150 const T zero = T();
00151 return x > zero ? T(1) : (x < zero ? T(-1) : zero);
00152 }
00153
00154
00155
00156
00157 template <typename T> inline T sqr(const T& x)
00158 {
00159 return x * x;
00160 }
00161
00162
00163
00164
00165 template <typename T> inline T cubic(const T& x)
00166 {
00167 return x * x * x;
00168 }
00169
00170
00171
00172
00173 template <typename T> inline T inv(const T& x)
00174 {
00175 return T(1) / x;
00176 }
00177
00178
00179
00180
00181
00182 template <typename T> inline T pow(const T& x, const T& p)
00183 {
00184 return exp(p * log(x));
00185 }
00186
00187
00188
00189
00190 template <typename T> inline T log2(const T& x, const T& p)
00191 {
00192 return T(LASS_NUM_INVLOG2) * log(x);
00193 }
00194
00195
00196
00197
00198 template <typename T> inline T log10(const T& x, const T& p)
00199 {
00200 return T(LASS_NUM_INVLOG10) * log(x);
00201 }
00202
00203
00204
00205
00206 template <typename T> inline T norm(const T& x)
00207 {
00208 return sqr(x);
00209 }
00210
00211
00212
00213 template <typename T> inline T conj(const T& x)
00214 {
00215 return x;
00216 }
00217
00218
00219
00220
00221 template <typename T> inline const T& clamp(const T& x, const T& min, const T& max)
00222 {
00223 return x < min ? min : (x > max ? max : x);
00224 }
00225
00226
00227
00228
00229 template <typename T> inline T lerp(const T& a, const T& b, const T& f)
00230 {
00231 return a + f * (b - a);
00232 }
00233
00234
00235
00236 template<typename T,typename f> T applyFunction(const T& x, f func )
00237 {
00238 return func(x);
00239 }
00240
00241
00242
00243
00244
00245 template <typename T> void inpabs(T& x) { x = num::abs(x); }
00246 template <typename T> void inpsign(T& x) { x = num::sign(x); }
00247 template <typename T> void inpinv(T& x) { x = num::inv(x); }
00248 template <typename T> void inpsqrt(T& x) { x = num::sqrt(x); }
00249 template <typename T> void inpsqr(T& x) { x = num::sqr(x); }
00250 template <typename T> void inpcubic(T& x) { x = num::cubic(x); }
00251 template <typename T> void inppow(T& x, const T& p) { x = num::pow(x, p); }
00252 template <typename T> void inpexp(T& x) { x = num::exp(x); }
00253 template <typename T> void inplog(T& x) { x = num::log(x); }
00254 template <typename T> void inpcos(T& x) { x = num::cos(x); }
00255 template <typename T> void inpsin(T& x) { x = num::sin(x); }
00256 template <typename T> void inptan(T& x) { x = num::tan(x); }
00257 template <typename T> void inpacos(T& x) { x = num::acos(x); }
00258 template <typename T> void inpasin(T& x) { x = num::asin(x); }
00259 template <typename T> void inpatan(T& x) { x = num::atan(x); }
00260 template <typename T> void inpatan2(T& y, const T& x) { y = num::atan2(y, x); }
00261 template <typename T> void inpfloor(T& x) { x = num::floor(x); }
00262 template <typename T> void inpceil(T& x) { x = num::ceil(x); }
00263 template <typename T> void inpround(T& x) { x = num::round(x); }
00264 template <typename T> void inpfractional(T& x) { x -= num::floor(x); }
00265 template <typename T> void inpdiv(T& x, const T& m) { x = num::div(x, m); }
00266 template <typename T> void inpmod(T& x, const T& m) { x = num::mod(x, m); }
00267 template <typename T> void inpclamp(T& x, const T& min, const T& max) { x = num::clamp(x, min, max); }
00268
00269 template <typename T> void compnorm(const T& x, T& y) { y = num::norm(x); }
00270 template <typename T> void compinv(const T& x, T& y) { y = num::inv(x); }
00271
00272
00273
00274
00275
00276 float abs(float x) { return ::fabsf(x); }
00277 float inv(float x) { return 1.f / x; }
00278 float sqrt(float x) { LASS_ASSERT(!(x < 0.f)); return ::sqrtf(x); }
00279 float pow(float x, float p) { return ::powf(x, p); }
00280 float exp(float x) { return ::expf(x); }
00281 float log(float x) { return ::logf(x); }
00282 float log2(float x) { return float(LASS_NUM_INVLOG2) * ::logf(x); }
00283 float log10(float x) { return ::log10f(x); }
00284 float cos(float x) { return ::cosf(x); }
00285 float sin(float x) { return ::sinf(x); }
00286 float tan(float x) { return ::tanf(x); }
00287 float acos(float x) { return ::acosf(x); }
00288 float asin(float x) { return ::asinf(x); }
00289 float atan(float x) { return ::atanf(x); }
00290 float atan2(float y, float x) { return ::atan2f(y, x); }
00291 float sinc(float x) { return ::fabsf(x) < 1e-4f ? 1.f : (::sinf(x) / x); }
00292 float floor(float x) { return ::floorf(x); }
00293 float ceil(float x) { return ::ceilf(x); }
00294 float round(float x) { return ::floorf(x + .5f); }
00295 float fractional(float x) { return x - ::floorf(x); }
00296
00297
00298 float mod(float x, float m)
00299 {
00300 const float result = ::fmodf(x, m);
00301 return result < 0.f ? result + m : result;
00302 }
00303
00304
00305 float fastSin(float x)
00306 {
00307 const float a = 1.2732395447351628f;
00308 const float b = -0.4052847345693511f;
00309 const float c = 0.2248391028f;
00310 const float y = a * x + b * x * fabsf(x);
00311 return c * (y * fabsf(y) - y) + y;
00312 }
00313
00314
00315
00316
00317 double abs(double x) { return ::fabs(x); }
00318 double inv(double x) { return 1. / x; }
00319 double sqrt(double x) { LASS_ASSERT(!(x < 0.)); return ::sqrt(x); }
00320 double pow(double x, double p) { return ::pow(x, p); }
00321 double exp(double x) { return ::exp(x); }
00322 double log(double x) { return ::log(x); }
00323 double log2(double x) { return double(LASS_NUM_INVLOG2) * ::log(x); }
00324 double log10(double x) { return ::log10(x); }
00325 double cos(double x) { return ::cos(x); }
00326 double sin(double x) { return ::sin(x); }
00327 double tan(double x) { return ::tan(x); }
00328 double acos(double x) { return ::acos(x); }
00329 double asin(double x) { return ::asin(x); }
00330 double atan(double x) { return ::atan(x); }
00331 double atan2(double y, double x) { return ::atan2(y, x); }
00332 double sinc(double x) { return ::fabs(x) < 1e-8 ? 1. : (::sin(x) / x); }
00333 double floor(double x) { return ::floor(x); }
00334 double ceil(double x) { return ::ceil(x); }
00335 double round(double x) { return ::floor(x + .5); }
00336 double fractional(double x) { return x - ::floor(x); }
00337
00338
00339 double mod(double x, double m)
00340 {
00341 const double result = ::fmod(x, m);
00342 return result < 0. ? result + m : result;
00343 }
00344
00345
00346 double fastSin(double x)
00347 {
00348 const double a = 1.2732395447351628;
00349 const double b = -0.4052847345693511;
00350 const double c = 0.2248391028;
00351 const double y = a * x + b * x * fabs(x);
00352 return c * (y * fabs(y) - y) + y;
00353 }
00354
00355
00356
00357
00358
00359 #ifdef LASS_NUM_BASIC_OPS_USE_BUILTIN_LONG_DOUBLE
00360
00361 long double abs(long double x) { return __builtin_fabsl(x); }
00362 long double inv(long double x) { return 1. / x; }
00363 long double sqrt(long double x) { LASS_ASSERT(!(x < 0.)); return __builtin_sqrtl(x); }
00364 long double pow(long double x, long double p) { return __builtin_powl(x, p); }
00365 long double exp(long double x) { return __builtin_expl(x); }
00366 long double log(long double x) { return __builtin_logl(x); }
00367 long double log2(long double x) { return (long double)(LASS_NUM_INVLOG2) * __builtin_logl(x); }
00368 long double log10(long double x) { return __builtin_log10l(x); }
00369 long double cos(long double x) { return __builtin_cosl(x); }
00370 long double sin(long double x) { return __builtin_sinl(x); }
00371 long double tan(long double x) { return __builtin_tanl(x); }
00372 long double acos(long double x) { return __builtin_acosl(x); }
00373 long double asin(long double x) { return __builtin_asinl(x); }
00374 long double atan(long double x) { return __builtin_atanl(x); }
00375 long double atan2(long double y, long double x) { return __builtin_atan2l(y, x); }
00376 long double sinc(long double x) { return __builtin_fabsl(x) < 1e-10 ? 1. : (__builtin_sinl(x) / x); }
00377 long double floor(long double x) { return __builtin_floorl(x); }
00378 long double ceil(long double x) { return __builtin_ceill(x); }
00379 long double round(long double x) { return __builtin_floorl(x + .5); }
00380 long double fractional(long double x) { return x - __builtin_floorl(x); }
00381
00382
00383 long double mod(long double x, long double m)
00384 {
00385 const long double result = __builtin_fmodl(x, m);
00386 return result < 0. ? result + m : result;
00387 }
00388
00389 #else
00390
00391 long double abs(long double x) { return ::fabsl(x); }
00392 long double inv(long double x) { return 1. / x; }
00393 long double sqrt(long double x) { LASS_ASSERT(!(x < 0.)); return ::sqrtl(x); }
00394 long double pow(long double x, long double p) { return ::powl(x, p); }
00395 long double exp(long double x) { return ::expl(x); }
00396 long double log(long double x) { return ::logl(x); }
00397 long double log2(long double x) { return (long double)(LASS_NUM_INVLOG2) * ::logl(x); }
00398 long double log10(long double x) { return ::log10l(x); }
00399 long double cos(long double x) { return ::cosl(x); }
00400 long double sin(long double x) { return ::sinl(x); }
00401 long double tan(long double x) { return ::tanl(x); }
00402 long double acos(long double x) { return ::acosl(x); }
00403 long double asin(long double x) { return ::asinl(x); }
00404 long double atan(long double x) { return ::atanl(x); }
00405 long double atan2(long double y, long double x) { return ::atan2l(y, x); }
00406 long double sinc(long double x) { return ::fabsl(x) < 1e-10 ? 1. : (::sinl(x) / x); }
00407 long double floor(long double x) { return ::floorl(x); }
00408 long double ceil(long double x) { return ::ceill(x); }
00409 long double round(long double x) { return ::floorl(x + .5); }
00410 long double fractional(long double x) { return x - ::floorl(x); }
00411
00412
00413 long double mod(long double x, long double m)
00414 {
00415 const long double result = ::fmodl(x, m);
00416 return result < 0. ? result + m : result;
00417 }
00418
00419
00420 long double fastSin(long double x)
00421 {
00422 const long double a = 1.2732395447351628;
00423 const long double b = -0.4052847345693511;
00424 const long double c = 0.2248391028;
00425 const long double y = a * x + b * x * fabs(x);
00426 return c * (y * fabs(y) - y) + y;
00427 }
00428
00429 #endif
00430
00431
00432
00433
00434 #ifdef LASS_CHAR_IS_SIGNED
00435
00436 char pow(char x, char p) { return impl::IntPow<char>::eval(x, static_cast<signed char>(p)); }
00437 char pow(char x, unsigned char p) { return impl::IntPow<char>::eval(x, p); }
00438 char div(char x, char m) { return impl::IntDiv<char>::eval(x, static_cast<signed char>(m)); }
00439 char div(char x, unsigned char m) { return impl::IntDiv<char>::eval(x, m); }
00440 char mod(char x, char m) { return impl::IntMod<char>::eval(x, static_cast<signed char>(m)); }
00441 char mod(char x, unsigned char m) { return impl::IntMod<char>::eval(x, m); }
00442
00443 #else
00444
00445 char abs(char x) { return x; }
00446 char sign(char x) { return x > 0 ? 1 : 0; }
00447 char pow(char x, char p) { return impl::IntPow<char>::eval(x, static_cast<unsigned char>(p)); }
00448 char div(char x, char p) { return x / p; }
00449 char mod(char x, char p) { return x % p; }
00450
00451 #endif
00452
00453 char floor(char x) { return x; }
00454 char ceil(char x) { return x; }
00455 char round(char x) { return x; }
00456 char fractional(char ) { return 0; }
00457
00458 void inpfloor(char& ) {}
00459 void inpceil(char& ) {}
00460 void inpround(char& ) {}
00461 void inpfractional(char& x) { x = 0; }
00462
00463
00464
00465 signed char abs(signed char x) { return static_cast<signed char>(::abs(x)); }
00466 signed char pow(signed char x, signed char p) { return impl::IntPow<char>::eval(x, p); }
00467 signed char pow(signed char x, unsigned char p) { return impl::IntPow<char>::eval(x, p); }
00468 signed char floor(signed char x) { return x; }
00469 signed char ceil(signed char x) { return x; }
00470 signed char round(signed char x) { return x; }
00471 signed char fractional(signed char ) { return 0; }
00472 signed char div(signed char x, signed char p) { return impl::IntDiv<char>::eval(x, p); }
00473 signed char div(signed char x, unsigned char p) { return impl::IntDiv<char>::eval(x, p); }
00474 signed char mod(signed char x, signed char p) { return impl::IntMod<char>::eval(x, p); }
00475 signed char mod(signed char x, unsigned char p) { return impl::IntMod<char>::eval(x, p); }
00476
00477 void inpfloor(signed char& ) {}
00478 void inpceil(signed char& ) {}
00479 void inpround(signed char& ) {}
00480 void inpfractional(signed char& x) { x = 0; }
00481
00482
00483
00484
00485
00486 unsigned char abs(unsigned char x) { return x; }
00487 unsigned char sign(unsigned char x) { return x > 0 ? 1 : 0; }
00488 unsigned char pow(unsigned char x, unsigned char p) { return impl::IntPow<unsigned char>::eval(x, p); }
00489 unsigned char floor(unsigned char x) { return x; }
00490 unsigned char ceil(unsigned char x) { return x; }
00491 unsigned char round(unsigned char x) { return x; }
00492 unsigned char fractional(unsigned char ) { return 0; }
00493 unsigned char div(unsigned char x, unsigned char p) { return x / p; }
00494 unsigned char mod(unsigned char x, unsigned char p) { return x % p; }
00495
00496 void inpabs(unsigned char& ) {}
00497 void inpfloor(unsigned char& ) {}
00498 void inpceil(unsigned char& ) {}
00499 void inpround(unsigned char& ) {}
00500 void inpfractional(unsigned char& x) { x = 0; }
00501
00502
00503
00504
00505
00506 signed short abs(signed short x) { return static_cast<signed short>(::abs(x)); }
00507 signed short pow(signed short x, signed short p) { return impl::IntPow<short>::eval(x, p); }
00508 signed short pow(signed short x, unsigned short p) { return impl::IntPow<short>::eval(x, p); }
00509 signed short floor(signed short x) { return x; }
00510 signed short ceil(signed short x) { return x; }
00511 signed short round(signed short x) { return x; }
00512 signed short fractional(signed short ) { return 0; }
00513 signed short div(signed short x, signed short p) { return impl::IntDiv<short>::eval(x, p); }
00514 signed short div(signed short x, unsigned short p) { return impl::IntDiv<short>::eval(x, p); }
00515 signed short mod(signed short x, signed short p) { return impl::IntMod<short>::eval(x, p); }
00516 signed short mod(signed short x, unsigned short p) { return impl::IntMod<short>::eval(x, p); }
00517
00518 void inpfloor(signed short& ) {}
00519 void inpceil(signed short& ) {}
00520 void inpround(signed short& ) {}
00521 void inpfractional(signed short& x) { x = 0; }
00522
00523
00524
00525
00526
00527 unsigned short abs(unsigned short x) { return x; }
00528 unsigned short sign(unsigned short x) { return x > 0 ? 1 : 0; }
00529 unsigned short pow(unsigned short x, unsigned short p) { return impl::IntPow<unsigned short>::eval(x, p); }
00530 unsigned short floor(unsigned short x) { return x; }
00531 unsigned short ceil(unsigned short x) { return x; }
00532 unsigned short round(unsigned short x) { return x; }
00533 unsigned short fractional(unsigned short ) { return 0; }
00534 unsigned short div(unsigned short x, unsigned short p) { return x / p; }
00535 unsigned short mod(unsigned short x, unsigned short p) { return x % p; }
00536
00537 void inpabs(unsigned short& ) {}
00538 void inpfloor(unsigned short& ) {}
00539 void inpceil(unsigned short& ) {}
00540 void inpround(unsigned short& ) {}
00541 void inpfractional(unsigned short& x) { x = 0; }
00542
00543
00544
00545
00546
00547 signed int abs(signed int x) { return ::abs(x); }
00548 signed int pow(signed int x, signed int p) { return impl::IntPow<int>::eval(x, p); }
00549 signed int pow(signed int x, unsigned int p) { return impl::IntPow<int>::eval(x, p); }
00550 signed int floor(signed int x) { return x; }
00551 signed int ceil(signed int x) { return x; }
00552 signed int round(signed int x) { return x; }
00553 signed int fractional(signed int ) { return 0; }
00554 signed int div(signed int x, signed int p) { return impl::IntDiv<int>::eval(x, p); }
00555 signed int div(signed int x, unsigned int p) { return impl::IntDiv<int>::eval(x, p); }
00556 signed int mod(signed int x, signed int p) { return impl::IntMod<int>::eval(x, p); }
00557 signed int mod(signed int x, unsigned int p) { return impl::IntMod<int>::eval(x, p); }
00558
00559 void inpfloor(signed int& ) {}
00560 void inpceil(signed int& ) {}
00561 void inpround(signed int& ) {}
00562 void inpfractional(signed int& x) { x = 0; }
00563
00564
00565
00566
00567
00568 unsigned int abs(unsigned int x) { return x; }
00569 unsigned int sign(unsigned int x) { return x > 0 ? 1 : 0; }
00570 unsigned int pow(unsigned int x, unsigned int p) { return impl::IntPow<unsigned int>::eval(x, p); }
00571 unsigned int floor(unsigned int x) { return x; }
00572 unsigned int ceil(unsigned int x) { return x; }
00573 unsigned int round(unsigned int x) { return x; }
00574 unsigned int fractional(unsigned int ) { return 0; }
00575 unsigned int div(unsigned int x, unsigned int p) { return x / p; }
00576 unsigned int mod(unsigned int x, unsigned int p) { return x % p; }
00577
00578 void inpabs(unsigned int& ) {}
00579 void inpfloor(unsigned int& ) {}
00580 void inpceil(unsigned int& ) {}
00581 void inpround(unsigned int& ) {}
00582 void inpfractional(unsigned int& x) { x = 0; }
00583
00584
00585
00586
00587
00588 signed long abs(signed long x) { return ::labs(x); }
00589 signed long pow(signed long x, signed long p) { return impl::IntPow<long>::eval(x, p); }
00590 signed long pow(signed long x, unsigned long p) { return impl::IntPow<long>::eval(x, p); }
00591 signed long floor(signed long x) { return x; }
00592 signed long ceil(signed long x) { return x; }
00593 signed long round(signed long x) { return x; }
00594 signed long fractional(signed long ) { return 0; }
00595 signed long div(signed long x, signed long p) { return impl::IntDiv<long>::eval(x, p); }
00596 signed long div(signed long x, unsigned long p) { return impl::IntDiv<long>::eval(x, p); }
00597 signed long mod(signed long x, signed long p) { return impl::IntMod<long>::eval(x, p); }
00598 signed long mod(signed long x, unsigned long p) { return impl::IntMod<long>::eval(x, p); }
00599
00600 void inpfloor(signed long& ) {}
00601 void inpceil(signed long& ) {}
00602 void inpround(signed long& ) {}
00603 void inpfractional(signed long& x) { x = 0; }
00604
00605
00606
00607
00608
00609 unsigned long abs(unsigned long x) { return x; }
00610 unsigned long sign(unsigned long x) { return x > 0 ? 1 : 0; }
00611 unsigned long pow(unsigned long x, unsigned long p) { return impl::IntPow<unsigned long>::eval(x, p); }
00612 unsigned long floor(unsigned long x) { return x; }
00613 unsigned long ceil(unsigned long x) { return x; }
00614 unsigned long round(unsigned long x) { return x; }
00615 unsigned long fractional(unsigned long ) { return 0; }
00616 unsigned long div(unsigned long x, unsigned long p) { return x / p; }
00617 unsigned long mod(unsigned long x, unsigned long p) { return x % p; }
00618
00619 void inpabs(unsigned long& ) {}
00620 void inpfloor(unsigned long& ) {}
00621 void inpceil(unsigned long& ) {}
00622 void inpround(unsigned long& ) {}
00623 void inpfractional(unsigned long& x) { x = 0; }
00624
00625
00626
00627
00628
00629
00630 template <typename T> std::complex<T> abs( const std::complex<T>& x) { return std::abs( x ); }
00631 template <typename T> std::complex<T> inv( const std::complex<T>& x) { return T(1)/x; }
00632 template <typename T> std::complex<T> sqrt( const std::complex<T>& x){ return std::sqrt( x ); }
00633 template <typename T> std::complex<T> pow(const std::complex<T>& x, double p) { return std::pow(x, p); }
00634 template <typename T> std::complex<T> exp( const std::complex<T>& x) { return std::exp( x ); }
00635 template <typename T> std::complex<T> log( const std::complex<T>& x) { return std::log( x ); }
00636 template <typename T> std::complex<T> log2( const std::complex<T>& x) { return T(LASS_NUM_INVLOG2) * std::log( x ); }
00637 template <typename T> std::complex<T> log10( const std::complex<T>& x) { return T(LASS_NUM_INVLOG10) * std::log( x ); }
00638 template <typename T> std::complex<T> cos( const std::complex<T>& x) { return std::cos( x ); }
00639 template <typename T> std::complex<T> sin( const std::complex<T>& x) { return std::sin( x ); }
00640 template <typename T> std::complex<T> tan( const std::complex<T>& x) { return std::tan( x ); }
00641 template <typename T> std::complex<T> acos( const std::complex<T>& x){ return std::acos( x ); }
00642 template <typename T> std::complex<T> asin( const std::complex<T>& x){ return std::asin( x ); }
00643 template <typename T> std::complex<T> atan( const std::complex<T>& x){ return std::atan( x ); }
00644
00645 template <typename T> T norm(const std::complex<T>& x) { return std::norm( x ); }
00646 template <typename T> std::complex<T> conj(const std::complex<T>& x) { return std::conj(x); }