Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Utilities.h
Go to the documentation of this file.
1 /* Import from Gabor API
2 
3 Copyright (c) 2002-3 Adriaan Tijsseling
4 
5 
6  All Rights Reserved
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 /*
23  Author: Adriaan Tijsseling (AGT)
24  Copyright: (c) Copyright 2002-3 Adriaan Tijsseling. All rights reserved.
25  Description: Probably useful...
26 */
27 
28 #ifndef __UTILITIES__
29 #define __UTILITIES__
30 
31 #include <fstream>
32 #include <iostream>
33 #include <stdio.h>
34 #ifdef _WIN32
35 #include "direct.h"
36 #else
37 #include <unistd.h>
38 #endif
39 
40 namespace celeste
41 {
42 enum
43 {
44  kLeft = 0,
46 };
47 
48 void Permute( int* array, size_t size );
49 int cmp(const void *s1, const void *s2); // for qsort() function
50 
51 float Heavyside( float a );
52 
53 float Sigmoid( float act );
54 float Sigmoid( float beta, float a_pot );
55 float Sigmoid( float beta, float a_pot, float thresh );
56 
57 int **CreateMatrix( int val, int row, int col );
58 void ResetMatrix( int ** matrix, int val, int row, int col );
59 void DisposeMatrix( int** matrix, int row );
60 
61 float **CreateMatrix( float val, int row, int col );
62 void ResetMatrix( float ** matrix, float val, int row, int col );
63 void DisposeMatrix( float** matrix, int row );
64 
65 float ReturnDistance( float *pat1, float *pat2, int size );
66 
67 void GetStreamDefaults( void );
68 void AdjustStream( std::ostream &os, int precision, int width, int pos, bool trailers );
69 void SetStreamDefaults( std::ostream &os );
70 
71 void SkipComments( std::ifstream* infile );
72 void FileCreateError( char* filename );
73 void FileOpenError( char* filename );
74 
75 double SafeAbs( double val1, double val2 );
76 float SafeAbs( float val1, float val2 );
77 int SafeAbs( int val1, int val2 );
78 double SafeAbs( double val );
79 float SafeAbs( float val );
80 int SafeAbs( int val );
81 }; // namespace
82 #endif
83 
int cmp(const void *s1, const void *s2)
Definition: Utilities.cpp:66
void SkipComments(std::ifstream *infile)
Definition: Utilities.cpp:170
void GetStreamDefaults(void)
Definition: Utilities.cpp:212
void AdjustStream(std::ostream &os, int precision, int width, int pos, bool trailers)
Definition: Utilities.cpp:218
void Permute(int *array, size_t size)
Definition: Utilities.cpp:46
void SetStreamDefaults(std::ostream &os)
Definition: Utilities.cpp:233
void DisposeMatrix(int **matrix, int row)
Definition: Utilities.cpp:122
float ReturnDistance(float *pat1, float *pat2, int size)
Definition: Utilities.cpp:159
void FileOpenError(char *filename)
Definition: Utilities.cpp:200
int ** CreateMatrix(int val, int row, int col)
Definition: Utilities.cpp:101
float Heavyside(float a)
Definition: Utilities.cpp:75
double SafeAbs(double val1, double val2)
Definition: Utilities.cpp:244
float Sigmoid(float act)
Definition: Utilities.cpp:82
void FileCreateError(char *filename)
Definition: Utilities.cpp:191
void ResetMatrix(int **matrix, int val, int row, int col)
Definition: Utilities.cpp:114