// file: $USFS/class/image_analysis/v3.0/imaga_he_05.cc
//

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

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

// system include files
//
//#include <string.h>

// method: pca_covar_cc
//
// arguments: none
//  
// return: a logical_1 value indicating status
//
// this method computes the covariance matrix of the feature vectors
//
logical_1 Image_analysis::pca_covar_cc () {
  
  // computing the elements of the covariance matrix
  //
  for (int_4 i=0; i<pca_t_values_read_d; i++) {
    for (int_4 j=0; j <= i; j++) {
      covar_t_data_d[i * pca_t_values_read_d + j] +=
	pca_t_data_d[i] * pca_t_data_d[j];
    }
  }
  
  // updating the mean with each image
  //
  for (int_4 i=0; i < pca_t_values_read_d; i++) {
    mean_t_data_d[i] += pca_t_data_d[i];
  }
  
  // exit gracefully
  //
  return ISIP_TRUE;
}



