/*@@@@@@@@@@@@@@@@@@@@@ testGeneratePath.cpp @@@@@@@@@@@@@@@@@@@@@@@@@@
 Random Option Pricing
 Summer 2002
 Authors: A. Korobchevsky
          S. Ferrando
 Ryerson University ALL RIGHTS RESERVED
 
 Purpose: Tests the generatePath underlying function implementation 
          for Binom underlying
 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

#include <iostream>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <cstring>
using namespace std;

#include "../../Rng/GSL_RandomGen.h" 
#include "../../Und/Binom.h"




/********************************** main ******************************
 * Function: main
 * Purpose: Tests generatePath() function for each underline.
 *          Dumps all ups and downs on screen
 *          Forces the number of ups as given in the second function parameter
 *          For discrete underlyings the path will contain up/down parameters
 *             i.e.  U = 1.1    D = 0.9       N = 10    n = 3
 *           the result might look like     
            #### 1.1 0.9 0.9 1.1 0.9 0.9 1.1 0.9 0.9 0.9 ###########

 * C.L arguments: N/A
 * Return: N/A
 * Precondition: Binom Up/Down must be initialized before calling generate path 
 *********************************************************************/

// BEGIN All
int main()
{ int N = 10;
  double* path = new double[N];

  // Testing Binom
  Binom binom("taus");
  binom.U = 1.1;
  binom.D = 0.9;
  path = binom.generatePath(N, 4);
  
  for (int i = 0; i < N; i++)
    cout << path[i] << " "; 
  cout << "\n";  

  vector<double> v = binom.vectorPath(N, 6);
  copy(v.begin(), v.end(), ostream_iterator<double>(cout, " "));
  cout << "\nShifting once...\n";
  binom.shiftPath(v);  
  copy(v.begin(), v.end(), ostream_iterator<double>(cout, " "));
  cout << "\nShifting twice...\n";
  binom.shiftPath(v);  
  copy(v.begin(), v.end(), ostream_iterator<double>(cout, " "));
  cout << "\n";
}
// END All
