Examples of toDoubleArray()


Examples of com.humaorie.dollar.ArrayWrapper.DoubleArrayWrapper.toDoubleArray()

    @Test
    public void unboxDoubleArray() {
        final Double[] boxed = {42.0};
        final double[] unboxed = {42};
        final DoubleArrayWrapper arrayWrapper = new DoubleArrayWrapper(boxed);
        Assert.assertArrayEquals(unboxed, arrayWrapper.toDoubleArray(), 0.1d);
    }

    @Test
    public void unboxDoubleArrayWithNullsLeadsToZero() {
        final Double[] boxed = {null};
View Full Code Here

Examples of com.humaorie.dollar.ArrayWrapper.FloatArrayWrapper.toDoubleArray()

    @Test
    public void unboxFloatArrayToDoubleArray() {
        final Float[] boxed = {42f};
        final double[] unboxed = {42};
        final FloatArrayWrapper arrayWrapper = new FloatArrayWrapper(boxed);
        Assert.assertArrayEquals(unboxed, arrayWrapper.toDoubleArray(), 0.1d);
    }

    @Test
    public void unboxFloatArrayWithNulls() {
        final Float[] boxed = {null};
View Full Code Here

Examples of com.humaorie.dollar.ArrayWrapper.IntegerArrayWrapper.toDoubleArray()

    public void unboxIntegerArrayToDoubleArray() {
        final Integer[] boxed = { 42 };
        final double[] unboxed = { 42.0 };
        final IntegerArrayWrapper arrayWrapper = new IntegerArrayWrapper(
                boxed);
        Assert.assertArrayEquals(unboxed, arrayWrapper.toDoubleArray(), 0.001);
    }

    @Test
    public void unboxLongArray() {
        final Long[] boxed = {null};
View Full Code Here

Examples of com.jacob.com.SafeArray.toDoubleArray()

    SafeArray da = new SafeArray(Variant.VariantDouble, 4);
    System.out.println("elem size:" + da.getElemSize());
    double dack[] = new double[] { 123.456, 456.123, 1234567.89, 12.3456789 };
    printArray(dack);
    da.fromDoubleArray(dack);
    dack = da.toDoubleArray();
    printArray(dack);

    double d4[] = new double[4];
    da.getDoubles(0, 4, d4, 0);
    printArray(d4);
View Full Code Here

Examples of com.jacob.com.SafeArray.toDoubleArray()

    da.getDoubles(0, 4, d4, 0);
    printArray(d4);

    SafeArray da2 = new SafeArray(Variant.VariantDouble, 4);
    da2.setDoubles(0, 4, d4, 0);
    dack = da2.toDoubleArray();
    printArray(dack);

    // float
    System.out.println("Float");
    SafeArray fa = new SafeArray(Variant.VariantFloat, 4);
View Full Code Here

Examples of com.jacob.com.SafeArray.toDoubleArray()

    int[] extractedFromSafeArrayInt = saUnderTest.toIntArray();
    for (int i = 0; i < extractedFromSafeArray.length; i++) {
      assertEquals("" + i, sourceData[i], extractedFromSafeArrayInt[i]);
    }
    // test conversion
    double[] extractedFromSafeArrayDouble = saUnderTest.toDoubleArray();
    for (int i = 0; i < extractedFromSafeArrayDouble.length; i++) {
      assertEquals("" + i, new Double(sourceData[i]).doubleValue(),
          extractedFromSafeArrayDouble[i]);
    }
    // test conversion
View Full Code Here

Examples of com.jacob.com.SafeArray.toDoubleArray()

   */
  public void testDoubleSafeArray() {
    double sourceData[] = new double[] { 1.5, 2.5, 3.5 };
    SafeArray saUnderTest = new SafeArray(Variant.VariantVariant, 3);
    saUnderTest.fromDoubleArray(sourceData);
    double[] extractedFromSafeArray = saUnderTest.toDoubleArray();
    for (int i = 0; i < extractedFromSafeArray.length; i++) {
      assertEquals("" + i, sourceData[i], extractedFromSafeArray[i]);
    }
    assertEquals("single get failed: ", sourceData[2], saUnderTest
        .getDouble(2));
View Full Code Here

Examples of it.unimi.dsi.fastutil.doubles.DoubleAVLTreeSet.toDoubleArray()

    for (int loopcpn = 0; loopcpn < CMS_CAP_SPREAD.getUnderlyingSwap2().getSecondLeg().getNumberOfPayments(); loopcpn++) {
      final CouponIbor cpn = (CouponIbor) CMS_CAP_SPREAD.getUnderlyingSwap2().getSecondLeg().getNthPayment(loopcpn);
      forwardTime.add(cpn.getFixingPeriodStartTime());
      forwardTime.add(cpn.getFixingPeriodEndTime());
    }
    final double[] nodeTimesForward = forwardTime.toDoubleArray();
    final double[] sensiForwardMethod = SensitivityFiniteDifference.curveSensitivity(capBumpedForward, SABR_BUNDLE, FORWARD_CURVE_NAME, bumpedCurveName, nodeTimesForward, deltaShift,
        METHOD_CMS_SPREAD);
    final List<DoublesPair> sensiPvForward = pvcsCap.getSensitivities().get(FORWARD_CURVE_NAME);
    for (int loopnode = 0; loopnode < sensiForwardMethod.length; loopnode++) {
      final DoublesPair pairPv = sensiPvForward.get(loopnode);
View Full Code Here

Examples of it.unimi.dsi.fastutil.doubles.DoubleAVLTreeSet.toDoubleArray()

    }
    for (int loopcpn = 0; loopcpn < CMS_CAP_SPREAD.getUnderlyingSwap2().getSecondLeg().getNumberOfPayments(); loopcpn++) {
      final CouponIbor cpn = (CouponIbor) CMS_CAP_SPREAD.getUnderlyingSwap2().getSecondLeg().getNthPayment(loopcpn);
      discTime.add(cpn.getPaymentTime());
    }
    final double[] nodeTimesDisc = discTime.toDoubleArray();
    final double[] sensiDiscMethod = SensitivityFiniteDifference.curveSensitivity(capBumpedDisc, SABR_BUNDLE, FUNDING_CURVE_NAME, bumpedCurveName, nodeTimesDisc, deltaShift, METHOD_CMS_SPREAD);
    final List<DoublesPair> sensiPvDisc = pvcsCap.getSensitivities().get(FUNDING_CURVE_NAME);
    for (int loopnode = 0; loopnode < sensiDiscMethod.length; loopnode++) {
      final DoublesPair pairPv = sensiPvDisc.get(loopnode);
      assertEquals("Sensitivity CMS cap/floor pv to forward curve: Node " + loopnode, nodeTimesDisc[loopnode], pairPv.getFirst(), 1E-8);
View Full Code Here

Examples of it.unimi.dsi.fastutil.doubles.DoubleAVLTreeSet.toDoubleArray()

    for (int loopcpn = 0; loopcpn < CMS_CAP_SPREAD.getUnderlyingSwap2().getSecondLeg().getNumberOfPayments(); loopcpn++) {
      final CouponIbor cpn = (CouponIbor) CMS_CAP_SPREAD.getUnderlyingSwap2().getSecondLeg().getNthPayment(loopcpn);
      forwardTime.add(cpn.getFixingPeriodStartTime());
      forwardTime.add(cpn.getFixingPeriodEndTime());
    }
    final double[] nodeTimesForward = forwardTime.toDoubleArray();
    final double[] sensiForwardMethod = SensitivityFiniteDifference.curveSensitivity(capBumpedForward, SABR_BUNDLE, FORWARD_CURVE_NAME, bumpedCurveName, nodeTimesForward, deltaShift,
        METHOD_CMS_SPREAD_EXTRAPOLATION);
    final List<DoublesPair> sensiPvForward = pvcsCap.getSensitivities().get(FORWARD_CURVE_NAME);
    for (int loopnode = 0; loopnode < sensiForwardMethod.length; loopnode++) {
      final DoublesPair pairPv = sensiPvForward.get(loopnode);
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.