Package it.unimi.dsi.fastutil.doubles

Examples of it.unimi.dsi.fastutil.doubles.DoubleArrayList


    }

    @Test
    public void testAddMany() {
        Random rng = new Random();
        DoubleList vals = new DoubleArrayList(25);
        for (int i = 0; i < 25; i++) {
            double v = rng.nextGaussian() + Math.PI;
            builder.add(i, v);
            vals.add(v);
        }
        assertThat(builder.size(), equalTo(25));
        PackedScoredIdList list = builder.build();
        assertThat(list, hasSize(25));
        for (int i = 0; i < 25; i++) {
            ScoredId id = new ScoredIdBuilder(i, vals.getDouble(i)).build();
            assertThat(list.get(i), equalTo(id));
        }
    }
View Full Code Here


                        DoubleList errors) {
        feature = f;
        userAverage = uavg;
        itemAverage = iavg;
        singularValue = sval;
        trainingErrors = new DoubleArrayList(errors);
    }
View Full Code Here

  }

  @Override
  public void initialize(int capacity) {
    neighbors = new LongArrayList(capacity);
    edgeValues = new DoubleArrayList(capacity);
  }
View Full Code Here

  }

  @Override
  public void initialize() {
    neighbors = new LongArrayList();
    edgeValues = new DoubleArrayList();
  }
View Full Code Here

    /**
     * Constructor
     * @param capacity Capacity
     */
    public BasicDoubleArrayList(int capacity) {
      list = new DoubleArrayList(capacity);
    }
View Full Code Here

  }

  @Override
  protected List<?> buildPrimitiveList(int capacity) {
    _type = Double.class;
    return capacity > 0 ? new DoubleArrayList(capacity) : new DoubleArrayList();
  }
View Full Code Here

    final double strike = option.getStrike();
    final double forward = forwardCurve.getForward(expiry);
    final double[] moneynesses = grid.getSpaceNodes();
    final double[] modifiedPrices = pdeGrid.getTerminalResults();
    final int n = modifiedPrices.length;
    final DoubleArrayList strikes = new DoubleArrayList();
    final DoubleArrayList prices = new DoubleArrayList();
    for (int i = 0; i < n; i++) {
      try {
        final double impliedVol = BlackFormulaRepository.impliedVolatility(modifiedPrices[i], 1, moneynesses[i], expiry, isCall);
        prices.add(BlackFormulaRepository.price(forward, strike, expiry, impliedVol, isCall));
        strikes.add(forward * moneynesses[i]);
      } catch (final Exception e) {
      }
    }
    return _interpolator.getDataBundleFromSortedArrays(strikes.toDoubleArray(), prices.toDoubleArray());
  }
View Full Code Here

    return this.getPriceIndex(secondTime) / this.getPriceIndex(firstTime) - 1.0;
  }

  @Override
  public double[] getPriceIndexParameterSensitivity(final double time) {
    final DoubleArrayList result = new DoubleArrayList();
    double[] temp;
    temp = _curves[0].getPriceIndexParameterSensitivity(time);
    for (final double element : temp) {
      result.add(element);
    }
    for (int loopcurve = 1; loopcurve < _curves.length; loopcurve++) {
      temp = _curves[loopcurve].getPriceIndexParameterSensitivity(time);
      for (final double element : temp) {
        result.add(element);
      }
    }
    return result.toDoubleArray();
  }
View Full Code Here

        startCleanParameter[nbSensitivityCurve] = nbCleanParameters;
        nbCleanParameters += nbNewParamSensiCurve[nbSensitivityCurve];
        nbSensitivityCurve++;
      }
    }
    final DoubleArrayList sensiDirtyList = new DoubleArrayList();
    for (final String name : curveNamesSet) { // loop over all curves (by name)
      if (!fixedCurves.contains(name)) {
        final YieldAndDiscountCurve curve = bundle.getCurve(name);
        final List<Double> oneCurveSensitivity = pointToParameterSensitivity(sensitivity.getSensitivities().get(name), curve);
        sensiDirtyList.addAll(oneCurveSensitivity);
      }
    }
    final double[] sensiDirty = sensiDirtyList.toDoubleArray();
    final double[] sensiClean = new double[nbCleanParameters];
    for (int loopcurve = 0; loopcurve < nbSensiCurve; loopcurve++) {
      for (int loopo = 0; loopo < indexOtherSensiCurve[loopcurve].length; loopo++) {
        if (!fixedCurves.contains(curveNamesArray[indexOtherSensiCurve[loopcurve][loopo]])) {
          for (int loops = 0; loops < nbNewParamSensiCurve[indexOtherSensiCurve[loopcurve][loopo]]; loops++) {
View Full Code Here

        // startCleanParameter[loopname] = nbCleanParameters;
        //nbCleanParameters += nbNewParamSensiCurve[loopname];
        loopname++;
      }
    }
    final DoubleArrayList sensiDirtyList = new DoubleArrayList();
    for (final String name : curveNamesSet) { // loop over all curves (by name)
      if (!fixedCurves.contains(name)) {
        final YieldAndDiscountCurve curve = bundle.getCurve(name);
        final Double[] oneCurveSensitivity = pointToParameterSensitivity(sensitivity.getSensitivities().get(name), curve);
        sensiDirtyList.addAll(Arrays.asList(oneCurveSensitivity));
      }
    }
    final double[] sensiDirty = sensiDirtyList.toDoubleArray();
    final double[][] sensiClean = new double[nbSensitivityCurve][];
    for (int loopcurve = 0; loopcurve < nbSensitivityCurve; loopcurve++) {
      sensiClean[loopcurve] = new double[nbNewParamSensiCurve[loopcurve]];
    }
    for (int loopcurve = 0; loopcurve < nbSensitivityCurve; loopcurve++) {
View Full Code Here

TOP

Related Classes of it.unimi.dsi.fastutil.doubles.DoubleArrayList

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.