コード例 #1
0
ファイル: BrownianMotion.java プロジェクト: zlongshen/ssj
 public double nextObservation() {
   double x = path[observationIndex];
   x += mudt[observationIndex] + sigmasqrdt[observationIndex] * gen.nextDouble();
   observationIndex++;
   path[observationIndex] = x;
   return x;
 }
コード例 #2
0
ファイル: BrownianMotion.java プロジェクト: zlongshen/ssj
 public double[] generatePath() {
   double x = x0;
   for (int j = 0; j < d; j++) {
     x += mudt[j] + sigmasqrdt[j] * gen.nextDouble();
     path[j + 1] = x;
   }
   observationIndex = d;
   observationCounter = d;
   return path;
 }
コード例 #3
0
ファイル: BrownianMotion.java プロジェクト: zlongshen/ssj
 /**
  * Generates and returns the next observation at time @f$t_{j+1} =@f$ `nextTime`. It uses the
  * previous observation time @f$t_j@f$ defined earlier (either by this method or by
  * <tt>setObservationTimes</tt>), as well as the value of the previous observation @f$X(t_j)@f$.
  * *Warning*: This method will reset the observations time @f$t_{j+1}@f$ for this process to
  * `nextTime`. The user must make sure that the @f$t_{j+1}@f$ supplied is @f$\geq t_j@f$.
  */
 public double nextObservation(double nextTime) {
   // This method is useful for generating variance gamma processes
   double x = path[observationIndex];
   double previousTime = t[observationIndex];
   observationIndex++;
   t[observationIndex] = nextTime;
   double dt = nextTime - previousTime;
   x += mu * dt + sigma * Math.sqrt(dt) * gen.nextDouble();
   path[observationIndex] = x;
   return x;
 }
コード例 #4
0
ファイル: BrownianMotion.java プロジェクト: zlongshen/ssj
 /** Returns the random stream of the normal generator. */
 public RandomStream getStream() {
   return gen.getStream();
 }
コード例 #5
0
ファイル: BrownianMotion.java プロジェクト: zlongshen/ssj
 /** Resets the random stream of the normal generator to `stream`. */
 public void setStream(RandomStream stream) {
   gen.setStream(stream);
 }
コード例 #6
0
ファイル: BrownianMotion.java プロジェクト: zlongshen/ssj
 public double[] generatePath(RandomStream stream) {
   gen.setStream(stream);
   return generatePath();
 }
コード例 #7
0
ファイル: BrownianMotion.java プロジェクト: zlongshen/ssj
 /**
  * Generates an observation of the process in `dt` time units, assuming that the process has
  * value @f$x@f$ at the current time. Uses the process parameters specified in the constructor.
  * Note that this method does not affect the sample path of the process stored internally (if
  * any).
  */
 public double nextObservation(double x, double dt) {
   x += mu * dt + sigma * Math.sqrt(dt) * gen.nextDouble();
   return x;
 }