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

Generated on 8 Dec 2016 for Hugintrunk by  doxygen 1.4.7