// file: $USFS/eval/exp_13/code/sbe_std_0.cc
//

// isip include files
//
#include "sbe_eval.h"

#include "sbe_eval_constants.h"
#include <integral_constants.h>

// program to find the mean value
//
logical_1 Sbe_eval::std_cc() {
  
  // declare local variables
  //
  float_4 diff = 0;
  float_4 sum = 0;

  // find the diff of each sbe from the mean value
  //
  for (int_4 i=0; i < no_of_images_d; i++) {
    
    diff = sbe_value_d[i] - sbe_mean_d;
    
    sum += diff * diff;
  }

  // finding the standard deviation
  //
  sbe_std_d = sqrt(sum / (no_of_images_d - 1));

  // exit gracefully
  //
  return ISIP_TRUE;
}
 
