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 #ifndef __UTILITIES__
00029 #define __UTILITIES__
00030
00031 #include <fstream>
00032 #include <iostream>
00033 #include <stdio.h>
00034 #ifdef _WINDOWS
00035 #include "direct.h"
00036 #else
00037 #include <unistd.h>
00038 #endif
00039
00040 using namespace std;
00041
00042 namespace celeste
00043 {
00044 enum
00045 {
00046 kLeft = 0,
00047 kRight
00048 };
00049
00050 void Permute( int* array, size_t size );
00051 int cmp(const void *s1, const void *s2);
00052
00053 float Heavyside( float a );
00054
00055 float Sigmoid( float act );
00056 float Sigmoid( float beta, float a_pot );
00057 float Sigmoid( float beta, float a_pot, float thresh );
00058
00059 int **CreateMatrix( int val, int row, int col );
00060 void ResetMatrix( int ** matrix, int val, int row, int col );
00061 void DisposeMatrix( int** matrix, int row );
00062
00063 float **CreateMatrix( float val, int row, int col );
00064 void ResetMatrix( float ** matrix, float val, int row, int col );
00065 void DisposeMatrix( float** matrix, int row );
00066
00067 float ReturnDistance( float *pat1, float *pat2, int size );
00068
00069 void GetStreamDefaults( void );
00070 void AdjustStream( ostream &os, int precision, int width, int pos, bool trailers );
00071 void SetStreamDefaults( ostream &os );
00072
00073 void SkipComments( ifstream* infile );
00074 void FileCreateError( char* filename );
00075 void FileOpenError( char* filename );
00076
00077 double SafeAbs( double val1, double val2 );
00078 float SafeAbs( float val1, float val2 );
00079 int SafeAbs( int val1, int val2 );
00080 double SafeAbs( double val );
00081 float SafeAbs( float val );
00082 int SafeAbs( int val );
00083 };
00084 #endif
00085