diff maths/Correlation.cpp @ 505:930b5b0f707d

Merge branch 'codestyle-and-tidy'
author Chris Cannam <cannam@all-day-breakfast.com>
date Wed, 05 Jun 2019 12:55:15 +0100
parents af5b7ef02aa7
children
line wrap: on
line diff
--- a/maths/Correlation.cpp	Thu May 30 16:18:13 2019 +0100
+++ b/maths/Correlation.cpp	Wed Jun 05 12:55:15 2019 +0100
@@ -15,6 +15,8 @@
 
 #include "Correlation.h"
 
+#include "MathAliases.h"
+
 //////////////////////////////////////////////////////////////////////
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
@@ -29,28 +31,26 @@
 
 }
 
-void Correlation::doAutoUnBiased(double *src, double *dst, unsigned int length)
+void Correlation::doAutoUnBiased(double *src, double *dst, int length)
 {
     double tmp = 0.0;
     double outVal = 0.0;
 
-    unsigned int i,j;
+    int i, j;
 
-    for( i = 0; i <  length; i++)
-    {
-	for( j = i; j < length; j++)
-	{
-	    tmp += src[ j-i ] * src[ j ]; 
-	}
+    for (i = 0; i < length; i++) {
+        for (j = i; j < length; j++) {
+            tmp += src[ j-i ] * src[ j ]; 
+        }
 
+        outVal = tmp / ( length - i );
 
-	outVal = tmp / ( length - i );
-
-	if( outVal <= 0 )
-	    dst[ i ] = EPS;
-	else
-	    dst[ i ] = outVal;
-
-	tmp = 0.0;
+        if (outVal <= 0) {
+            dst[ i ] = EPS;
+        } else {
+            dst[ i ] = outVal;
+        }
+        
+        tmp = 0.0;
     }
 }