Package org.jquantlib.math.matrixutilities

Examples of org.jquantlib.math.matrixutilities.Array$Range


        // typedef TermStructureFittingParameter::NumericalImpl NumericalImpl;
        final TermStructureFittingParameter.NumericalImpl impl = (TermStructureFittingParameter.NumericalImpl) phi.implementation();
        impl.reset();
        for (int /* @Size */i = 0; i < (grid.size() - 1); i++) {
            final double /* @Real */discountBond = termStructureConsistentModelClass.termStructure().currentLink().discount(grid.at(i + 1));
            final Array statePrices = numericTree.statePrices(i);
            final int /* @Size */size = numericTree.size(i);
            final double /* @Time */dt = numericTree.timeGrid().dt(i);
            final double /* @Real */dx = trinomial.dx(i);
            double /* @Real */x = trinomial.underlying(i, 0);
            double /* @Real */value = 0.0;
            for (int /* @Size */j = 0; j < size; j++) {
                value += statePrices.get(j) * Math.exp(-x * dt);
                x += dx;
            }
            value = Math.log(value / discountBond) / dt;
            // impl->set(grid[i], value);
            impl.set(grid.index(i), value); // ???????????????
View Full Code Here


        QL.require(sampleWeight > 0.0 , unsufficient_sample_weight); // QA:[RG]::verified

        final double sampleNumber = samples();
        QL.require(sampleNumber > 1.0 , unsufficient_sample_number); // QA:[RG]::verified

        final Array m = null;// TODO: code review :: mean();
        final double inv = 1.0 / sampleWeight;

        // TODO: code review :: please verify against QL/C++ code
        throw new UnsupportedOperationException("work in progress");
        //        final Matrix result = quadraticSum_.mul(inv);
View Full Code Here

    //
    // Constructors
    //

    public SampledCurve(final int gridSize) {
        this.grid   = new Array(gridSize);
        this.values = new Array(gridSize);
    }
View Full Code Here

    }

    public SampledCurve(final Array grid) {
        // TODO: code review :: use of clone()
        this.grid   = grid;
        this.values = new Array(this.grid.size());
    }
View Full Code Here

     *
     * @param newGrid
     * @param f
     */
    public void regrid(final Array newGrid, final Ops.DoubleOp f) {
        final Array transformed;
        final Array newValues;

        if (f instanceof Identity) {
            transformed = this.grid;
            newValues = newGrid.clone();
        } else {
            transformed = this.grid.clone().transform(f);
            newValues = newGrid.clone().transform(f);
        }

        final CubicInterpolation priceSpline = new NaturalCubicInterpolation(transformed, values);

        priceSpline.update();
        for (int i=0; i<newValues.size(); i++) {
            newValues.set(i, priceSpline.op(newValues.get(i), true) );
        }

        this.grid.swap(newGrid);
        this.values.swap(newValues);
    }
View Full Code Here

    //
    // public constructors
    //

    public Problem(final CostFunction  costFunction, final Constraint  constraint) {
        this(costFunction, constraint, new Array());
    }
View Full Code Here

      final Schedule schedule,
      final IborIndex index,
      final DayCounter accrualDayCounter) {
    this(settlementDays, faceAmount, schedule,
        index, accrualDayCounter, BusinessDayConvention.Following,
        Constants.NULL_INTEGER, new Array(new double[] { 1.0 }),
        new Array(new double[] { 0.0 }), new Array(), new Array(),
        false, 100.0, new Date());

  }
View Full Code Here

      final Handle<IborIndex> index,
      final DayCounter accrualDayCounter) {
    this(settlementDays, faceAmount, startDate, maturityDate,
        couponFrequency, calendar, index,
        accrualDayCounter, BusinessDayConvention.Following, BusinessDayConvention.Following,
        Constants.NULL_INTEGER, new Array(new double[] { 1.0 }),
        new Array(new double[] { 0.0 }), new Array(), new Array(),
        false, 100.0, new Date(), new Date(),
        DateGeneration.Rule.Backward, false);
  }
View Full Code Here

    @Override
    public Type minimize(final Problem P, final EndCriteria endCriteria) {
        final EndCriteria.Type ecType = EndCriteria.Type.None;
        P.reset();
        final Array x_ = P.currentValue();
        // TODO: this is probably incorrect, check the consequences
        ProblemData.getProblemData().setProblem(P);
        ProblemData.getProblemData().setInitCostValues(P.costFunction().values(x_));

        final int m = ProblemData.getProblemData().initCostValues_.size();
        final int n = x_.size();

        final Array  xx = new Array();
        //TODO: correct?
        xx.addAssign(x_);

        final Array fvec;
        final Array diag;

        final int mode = 1;
        final double factor = 1;
        final int nprint = 0;
        final int info = 0;
        final int nfev = 0;

        final Array fjac = new Array();
        final int ldfjac = m;

        //TODO: to be completed....
        /*
        boost::scoped_array<int> ipvt(new int[n]);
View Full Code Here

    }

    @Override
    public void reset(final int size) {
        QL.require(method().equals(underlying.method()) , "option and underlying were initialized on different methods");
        values = new Array(size);
        adjustValues();
    }
View Full Code Here

TOP

Related Classes of org.jquantlib.math.matrixutilities.Array$Range

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.