diff NNLSChroma.cpp @ 22:444c344681f3 matthiasm-plugin

* Rather than worry about provenance of C versions, why not just use the FORTRAN? (We can back this out if it doesn't go well with the build scripts)
author Chris Cannam
date Thu, 21 Oct 2010 11:58:28 +0100
parents e72c4ad432d8
children 93c836cfb8c5
line wrap: on
line diff
--- a/NNLSChroma.cpp	Mon Oct 18 09:35:26 2010 +0000
+++ b/NNLSChroma.cpp	Thu Oct 21 11:58:28 2010 +0100
@@ -1199,7 +1199,7 @@
 	        f6.hasTimestamp = true;
 	        f6.timestamp = f2.timestamp;
 	        
-			float b[256];
+			double b[256];
 	
 	        bool some_b_greater_zero = false;
 			float sumb = 0;
@@ -1233,7 +1233,7 @@
 					}
 		        
 				} else {
-					float x[84+1000];
+				    double x[84+1000];
 					for (int i = 1; i < 1084; ++i) x[i] = 1.0;
                     vector<int> signifIndex;
                     int index=0;
@@ -1247,20 +1247,22 @@
                         f3.values.push_back(0); // fill the values, change later
                         index++;
 					}
-				    float rnorm;
-				    float w[84+1000];
-				    float zz[84+1000];
+				    double rnorm;
+				    double w[84+1000];
+				    double zz[84+1000];
 				    int indx[84+1000];
 				    int mode;
                     int dictsize = 256*signifIndex.size();
                     // cerr << "dictsize is " << dictsize << "and values size" << f3.values.size()<< endl;
-					float *curr_dict = new float[dictsize];
+		    double *curr_dict = new double[dictsize];
 					for (unsigned iNote = 0; iNote < signifIndex.size(); ++iNote) {
                         for (unsigned iBin = 0; iBin < 256; iBin++) {
     						curr_dict[iNote * 256 + iBin] = 1.0 * m_dict[signifIndex[iNote] * 256 + iBin];
                         }
 					}
-					nnls(curr_dict, nNote, nNote, signifIndex.size(), b, x, &rnorm, w, zz, indx, &mode);
+					int sz = signifIndex.size();
+					int nn = nNote;
+					NNLS(curr_dict, &nn, &nn, &sz, b, x, &rnorm, w, zz, indx, &mode);
                     delete [] curr_dict;
 					for (unsigned iNote = 0; iNote < signifIndex.size(); ++iNote) {
 						f3.values[signifIndex[iNote]] = x[iNote];