/** Frees memory by deleting a few slices from the end of the stack. */
 public void trim() {
   int n = (int) Math.round(Math.log(nSlices) + 1.0);
   for (int i = 0; i < n; i++) {
     deleteLastSlice();
     System.gc();
   }
 }
示例#2
0
  /*------------------------------------------------------------------*/
  double getInitialCausalCoefficientMirrorOnBounds(double[] c, double z, double tolerance) {
    double z1 = z, zn = Math.pow(z, c.length - 1);
    double sum = c[0] + zn * c[c.length - 1];
    int horizon = c.length;

    if (0.0 < tolerance) {
      horizon = 2 + (int) (Math.log(tolerance) / Math.log(Math.abs(z)));
      horizon = (horizon < c.length) ? (horizon) : (c.length);
    }
    zn = zn * zn;
    for (int n = 1; (n < (horizon - 1)); n++) {
      zn = zn / z;
      sum = sum + (z1 + zn) * c[n];
      z1 = z1 * z;
    }
    return (sum / (1.0 - Math.pow(z, 2 * c.length - 2)));
  } /* end getInitialCausalCoefficientMirrorOnBounds */
示例#3
0
 double rodbard(double x) {
   // y = c*((a-x/(x-d))^(1/b)
   // a=3.9, b=.88, c=712, d=44
   double ex;
   if (x == 0.0) ex = 5.0;
   else ex = Math.exp(Math.log(x / 700.0) * 0.88);
   double y = 3.9 - 44.0;
   y = y / (1.0 + ex);
   return y + 44.0;
 }