Utilities.h

Go to the documentation of this file.
00001 /* Import from Gabor API
00002 
00003 Copyright (c) 2002-3 Adriaan Tijsseling
00004 
00005 
00006                              All Rights Reserved
00007 
00008     This program is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012 
00013     This program is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016     GNU General Public License for more details.
00017 
00018     You should have received a copy of the GNU General Public License
00019     along with this program. If not, see <http://www.gnu.org/licenses/>.
00020 */
00021 
00022 /*
00023         Author:                 Adriaan Tijsseling (AGT)
00024         Copyright:              (c) Copyright 2002-3 Adriaan Tijsseling. All rights reserved.
00025         Description:    Probably useful...
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);    // for qsort() function
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 }; // namespace
00084 #endif
00085 

Generated on 26 Nov 2014 for Hugintrunk by  doxygen 1.4.7