// isip include files
//
#include <Algorithm.h>
#include <Correlation.h>

// main program starts here:
//  this example demonstrates the use of a compute method
//
int main(int argc, const char** argv) {

  // declare an Correlation object
  //
  Correlation xcor;

  // declare the input and output vectors
  //
  VectorFloat ref(L"1, 2, 1, 3, 4, 2, 3, 1");
  VectorFloat test(L"2, 3, 2");
  VectorFloat output;
  
  // set the algorithm, implementation, normalization and order
  //     
  xcor.setAlgorithm(Correlation::CROSS);
  xcor.setImplementation(Correlation::UNFACTORED);
  xcor.setComputeMode(Correlation::FRAME_INTERNAL);        
  xcor.setNormalization(Correlation::NONE);
  
  // compute the cross-correlation
  //
  xcor.compute(output, ref, test);

  // output the inputs and output to the console
  //
  ref.debug(L"reference signal:");
  test.debug(L"test signal:");
  output.debug(L"Cross-correlation:");
  
  // exit gracefully
  //
  Integral::exit();
}
