SpikeStream Library  0.2
Util.h
Go to the documentation of this file.
00001 #ifndef UTIL_H
00002 #define UTIL_H
00003 
00004 //SpikeStream includes
00005 #include "Point3D.h"
00006 #include "WeightlessNeuron.h"
00007 
00008 //Qt includes
00009 #include <QString>
00010 #include <QList>
00011 
00012 //Other includes
00013 #include <stdint.h>
00014 #include <gmpxx.h>
00015 
00016 
00017 namespace spikestream {
00018 
00019         typedef unsigned char byte;
00020 
00022         class Util {
00023                 public:
00024                         static void addTraining(WeightlessNeuron& neuron, QString trainingPattern, int output);
00025                         bool bitsEqual(unsigned char* byteArr, QString bitPattStr, int output);
00026                         static void fillByteArray(unsigned char*& byteArr, int& arrLen, QString byteStr);
00027                         static void fillSelectionArray(bool* array, int arraySize, int selectionSize);
00028                         static bool getBool(const QString& str);
00029                         static bool getBoolParameter(const QString& paramName, QHash<QString, double>& paramMap);
00030                         static float getFloat(const QString& str);
00031                         static int getInt(const QString& str);
00032                         static unsigned int getUInt(const QString& str);
00033                         static QList<unsigned int> getUIntList(const QString& str);
00034                         static double getDouble(const QString& str);
00035                         static double getDoubleParameter(const QString& paramName, QHash<QString, double>& paramMap);
00036                         static double getPositiveDoubleParameter(const QString& paramName, QHash<QString, double>& paramMap);
00037                         static float getFloatParameter(const QString& paramName, QHash<QString, double>& paramMap);
00038                         static int getIntParameter(const QString& paramName, QHash<QString, double>& paramMap);
00039                         static unsigned getUIntParameter(const QString& paramName, QHash<QString, double>& paramMap);
00040                         static int getRandom(int min, int max);
00041                         static double getRandomDouble(double min, double max);
00042                         static float getRandomFloat(float min, float max);
00043                         static unsigned getRandomUInt(unsigned min, unsigned max);
00044                         static QString getRootDirectory();
00045                         static bool isNumber(const QString& str);
00046                         static mpf_class factorial(unsigned int num);
00047                         static float min(float n1, float n2, float n3);
00048                         static void printBinary(uint64_t number);
00049                         static void printByteArray(byte* byteArr, int arrLen);
00050                         static void printByteArray(const QByteArray& byteArr);
00051                         static void printBoolArray(bool arr[], int arrLen);
00052                         static void printParameterMap(const QHash<QString, double>& paramMap);
00053                         static double rDouble(double num, int numPlaces);
00054                         static int rInt(double num);
00055                         static unsigned int rUInt(double num);
00056                         static void safeCStringCopy(char target[], const char source[], int targetSize);
00057                         static void seedRandom(int seed = 0);
00058                         static void setGeneralization(QHash<unsigned int, WeightlessNeuron*>& weiNeurMap, double gen);
00059                         static double toPositive(double num);
00060                         static float toPositive(float num);
00061                         static int toPositive(int num);
00062 
00063         };
00064 
00065 }
00066 
00067 #endif//UTIL_H
00068 
 All Classes Files Functions Variables Typedefs Defines