TORCS  1.3.9
The Open Racing Car Simulator
MathFunctions.h
Go to the documentation of this file.
1 /* -*- Mode: c++ -*- */
2 /* VER: $Id$ */
3 // copyright (c) 2004 by Christos Dimitrakakis <dimitrak@idiap.ch>
4 /***************************************************************************
5  * *
6  * This program is free software; you can redistribute it and/or modify *
7  * it under the terms of the GNU General Public License as published by *
8  * the Free Software Foundation; either version 2 of the License, or *
9  * (at your option) any later version. *
10  * *
11  ***************************************************************************/
12 #ifndef MATH_FUNCTIONS_H
13 #define MATH_FUNCTIONS_H
14 
15 #include <learning/real.h>
16 
17 extern int ArgMin (int n, real* x);
18 extern int ArgMax (int n, real* x);
19 extern real SmoothMaxGamma (real f1, real f2, real lambda, real c);
20 extern real SmoothMaxPNorm (real f1, real f2, real p);
21 extern void SoftMax (int n, real* Q, real* p, real beta);
22 extern void SoftMin (int n, real* Q, real* p, real beta);
23 extern void Normalise (real* src, real* dst, int n_elements);
24 extern real EuclideanNorm (real* a, real* b, int n);
25 extern real SquareNorm (real* a, real* b, int n);
26 extern real LNorm (real* a, real* b, int n, real p);
27 extern real Sum (real* a, int n);
28 
29 template<class T>
30 inline const T sign(const T& x)
31 {
32  if (x>0) {
33  return 1;
34  } else if (x<0) {
35  return -1;
36  } else {
37  return 0;
38  }
39 }
40 
41 #endif
real SmoothMaxGamma(real f1, real f2, real lambda, real c)
Approximate max (f1,f2) via a gamma function.
void SoftMax(int n, real *Q, real *p, real beta)
real Sum(real *a, int n)
int ArgMax(int n, real *x)
void Normalise(real *src, real *dst, int n_elements)
Normalise a vector to a destination vector (low level)
void SoftMin(int n, real *Q, real *p, real beta)
real SquareNorm(real *a, real *b, int n)
real EuclideanNorm(real *a, real *b, int n)
real LNorm(real *a, real *b, int n, real p)
int n
number of items
Definition: List.h:41
real SmoothMaxPNorm(real f1, real f2, real p)
Approximate max (f1,f2) via a power function.
static Point p[4]
Definition: Convex.cpp:54
int ArgMin(int n, real *x)
float real
Definition: real.h:13
const T sign(const T &x)
Definition: MathFunctions.h:30