Examples of Array


Examples of org.jquantlib.math.matrixutilities.Array

        fixingDays_ = fixingDays;
        return this;
    }

    public IborLeg withGearings(/* @Real */final double gearing) {
        gearings_ = new Array(new double[] { gearing });
        return this;
    }
View Full Code Here

Examples of org.jquantlib.math.matrixutilities.Array

        gearings_ = gearings;
        return this;
    }

    public IborLeg withSpreads(/* @Spread */final double spread) {
        spreads_ = new Array(new double[] { spread });
        return this;
    }
View Full Code Here

Examples of org.jquantlib.math.matrixutilities.Array

        spreads_ = spreads;
        return this;
    }

    public IborLeg withCaps(/* @Rate */final double cap) {
        caps_ = new Array(1).fill(cap);
        return this;
    }
View Full Code Here

Examples of org.jquantlib.math.matrixutilities.Array

        caps_ = caps;
        return this;
    }

    public IborLeg withFloors(/* @Rate */final double floor) {
        floors_ = new Array(1).fill(floor);
        return this;
    }
View Full Code Here

Examples of org.jquantlib.math.matrixutilities.Array

            times[i] = dc.yearFraction (dates[0], dates[i]);
            QL.require(Closeness.isClose(times[i],times[i-1]),
            "two dates correspond to the same time under this curve's day count convention"); // TODO: message
        }

        this.interpolation = interpolator.interpolate(new Array(times), new Array(data));
        this.interpolation.update();
    }
View Full Code Here

Examples of org.jquantlib.math.matrixutilities.Array

        @Override
        public Array values(final Array x) {
            if (x.size() != 1)
                throw new IllegalArgumentException("Independent variable must be 1 dimensional");
            final Array y = new Array(1);
            y.set(0, value(x));
            return y;
        }
View Full Code Here

Examples of org.jquantlib.math.matrixutilities.Array

        // Let's enforce the assumption for the time being
        // (even though I'm not sure that I agree.)
        QL.require(end > 0.0 , "negative times not allowed"); // QA:[RG]::verified // FIXME: message

        /*@Time*/ final double dt = end/steps;
        this.times = new Array(steps+1);
        for (int i=0; i<=steps; i++) {
            times.set(i, dt*i);
        }
        this.mandatoryTimes = new Array(1).fill(end);
        this.dt = new Array(steps).fill(dt);
    }
View Full Code Here

Examples of org.jquantlib.math.matrixutilities.Array

                unique.add(curr);
            }
            prev = curr;
        }

        this.times = new Array(unique.size());
        int i=0;
        for (final double d : Iterables.unmodifiableIterable(unique.iterator())) {
            this.times.set(i, d);
            i++;
        }
View Full Code Here

Examples of org.jquantlib.math.matrixutilities.Array

    @Test
    public void testSplineOnGenericValues() {

        QL.info("Testing spline interpolation on generic values...");

        final Array generic_x = new Array(new double[]{ 0.0, 1.0, 3.0, 4.0 });
        final Array generic_y = new Array(new double[]{ 0.0, 0.0, 2.0, 2.0 });
        final Array generic_natural_y2 = new Array(new double[]{ 0.0, 1.5, -1.5, 0.0 });

        double interpolated, error;
        final int n = generic_x.size();
        final double[] x35 = new double[3];

        // Natural spline
        CubicInterpolation f = new CubicInterpolation(
                generic_x, generic_y,
                CubicInterpolation.DerivativeApprox.Spline, false,
                CubicInterpolation.BoundaryCondition.SecondDerivative, generic_natural_y2.first(),
                CubicInterpolation.BoundaryCondition.SecondDerivative, generic_natural_y2.last());
        f.update();

        checkValues("Natural spline", f, generic_x, generic_y);
        // cached second derivative
        for (int i=0; i<n; i++) {
            interpolated = f.secondDerivative(generic_x.get(i));
            error = interpolated - generic_natural_y2.get(i);
            assertFalse("Natural spline interpolation "
                  +"second derivative failed at x="+generic_x.get(i)
                  +"\n interpolated value: "+interpolated
                  +"\n expected value:     "+generic_natural_y2.get(i)
                  +"\n error:              "+error,
                  abs(error) > 3e-16);
        }
        x35[1] = f.op(3.5);
View Full Code Here

Examples of org.jquantlib.math.matrixutilities.Array

        QL.info("Testing symmetry of spline interpolation end-conditions...");

        final int n = 9;

        final Array x = xRange(-1.8, 1.8, n);
        final Array y = gaussian(x);

        // Not-a-knot spline
        CubicInterpolation f = new CubicInterpolation(
                x, y,
                CubicInterpolation.DerivativeApprox.Spline, false,
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.