/*------------------------------------------------------------- Copyright (C) 2005 Fabrizio Ferre'. All Rights Reserved. Permission to use, copy, modify, and distribute this software and its documentation for NON-COMMERCIAL purposes and without fee is hereby granted provided that this copyright notice appears in all copies. THE AUTHOR AND PUBLISHER MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE AUTHORS AND PUBLISHER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. -------------------------------------------------------------*/ /**************************************************** Program: timeWarpingBoltzmann_2.h Fabrizio Ferre, 19 Jan 2005 Function prototypes for timeWarpingBoltzmann_2.cpp ****************************************************/ #include #include #include // def of RAND_MAX #include #define N 100 // size of time series data #define MIN2(x,y) ((x)>(y) ? (y) : (x)) #define MIN3(x,y,z) (MIN2(x,y)>(z) ? (z) : MIN2(x,y)) #define MAX2(x,y) ((x)<(y) ? (y) : (x)) #define lenLine 1000 //max length of time series data file /** function prototypes **/ int parseInputFile(char fileName[], float timePoints[], float expressionArray[]); /** returns size of arrays **/ float distance(double timePoint1, double timePoint2, float scalingFactor); /** compute distance between time series points as absoulte value of their difference **/ float scale(double array1[], double array2[], int size1, int size2); /** finds the min and max values and scale according to 1/(sqrt(n*pow(max-min,2))) **/ double forwardPathMatrix(double pathMatrix[][N], char backtrackArrows[][N], double timeSeries1[], double timeSeries2[], float timeIntervals1[], float timeIntervals2[], int size1, int size2, float scalingFactor); double backwardPathMatrix(double pathMatrix[][N], double timeSeries1[], double timeSeries2[], float timeIntervals1[], float timeIntervals2[], int size1, int size2, float scalingFactor); int traceback(char arrows[][N], int alignment1[], int alignment2[], int size1, int size2); double forwardPartitionFunction(double partitionFunction[][N], double timeSeries1[], double timeSeries2[], float temperature, float BoltzmannK, float timeIntervals1[], float timeIntervals2[], int size1, int size2, float scalingFactor); double backwardPartitionFuntion(double partitionFunction[][N], double timeSeries1[], double timeSeries2[], float temperature, float BoltzmannK, float timeIntervals1[], float timeIntervals2[], int size1, int size2, float scalingFactor); void computePairAlignmentProb(double forwardPartitionFunction[][N], double backwardPartitionFunction[][N], int alignment1[], int alignment2[], int sizeAlignment, double probabilities[], double timeSeries1[], double timeSeries2[], float temperature, float boltzmannK, float timeIntervals1[], float timeIntervals2[], float scalingFactor); void computeTimeIntervals(float timePoints[], float timeIntervals[], int lenghtOfArray, float scalingFactor); void normalize(float array[], int itsSize, double normalizedArray[], double mean, double stdev); void meanStdDev(float array[], int itsSize, double *mean, double *stdev); void printForwardPathMatrix(double pathMatrix[][N], int n, int m); void printBackwardPathMatrix(double pathMatrix[][N], int n, int m); void printAlignment(int alignmentArray1[], int alignmentArray2[], int alignmentSize); void printFloatArray(float array[], int itsSize); void printIntArray(int array[], int itsSize); void printDoubleArray(double array[], int itsSize); void printTwoArrays(float array1[], float array2[], int itsSize); void printThreeArrays(float array1[], float array2[], float array3[], int itsSize); void printPairProbabilities(int alignmentArray1[], int alignmentArray2[], double probabilities[], int alignmentSize); void reverseIntArray(int array[], unsigned short int itsSize);