comparison maths/Correlation.cpp @ 477:fa407c1d9923

Untabify + indent
author Chris Cannam <cannam@all-day-breakfast.com>
date Thu, 30 May 2019 18:36:48 +0100
parents d5014ab8b0e5
children 701233f8ed41
comparison
equal deleted inserted replaced
476:2de6184b2ce0 477:fa407c1d9923
34 double tmp = 0.0; 34 double tmp = 0.0;
35 double outVal = 0.0; 35 double outVal = 0.0;
36 36
37 unsigned int i,j; 37 unsigned int i,j;
38 38
39 for( i = 0; i < length; i++) 39 for( i = 0; i < length; i++) {
40 { 40 for( j = i; j < length; j++) {
41 for( j = i; j < length; j++) 41 tmp += src[ j-i ] * src[ j ];
42 { 42 }
43 tmp += src[ j-i ] * src[ j ];
44 }
45 43
44 outVal = tmp / ( length - i );
46 45
47 outVal = tmp / ( length - i ); 46 if( outVal <= 0 ) {
48 47 dst[ i ] = EPS;
49 if( outVal <= 0 ) 48 } else {
50 dst[ i ] = EPS; 49 dst[ i ] = outVal;
51 else 50 }
52 dst[ i ] = outVal; 51
53 52 tmp = 0.0;
54 tmp = 0.0;
55 } 53 }
56 } 54 }