controller_misc.cpp File Reference

#include "controller_misc.h"
#include <algorithm>

Include dependency graph for controller_misc.cpp:


Functions

double one_over (double x)
 calculates 1/x
double constant (double c, double)
 returns c (useful for Matrix::mapP to fill matrix with constant value)
double random_minusone_to_one (double)
 creates random number from -1 to 1
double random_minusone_to_one (void *r, double)
 creates random number from -1 to 1
double clip (double r, double x)
 clipping function to the interval [-r, r] (for use with mapP)
double lowercutof (void *theta, double x)
 cutof function for mapP
double toBinaryWithProbability (void *r, double x)
 returns -1 if probability is to low, otherwise 1 for mapP
double toBinaryWithThreshold (double x, double threshold)
 returns -1 if below threshold, otherwise 1 for map2
double plus_ (double b, double a)
 plus function for mapP
list< Dstore4x4AndDiagonal (const Matrix &m)
 stores at least left top 4x4 submatrix (row-wise) (if exists) and then the rest of the diagonal elements into a list
I store4x4AndDiagonal (const Matrix &m, D *buffer, I len)
 stores at least left top 4x4 submatrix (row-wise) (if exists) and then the rest of the diagonal elements
I get4x4AndDiagonalSize (const Matrix &m)
 returns the number of elements stored by store4x4AndDiagonal (should be min(getN(),4)*min(getM(),4)+ max(0,min(getM()-4,getN()-4)))
list< Inspectable::iparamkeystore4x4AndDiagonalFieldNames (const Matrix &m, const std::string &matrixName)
 writes the names of the fields stored by store4x4AndDiagonal into a list
I store4x4AndDiagonalFieldNames (const Matrix &m, const std::string &matrixName, char **keylist, I len)
 stores the names of the fields stored by store4x4AndDiagonal
list< Inspectable::iparamkeystoreMatrixFieldNames (const Matrix &m, const string &matrixName)
list< Inspectable::iparamkeystoreVectorFieldNames (const Matrix &m, const string &vectorName)
I storeMatrixFieldNames (const Matrix &m, const char *matrixName, char **keylist, I len)
 stores the names of the all matrix fieldnames produces by convertToBuffer
I storeVectorFieldNames (const Matrix &m, const char *vectorName, char **keylist, I len)
 stores the names of the all vector (mx1 matrix) fieldnames produces by convertToBuffer
Matrix noiseMatrix (I m, I n, NoiseGenerator &ng, double strength, double unused)
 returns a Matrix with values generated by the given noise generator
double matrixNorm1 (const matrix::Matrix &m)
 calculates to linear matrix norm (sum of absolute values divided by number of values (m*n) )
double matrixNorm2 (const matrix::Matrix &m)
 calculates to square matrix norm (sum of square values divided by number of values (m*n) )
double getKthLargestElement (Matrix &vec, I k)
 returns the k.
double getKthSmallestElement (Matrix &vec, I k)
 returns the k.
I argmin (const Matrix &v)
 considers the matrix as vector (mx1) and returns the index of the smallest element
I argmax (const Matrix &v)
 considers the matrix as vector (mx1) and returns the index of the largest element
double min (const matrix::Matrix &v)
 returns the smallest element
double min (double a, double b)
 minimum function for doubles without templates
double max (const matrix::Matrix &v)
 returns the largest element
double max (double a, double b)
 maximum function for doubles without templates
I sample (const matrix::Matrix &pdf)
 samples from the pdf (rowwise stored with sum = 1)
double adapt (double p, double actual, double nominal, double up_rate, double down_rate)
 parameter adaptation algorithm.
double adaptMinMax (double p, double actual, double _min, double _max, double up_rate, double down_rate)
 like adapt but that the adaption is just done if the actual value is outside the given interval (_min, _max)
list< Inspectable::iparamvalconvertArrayToList (double *array, int arraySize)
 Helper function for converting an array with double values to a list.
list< Inspectable::iparamkeygetArrayNames (int arraySize, const char *name)
 Helper function for getting the array names of an array Is used for the method getInternalParamNames() interface inspectable.

Function Documentation

double adapt ( double  p,
double  actual,
double  nominal,
double  up_rate,
double  down_rate 
)

parameter adaptation algorithm.

double adaptMinMax ( double  p,
double  actual,
double  _min,
double  _max,
double  up_rate,
double  down_rate 
)

like adapt but that the adaption is just done if the actual value is outside the given interval (_min, _max)

I argmax ( const Matrix v  ) 

considers the matrix as vector (mx1) and returns the index of the largest element

I argmin ( const Matrix v  ) 

considers the matrix as vector (mx1) and returns the index of the smallest element

double clip ( double  r,
double  x 
)

clipping function to the interval [-r, r] (for use with mapP)

double constant ( double  c,
double   
)

returns c (useful for Matrix::mapP to fill matrix with constant value)

list<Inspectable::iparamval> convertArrayToList ( double *  array,
int  arraySize 
)

Helper function for converting an array with double values to a list.

Is used for the method getInternalParams() interface inspectable.

I get4x4AndDiagonalSize ( const Matrix m  ) 

returns the number of elements stored by store4x4AndDiagonal (should be min(getN(),4)*min(getM(),4)+ max(0,min(getM()-4,getN()-4)))

list<Inspectable::iparamkey> getArrayNames ( int  arraySize,
const char *  name 
)

Helper function for getting the array names of an array Is used for the method getInternalParamNames() interface inspectable.

double getKthLargestElement ( matrix::Matrix matrix,
matrix::I  k 
)

returns the k.

largest element of the matrix Attention: it will detroy the given matrix! (sorting) Assumption: k>0 and k<=matrixsize

double getKthSmallestElement ( matrix::Matrix matrix,
matrix::I  k 
)

returns the k.

smallest element of the matrix Attention: it will detroy the given matrix! (sorting) Assumption: k>0 and k<=matrixsize

double lowercutof ( void *  theta,
double  x 
)

cutof function for mapP

double matrixNorm1 ( const matrix::Matrix m  ) 

calculates to linear matrix norm (sum of absolute values divided by number of values (m*n) )

double matrixNorm2 ( const matrix::Matrix m  ) 

calculates to square matrix norm (sum of square values divided by number of values (m*n) )

double max ( double  a,
double  b 
)

maximum function for doubles without templates

double max ( const matrix::Matrix v  ) 

returns the largest element

double min ( double  a,
double  b 
)

minimum function for doubles without templates

double min ( const matrix::Matrix v  ) 

returns the smallest element

Examples:
sphererobot3masses.cpp.

Matrix noiseMatrix ( I  m,
I  n,
NoiseGenerator ng,
double  strength,
double  unused 
)

returns a Matrix with values generated by the given noise generator

double one_over ( double  x  ) 

calculates 1/x

double plus_ ( double  b,
double  a 
)

plus function for mapP

double random_minusone_to_one ( void *  r,
double   
)

creates random number from -1 to 1

double random_minusone_to_one ( double   ) 

creates random number from -1 to 1

I sample ( const matrix::Matrix pdf  ) 

samples from the pdf (rowwise stored with sum = 1)

I store4x4AndDiagonal ( const matrix::Matrix m,
matrix::D buffer,
matrix::I  len 
)

stores at least left top 4x4 submatrix (row-wise) (if exists) and then the rest of the diagonal elements

Parameters:
m matrix to be stored
len Length of the provided buffer (should be min(getN(),4)*min(getM(),4)+ max(0,min(getM()-4,getN()-4)))
Returns:
number of actually written elements

list<D> store4x4AndDiagonal ( const matrix::Matrix m  ) 

stores at least left top 4x4 submatrix (row-wise) (if exists) and then the rest of the diagonal elements into a list

Returns:
list of values

I store4x4AndDiagonalFieldNames ( const matrix::Matrix m,
const std::string &  matrixName,
char **  keylist,
matrix::I  len 
)

stores the names of the fields stored by store4x4AndDiagonal

Parameters:
m matrix to be stored
matrixName name of the matrix (prefix for all fields)
keylist list for field names
len Length of the provided buffer (should be min(getN(),4)*min(getM(),4)+ max(0,min(getM()-4,getN()-4)))
Returns:
number of actually written elements

list<Inspectable::iparamkey> store4x4AndDiagonalFieldNames ( const matrix::Matrix m,
const std::string &  matrixName 
)

writes the names of the fields stored by store4x4AndDiagonal into a list

Parameters:
m matrix to be stored
matrixName name of the matrix (prefix for all fields)
keylist list for field names
len Length of the provided buffer (should be min(getN(),4)*min(getM(),4)+ max(0,min(getM()-4,getN()-4)))
Returns:
number of actually written elements

I storeMatrixFieldNames ( const matrix::Matrix m,
const char *  matrixName,
char **  keylist,
matrix::I  len 
)

stores the names of the all matrix fieldnames produces by convertToBuffer

Parameters:
m matrix to be stored
matrixName name of the matrix (prefix for all fields)
keylist list for field names
len Length of the provided buffer (should be getN()*getM()
Returns:
number of actually written elements

list<Inspectable::iparamkey> storeMatrixFieldNames ( const Matrix m,
const string &  matrixName 
)

I storeVectorFieldNames ( const matrix::Matrix m,
const char *  vectorName,
char **  keylist,
matrix::I  len 
)

stores the names of the all vector (mx1 matrix) fieldnames produces by convertToBuffer

Parameters:
m vector to be stored
vectorName name of the vector (prefix for all fields)
keylist list for field names
len Length of the provided buffer (should be getM())
Returns:
number of actually written elements

list<Inspectable::iparamkey> storeVectorFieldNames ( const Matrix m,
const string &  vectorName 
)

double toBinaryWithProbability ( void *  r,
double  x 
)

returns -1 if probability is to low, otherwise 1 for mapP

double toBinaryWithThreshold ( double  x,
double  threshold 
)

returns -1 if below threshold, otherwise 1 for map2


Generated on Fri Oct 30 16:29:01 2009 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.4.7