Package cern.jet.random.engine

Examples of cern.jet.random.engine.RandomEngine.nextDouble()


    if (Math.abs(b) < 1e-3 && Math.abs(c) < 1e-3) { //almost flat smile
      final double theta = Math.PI / 2 - 0.01;
      return new DoubleMatrix1D(a, 0.01, theta, theta);
    }
    final double theta = Math.PI / 2 * random.nextDouble();
    return new DoubleMatrix1D(a * (0.8 + 0.4 * random.nextDouble()), a * 0.5 * random.nextDouble(), theta, theta);
  }

  @Override
  protected BitSet getLocalFixedValues() {
View Full Code Here


    if (Math.abs(b) < 1e-3 && Math.abs(c) < 1e-3) { //almost flat smile
      final double theta = Math.PI / 2 - 0.01;
      return new DoubleMatrix1D(a, 0.01, theta, theta);
    }
    final double theta = Math.PI / 2 * random.nextDouble();
    return new DoubleMatrix1D(a * (0.8 + 0.4 * random.nextDouble()), a * 0.5 * random.nextDouble(), theta, theta);
  }

  @Override
  protected BitSet getLocalFixedValues() {
    final BitSet res = new BitSet();
View Full Code Here

    if (Math.abs(b) < 1e-3 && Math.abs(c) < 1e-3) { //almost flat smile
      final double theta = Math.PI / 2 - 0.01;
      return new DoubleMatrix1D(a, 0.01, theta, theta);
    }
    final double theta = Math.PI / 2 * random.nextDouble();
    return new DoubleMatrix1D(a * (0.8 + 0.4 * random.nextDouble()), a * 0.5 * random.nextDouble(), theta, theta);
  }

  @Override
  protected BitSet getLocalFixedValues() {
    final BitSet res = new BitSet();
View Full Code Here

    double alpha, beta, rho, nu;
    //TODO make better use of the polynomial fit information
    if (_externalBeta) {
      beta = _beta;
    } else {
      beta = random.nextDouble();
    }

    if (a <= 0.0) { //negative ATM vol - can get this if fit points are far from ATM
      double sum = 0;
      final int n = strikes.length;
View Full Code Here

      final int n = strikes.length;
      for (int i = 0; i < n; i++) {
        sum += impliedVols[i];
      }
      final double approxAlpha = sum / n * Math.pow(forward, 1 - beta);
      alpha = (random.nextDouble() + 0.5) * approxAlpha;
      rho = random.nextDouble() - 0.5;
      nu = 0.5 * random.nextDouble() + 0.1;
      return new DoubleMatrix1D(alpha, beta, rho, nu);
    }
    if (Math.abs(b) < 1e-3 && Math.abs(c) < 1e-3) { //almost flat smile
View Full Code Here

      for (int i = 0; i < n; i++) {
        sum += impliedVols[i];
      }
      final double approxAlpha = sum / n * Math.pow(forward, 1 - beta);
      alpha = (random.nextDouble() + 0.5) * approxAlpha;
      rho = random.nextDouble() - 0.5;
      nu = 0.5 * random.nextDouble() + 0.1;
      return new DoubleMatrix1D(alpha, beta, rho, nu);
    }
    if (Math.abs(b) < 1e-3 && Math.abs(c) < 1e-3) { //almost flat smile
      if (_externalBeta && _beta != 1.0) {
View Full Code Here

        sum += impliedVols[i];
      }
      final double approxAlpha = sum / n * Math.pow(forward, 1 - beta);
      alpha = (random.nextDouble() + 0.5) * approxAlpha;
      rho = random.nextDouble() - 0.5;
      nu = 0.5 * random.nextDouble() + 0.1;
      return new DoubleMatrix1D(alpha, beta, rho, nu);
    }
    if (Math.abs(b) < 1e-3 && Math.abs(c) < 1e-3) { //almost flat smile
      if (_externalBeta && _beta != 1.0) {
        s_logger.warn("Smile almost flat. Cannot use beta = ", +_beta + " so extenal value ignored, and beta = 1.0 used");
View Full Code Here

        s_logger.warn("Smile almost flat. Cannot use beta = ", +_beta + " so extenal value ignored, and beta = 1.0 used");
      }
      return new DoubleMatrix1D(a, 1.0, 0.0, Math.max(0.0, 4 * c));
    }
    final double approxAlpha = a * Math.pow(forward, 1 - beta);
    alpha = (random.nextDouble() + 0.5) * approxAlpha;
    rho = random.nextDouble() - 0.5;
    nu = (random.nextDouble() + 0.5) * Math.max(0.0, 4 * c);
    return new DoubleMatrix1D(alpha, beta, rho, nu);
  }

View Full Code Here

      }
      return new DoubleMatrix1D(a, 1.0, 0.0, Math.max(0.0, 4 * c));
    }
    final double approxAlpha = a * Math.pow(forward, 1 - beta);
    alpha = (random.nextDouble() + 0.5) * approxAlpha;
    rho = random.nextDouble() - 0.5;
    nu = (random.nextDouble() + 0.5) * Math.max(0.0, 4 * c);
    return new DoubleMatrix1D(alpha, beta, rho, nu);
  }

  @Override
View Full Code Here

      return new DoubleMatrix1D(a, 1.0, 0.0, Math.max(0.0, 4 * c));
    }
    final double approxAlpha = a * Math.pow(forward, 1 - beta);
    alpha = (random.nextDouble() + 0.5) * approxAlpha;
    rho = random.nextDouble() - 0.5;
    nu = (random.nextDouble() + 0.5) * Math.max(0.0, 4 * c);
    return new DoubleMatrix1D(alpha, beta, rho, nu);
  }

  @Override
  protected BitSet getGlobalFixedValues() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.