Skip to content
Permalink
Browse files

optimize standard deviation method

  • Loading branch information
root676 authored and nyalldawson committed Jul 2, 2020
1 parent 371f7b2 commit 7383238cf3b6a9fd226c4a330e59ebaaf5866560
Showing with 2 additions and 7 deletions.
  1. +2 −7 src/analysis/processing/qgsrasteranalysisutils.cpp
@@ -343,13 +343,8 @@ double QgsRasterAnalysisUtils::medianFromCellValues( std::vector<double> cellVal

double QgsRasterAnalysisUtils::stddevFromCellValues( std::vector<double> cellValues, int stackSize )
{
double mean = meanFromCellValues( cellValues, stackSize );
double accum = 0.0;
for ( int i = 0; i < stackSize; i++ )
{
accum += std::pow( ( cellValues.at( i ) - mean ), 2.0 );
}
double stddev = std::sqrt( accum / static_cast<double>( stackSize ) );
double variance = varianceFromCellValues( cellValues, stackSize );
double stddev = std::sqrt( variance );
return stddev;
}

0 comments on commit 7383238

Please sign in to comment.
You can’t perform that action at this time.