/*@@@@@@@@@@@@@@@@@@@@@@@@ Underlying.h @@@@@@@@@@@@@@@@@@@@@@@@@@@@
 Random Option Pricing
 Summer 2002
 Authors: A. Korobchevsky
          S. Ferrando
 Ryerson University ALL RIGHTS RESERVED
 
 Purpose: Declares and Implements the Binom Discrete Underlying Structure
          All functions defined inline.

 Instance variables:
     U - Upstep
	  D - Downstep
	  r - Interest rate (constant)
	  T - Time period (in years)
	  N - Number of timesteps
	  GSL_RandomGen* - pointer to random generator object based on GNU SL.
	  P - Down probability (may be independent of up/down probabilities
 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

#ifndef UNDER_H__
#define UNDER_H__

#include <cmath>
#include <vector>
#include "../Rng/GSL_RandomGen.h" 




// BEGIN All
struct Underlying
{ double U;
  double D; 
  double r;
  double T;
  int N;
  double P;
  double sigma;

  GSL_RandomGen *gen;




  /***************************** next ********************************* 
  Function: next 
  Purpose: Calculates next stock value
  Param: double - Current stock value
  Returns: Next stock value
  *********************************************************************/ 
  virtual double next(double) = 0;




  /*************************** generatePath *************************** 
  Function: generatePath 
  Purpose: Dumps the whole path at once. Forces specified number of ups 
  Param: int - length of the path
         int - number of ups forced in the path
  Returns: Array of ups and downs
  *********************************************************************/ 
  virtual double* generatePath(int N, int n) = 0;
};

// END All
#endif
