TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
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
17extern int ArgMin (int n, real* x);
18extern int ArgMax (int n, real* x);
19extern real SmoothMaxGamma (real f1, real f2, real lambda, real c);
20extern real SmoothMaxPNorm (real f1, real f2, real p);
21extern void SoftMax (int n, real* Q, real* p, real beta);
22extern void SoftMin (int n, real* Q, real* p, real beta);
23extern void Normalise (real* src, real* dst, int n_elements);
24extern real EuclideanNorm (real* a, real* b, int n);
25extern real SquareNorm (real* a, real* b, int n);
26extern real LNorm (real* a, real* b, int n, real p);
27extern real Sum (real* a, int n);
28
29template<class T>
30inline 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
static Point p[4]
Definition Convex.cpp:54
int ArgMin(int n, real *x)
real SmoothMaxGamma(real f1, real f2, real lambda, real c)
Approximate max (f1,f2) via a gamma function.
real Sum(real *a, int n)
real LNorm(real *a, real *b, int n, real p)
void SoftMax(int n, real *Q, real *p, real beta)
void Normalise(real *src, real *dst, int n_elements)
Normalise a vector to a destination vector (low level)
const T sign(const T &x)
void SoftMin(int n, real *Q, real *p, real beta)
int ArgMax(int n, real *x)
real SquareNorm(real *a, real *b, int n)
real SmoothMaxPNorm(real f1, real f2, real p)
Approximate max (f1,f2) via a power function.
real EuclideanNorm(real *a, real *b, int n)
float real
Definition real.h:13