comparison maths/Correlation.cpp @ 499:af5b7ef02aa7

Style fixes: avoid unsigned, fix formatting
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 03 Jun 2019 14:20:39 +0100
parents 701233f8ed41
children
comparison
equal deleted inserted replaced
498:8b92623e81c9 499:af5b7ef02aa7
29 Correlation::~Correlation() 29 Correlation::~Correlation()
30 { 30 {
31 31
32 } 32 }
33 33
34 void Correlation::doAutoUnBiased(double *src, double *dst, unsigned int length) 34 void Correlation::doAutoUnBiased(double *src, double *dst, int length)
35 { 35 {
36 double tmp = 0.0; 36 double tmp = 0.0;
37 double outVal = 0.0; 37 double outVal = 0.0;
38 38
39 unsigned int i,j; 39 int i, j;
40 40
41 for( i = 0; i < length; i++) { 41 for (i = 0; i < length; i++) {
42 for( j = i; j < length; j++) { 42 for (j = i; j < length; j++) {
43 tmp += src[ j-i ] * src[ j ]; 43 tmp += src[ j-i ] * src[ j ];
44 } 44 }
45 45
46 outVal = tmp / ( length - i ); 46 outVal = tmp / ( length - i );
47 47
48 if( outVal <= 0 ) { 48 if (outVal <= 0) {
49 dst[ i ] = EPS; 49 dst[ i ] = EPS;
50 } else { 50 } else {
51 dst[ i ] = outVal; 51 dst[ i ] = outVal;
52 } 52 }
53 53