SpikeStream Library  0.2
spikestream::Util Class Reference

#include <Util.h>

List of all members.

Public Member Functions

bool bitsEqual (unsigned char *byteArr, QString bitPattStr, int output)

Static Public Member Functions

static void addTraining (WeightlessNeuron &neuron, QString trainingPattern, int output)
static void fillByteArray (unsigned char *&byteArr, int &arrLen, QString byteStr)
static void fillSelectionArray (bool *array, int arraySize, int selectionSize)
static bool getBool (const QString &str)
static bool getBoolParameter (const QString &paramName, QHash< QString, double > &paramMap)
static float getFloat (const QString &str)
static int getInt (const QString &str)
static unsigned int getUInt (const QString &str)
static QList< unsigned int > getUIntList (const QString &str)
static double getDouble (const QString &str)
static double getDoubleParameter (const QString &paramName, QHash< QString, double > &paramMap)
static double getPositiveDoubleParameter (const QString &paramName, QHash< QString, double > &paramMap)
static float getFloatParameter (const QString &paramName, QHash< QString, double > &paramMap)
static int getIntParameter (const QString &paramName, QHash< QString, double > &paramMap)
static unsigned getUIntParameter (const QString &paramName, QHash< QString, double > &paramMap)
static int getRandom (int min, int max)
static double getRandomDouble (double min, double max)
static float getRandomFloat (float min, float max)
static unsigned getRandomUInt (unsigned min, unsigned max)
static QString getRootDirectory ()
static bool isNumber (const QString &str)
static mpf_class factorial (unsigned int num)
static float min (float n1, float n2, float n3)
static void printBinary (uint64_t number)
static void printByteArray (byte *byteArr, int arrLen)
static void printByteArray (const QByteArray &byteArr)
static void printBoolArray (bool arr[], int arrLen)
static void printParameterMap (const QHash< QString, double > &paramMap)
static double rDouble (double num, int numPlaces)
static int rInt (double num)
static unsigned int rUInt (double num)
static void safeCStringCopy (char target[], const char source[], int targetSize)
static void seedRandom (int seed=0)
static void setGeneralization (QHash< unsigned int, WeightlessNeuron * > &weiNeurMap, double gen)
static double toPositive (double num)
static float toPositive (float num)
static int toPositive (int num)

Detailed Description

Set of static utility methods.

Definition at line 22 of file Util.h.


Member Function Documentation

void Util::addTraining ( WeightlessNeuron neuron,
QString  trainingPattern,
int  output 
) [static]

Adds the trainign pattern to the weightless neuron

Definition at line 385 of file Util.cpp.

bool Util::bitsEqual ( unsigned char *  byteArr,
QString  bitPattStr,
int  output 
)

Returns true if the string of 1s and 0s matches the 1s and 0s in the byte array and the output

Definition at line 396 of file Util.cpp.

mpf_class Util::factorial ( unsigned int  num) [static]

Returns the factorial of a number

Definition at line 20 of file Util.cpp.

void Util::fillByteArray ( unsigned char *&  byteArr,
int &  arrLen,
QString  byteStr 
) [static]

Fills the suplied array with the 1s and 0s specified in the string.

Definition at line 413 of file Util.cpp.

void Util::fillSelectionArray ( bool *  selectionArray,
int  arraySize,
int  selectionSize 
) [static]

Fills an array to select k neurons out of n.

Definition at line 29 of file Util.cpp.

bool Util::getBool ( const QString &  str) [static]

Converts the QString to a bool. Throws a number conversion exception if the conversion fails.

Definition at line 44 of file Util.cpp.

bool Util::getBoolParameter ( const QString &  paramName,
QHash< QString, double > &  paramMap 
) [static]

Gets a bool parameter out of the hash map with the specified name. Throws an exception if it cannot be found.

Definition at line 55 of file Util.cpp.

double Util::getDouble ( const QString &  str) [static]

Converts the QString to a double Throws a number conversion exception if the conversion fails.

Definition at line 109 of file Util.cpp.

double Util::getDoubleParameter ( const QString &  paramName,
QHash< QString, double > &  paramMap 
) [static]

Returns a double parameter from the supplied map and throws an exception if the parameter does not exist.

Definition at line 119 of file Util.cpp.

float Util::getFloat ( const QString &  str) [static]

Converts the QString to a float. Throws a number conversion exception if the conversion fails.

Definition at line 66 of file Util.cpp.

float Util::getFloatParameter ( const QString &  paramName,
QHash< QString, double > &  paramMap 
) [static]

Returns a float parameter from the supplied map and throws an exception if the parameter does not exist.

Definition at line 136 of file Util.cpp.

int Util::getInt ( const QString &  str) [static]

Converts the QString to an integer. Throws a number conversion exception if the conversion fails.

Definition at line 77 of file Util.cpp.

int Util::getIntParameter ( const QString &  paramName,
QHash< QString, double > &  paramMap 
) [static]

Returns an integer parameter from the supplied map and throws an exception if the parameter does not exist.

Definition at line 144 of file Util.cpp.

double Util::getPositiveDoubleParameter ( const QString &  paramName,
QHash< QString, double > &  paramMap 
) [static]

Returns a double parameter from the supplied map and throws an exception if the parameter does not exist.

Definition at line 126 of file Util.cpp.

int Util::getRandom ( int  min,
int  max 
) [static]

Returns a random integer in the range specified. Will be less and not equal to the maximum.

Definition at line 177 of file Util.cpp.

double Util::getRandomDouble ( double  min,
double  max 
) [static]

Returns a random double in the specified range

Definition at line 188 of file Util.cpp.

float Util::getRandomFloat ( float  min,
float  max 
) [static]

Returns a random float in the specified range

Definition at line 199 of file Util.cpp.

unsigned int Util::getRandomUInt ( unsigned  min,
unsigned  max 
) [static]

Returns a random unsigned integer in the specified range

Definition at line 210 of file Util.cpp.

QString Util::getRootDirectory ( ) [static]

Returns the root directory of the application. Assumes that application is launched from bin directory.

Definition at line 221 of file Util.cpp.

unsigned int Util::getUInt ( const QString &  str) [static]

Converts the QString to an unsigned integer. Throws a number conversion exception if the conversion fails.

Definition at line 88 of file Util.cpp.

QList< unsigned int > Util::getUIntList ( const QString &  str) [static]

Converts a string containing a comma separated list of unsigned integers into a qlist of unsigned ints

Definition at line 98 of file Util.cpp.

unsigned Util::getUIntParameter ( const QString &  paramName,
QHash< QString, double > &  paramMap 
) [static]

Returns an unsigned parameter from the supplied map and throws an exception if the parameter does not exist.

Definition at line 154 of file Util.cpp.

bool Util::isNumber ( const QString &  str) [static]

Returns true if the string is a number

Definition at line 233 of file Util.cpp.

float Util::min ( float  n1,
float  n2,
float  n3 
) [static]

Returns the minimum of three numbers

Definition at line 268 of file Util.cpp.

void Util::printBinary ( uint64_t  number) [static]

Prints out a binary number

Definition at line 279 of file Util.cpp.

void Util::printBoolArray ( bool  arr[],
int  arrLen 
) [static]

Prints out a bool array

Definition at line 294 of file Util.cpp.

void Util::printByteArray ( byte *  byteArr,
int  arrLen 
) [static]

Prints out the byte array

Definition at line 307 of file Util.cpp.

void Util::printByteArray ( const QByteArray &  byteArr) [static]

Prints out the bits in a QByteArray

Definition at line 320 of file Util.cpp.

void Util::printParameterMap ( const QHash< QString, double > &  paramMap) [static]

Prints out the names and values of the parameters stored in the map

Definition at line 166 of file Util.cpp.

double Util::rDouble ( double  num,
int  numPlaces 
) [static]

Rounds the given double to the specified number of decimal places.

Definition at line 336 of file Util.cpp.

int Util::rInt ( double  num) [static]

Rounds the double and returns it as an integer

Definition at line 345 of file Util.cpp.

unsigned int Util::rUInt ( double  num) [static]

Rounds the double and returns it as an unsigned integer

Definition at line 352 of file Util.cpp.

void Util::safeCStringCopy ( char  target[],
const char  source[],
int  targetSize 
) [static]

Carries out a safe copy of source cstring to target cstring that is no larger than targetSize.

Definition at line 359 of file Util.cpp.

void Util::seedRandom ( int  seed = 0) [static]

Seeds the random number generator. If the seed is not specified or zero, number of seconds to midnight is used as the seed.

Definition at line 374 of file Util.cpp.

void Util::setGeneralization ( QHash< unsigned int, WeightlessNeuron * > &  weiNeurMap,
double  gen 
) [static]

Sets the generalization in a map of weightless neurons.

Definition at line 433 of file Util.cpp.

double Util::toPositive ( double  num) [static]

Converts number to a positive number if it is negative

Definition at line 440 of file Util.cpp.

float Util::toPositive ( float  num) [static]

Converts number to a positive number if it is negative

Definition at line 448 of file Util.cpp.

int Util::toPositive ( int  num) [static]

Converts number to a positive number if it is negative

Definition at line 456 of file Util.cpp.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Defines