diff bayesianArraySrc/DynamicVector.h @ 0:c4f9e49226eb

Initialising repository. Live osc input registered. Files analysed offline.
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Tue, 31 Jan 2012 13:54:17 +0000
parents
children 179c09199b3c
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bayesianArraySrc/DynamicVector.h	Tue Jan 31 13:54:17 2012 +0000
@@ -0,0 +1,71 @@
+/*
+ *  DynamicVector.h
+ *  midiCannamReader
+ *
+ *  Created by Andrew on 18/07/2011.
+ *  Copyright 2011 QMUL. All rights reserved.
+ *
+ */
+
+//OPTIMIZE CONSTRAINED VECTOR
+
+#include "stdlib.h"
+#include "ofMain.h"
+#include "ofxWindowRegion.h"
+
+#ifndef _DYNAMIC_VECTOR
+#define _DYNAMIC_VECTOR
+#define GAUSSIAN_LOOKUP_LENGTH 1000000
+
+class DynamicVector{
+public:
+	DynamicVector();
+
+	void createVector(int len);
+	void renormalise();
+	void translateDistribution(int translationIndex);
+	typedef std::vector<double> DoubleVector;
+	DoubleVector array;
+	double getMaximum();
+	double getIntegratedEstimate();
+	double getLookupIndex(const int& i, const double& mean, const double& StdDev);
+	void addGaussianShapeByLookupTable(double& mean, double& StdDev, double factor);
+	double gaussianLookupTable[GAUSSIAN_LOOKUP_LENGTH];
+	double gaussianLookupMean, gaussianLookupStdDev;
+	double integratedEstimate;
+	void updateIntegratedEstimate();
+	void updateLimitedIntegratedEstimate();
+	
+	void drawVector(const int& minIndex, const int& maxIndex);
+	void drawVector(const int& minIndex, const int& maxIndex, ofxWindowRegion window);
+	
+	void drawConstrainedVector(const int& minIndex, const int& maxIndex, const int& minScreenIndex, const int& maxScreenIndex);
+
+	void addConstant(const double& value);
+	void addGaussianShape(const double& mean, const double& stddev, double factor);
+	void addTriangularShape(double mean, double width, double factor);
+	void addToIndex(const int& index, const double& constant);
+	
+	void doProduct(DynamicVector& arrayOne, DynamicVector& arrayTwo);
+		
+	double getIndexInRealTerms(const int& index);
+	double getRealTermsAsIndex(double value);
+	double getValueAtMillis(const double& millis);
+	
+	void printArray();
+	void zero();
+	
+	void copyFromDynamicVector(const DynamicVector& dynamicVec);
+	
+	//variables
+	int length, arraySize;
+	double maximumValue;
+	int MAPestimate;
+	
+	double offset;
+	double scalar;//each array point is this much of the quantity
+	//i.e. array[index] contributes to (offset + scalar*index) in real terms
+
+};
+
+#endif