Package org.jquantlib.math.functions

Examples of org.jquantlib.math.functions.Bind2ndPredicate


    @Override
    public List</* @Time */Double> mandatoryTimes() {
        final List</* @Time */Double> times = underlying.mandatoryTimes();

        // discard negative times...
        final Array array = new FindIf(exerciseTimes, new Bind2ndPredicate(new GreaterEqualPredicate(), 0.0)).op();
        // and add the positive ones
        for (int i=0; i< array.size(); i++) {
            times.add(array.get(i));
        }
        return times;
View Full Code Here


        final List<Ops.DoubleOp> functions = new ArrayList<Ops.DoubleOp>();
        functions.add(new Square());
        functions.add(new Bind2nd(new Minus(), target));
        final Expression comp = new Expression(functions);
        final Ops.DoublePredicate less = new Bind2ndPredicate(new LessThanPredicate(), target);

        final Pair<Double, Integer> result = statistics.expectationValue(comp, less);
        final double x = result.getFirst();

        // TODO: code review :: please verify against QL/C++ code
View Full Code Here

            //not sure whether to throw an exception
            //throw new IllegalArgumentException(empty_sample_set);
        }
        final double target = -valueAtRisk(centile);

        final Ops.DoublePredicate less = new Bind2ndPredicate(new LessThanPredicate(), target);
        final Pair<Double, Integer> result = statistics.expectationValue(new Identity(), less);

        final double x = result.getFirst();
        final Integer N = result.getSecond();
View Full Code Here

     */
    public double shortfall(final double target){
        if (statistics.getSampleSize()==0)
            throw new IllegalArgumentException(empty_sample_set);

        final Ops.DoublePredicate less = new Bind2ndPredicate(new LessThanPredicate(), target);
        return statistics.expectationValue(new Clipped(less, new Constant(1.0)), new TruePredicate()).getFirst();
    }
View Full Code Here

    final List<Ops.DoubleOp> functions = new ArrayList<Ops.DoubleOp>();
    functions.add(new Square());
    functions.add(new Bind2nd(new Minus(), target));
    final Expression comp = new Expression(functions);
    final Ops.DoublePredicate less = new Bind2ndPredicate(new LessThanPredicate(), target);

    final Pair<Double, Integer> result = expectationValue(comp, less);
    final double x = result.first();

    final int n = result.second().intValue();
View Full Code Here

    QL.require(centile>=0.9 && centile<1.0, "percentile out of range [0.9, 1.0)");
    QL.ensure(samples() != 0, EMPTY_SAMPLE_SET);
   
    final double target = -valueAtRisk(centile);

    final Ops.DoublePredicate less = new Bind2ndPredicate(new LessThanPredicate(), target);
    final Pair<Double, Integer> result = expectationValue(new Identity(), less);

    final double x = result.first();
    final Integer N = result.second();
View Full Code Here

   *    \right. }
   */
  public /*@Real*/ double shortfall(final /*@Real*/ double target) /*@ReadOnly*/ {
    QL.ensure(samples() != 0, EMPTY_SAMPLE_SET);

    final Ops.DoublePredicate less = new Bind2ndPredicate(new LessThanPredicate(), target);
    return expectationValue(new Clipped(less, new Constant(1.0)), new TruePredicate()).first();
  }
View Full Code Here

    @Override
    public List</* @Time */Double> mandatoryTimes() {
        final List</* @Time */Double> times = underlying.mandatoryTimes();

        // discard negative times...
        final Array array = new FindIf(exerciseTimes, new Bind2ndPredicate(new GreaterEqualPredicate(), 0.0)).op();
        // and add the positive ones
        for (int i=0; i< array.size(); i++) {
            times.add(array.get(i));
        }
        return times;
View Full Code Here

TOP

Related Classes of org.jquantlib.math.functions.Bind2ndPredicate

Copyright © 2018 www.massapicom. 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.