Mercurial > hg > midi-score-follower
annotate src/DynamicVector.h @ 0:b299a65a3ad0
start project
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Tue, 16 Aug 2011 11:29:59 +0100 |
parents | |
children | 1a32ce016bb9 |
rev | line source |
---|---|
andrew@0 | 1 /* |
andrew@0 | 2 * DynamicVector.h |
andrew@0 | 3 * midiCannamReader |
andrew@0 | 4 * |
andrew@0 | 5 * Created by Andrew on 18/07/2011. |
andrew@0 | 6 * Copyright 2011 QMUL. All rights reserved. |
andrew@0 | 7 * |
andrew@0 | 8 */ |
andrew@0 | 9 |
andrew@0 | 10 //OPTIMIZE CONSTRAINED VECTOR |
andrew@0 | 11 |
andrew@0 | 12 #include "stdlib.h" |
andrew@0 | 13 #include "ofMain.h" |
andrew@0 | 14 |
andrew@0 | 15 #ifndef _DYNAMIC_VECTOR |
andrew@0 | 16 #define _DYNAMIC_VECTOR |
andrew@0 | 17 |
andrew@0 | 18 class DynamicVector{ |
andrew@0 | 19 public: |
andrew@0 | 20 DynamicVector(); |
andrew@0 | 21 |
andrew@0 | 22 void createVector(int len); |
andrew@0 | 23 void renormalise(); |
andrew@0 | 24 void translateDistribution(int translationIndex); |
andrew@0 | 25 typedef std::vector<double> DoubleVector; |
andrew@0 | 26 DoubleVector array; |
andrew@0 | 27 double getMaximum(); |
andrew@0 | 28 void drawVector(const int& minIndex, const int& maxIndex); |
andrew@0 | 29 void drawConstrainedVector(const int& minIndex, const int& maxIndex, const int& minScreenIndex, const int& maxScreenIndex); |
andrew@0 | 30 |
andrew@0 | 31 void addConstant(double value); |
andrew@0 | 32 void addGaussianShape(double mean, double stddev, double factor); |
andrew@0 | 33 void addToIndex(int index, double constant); |
andrew@0 | 34 |
andrew@0 | 35 void doProduct(DynamicVector& arrayOne, DynamicVector& arrayTwo); |
andrew@0 | 36 |
andrew@0 | 37 double getIndexInRealTerms(const int& index); |
andrew@0 | 38 double getRealTermsAsIndex(double value); |
andrew@0 | 39 |
andrew@0 | 40 void printArray(); |
andrew@0 | 41 void zero(); |
andrew@0 | 42 |
andrew@0 | 43 void copyFromDynamicVector(const DynamicVector& dynamicVec); |
andrew@0 | 44 |
andrew@0 | 45 //variables |
andrew@0 | 46 int length, arraySize; |
andrew@0 | 47 double maximumValue; |
andrew@0 | 48 int MAPestimate; |
andrew@0 | 49 |
andrew@0 | 50 double offset; |
andrew@0 | 51 double scalar;//each array point is this much of the quantity |
andrew@0 | 52 //i.e. array[index] contributes to (offset + scalar*index) in real terms |
andrew@0 | 53 |
andrew@0 | 54 }; |
andrew@0 | 55 |
andrew@0 | 56 #endif |