本文整理汇总了Java中it.unimi.dsi.fastutil.doubles.DoubleArrayList.get方法的典型用法代码示例。如果您正苦于以下问题:Java DoubleArrayList.get方法的具体用法?Java DoubleArrayList.get怎么用?Java DoubleArrayList.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.unimi.dsi.fastutil.doubles.DoubleArrayList
的用法示例。
在下文中一共展示了DoubleArrayList.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGenerator
import it.unimi.dsi.fastutil.doubles.DoubleArrayList; //导入方法依赖的package包/类
@Override
protected GeneratorYDCurve getGenerator(final CurveDefinition definition, final LocalDate valuationDate) {
if (definition instanceof InterpolatedCurveDefinition) {
final InterpolatedCurveDefinition interpolatedDefinition = (InterpolatedCurveDefinition) definition;
final String interpolatorName = interpolatedDefinition.getInterpolatorName();
final String leftExtrapolatorName = interpolatedDefinition.getLeftExtrapolatorName();
final String rightExtrapolatorName = interpolatedDefinition.getRightExtrapolatorName();
final Interpolator1D interpolator = CombinedInterpolatorExtrapolatorFactory.getInterpolator(interpolatorName, leftExtrapolatorName, rightExtrapolatorName);
if (definition instanceof FixedDateInterpolatedCurveDefinition) {
final FixedDateInterpolatedCurveDefinition fixedDateDefinition = (FixedDateInterpolatedCurveDefinition) definition;
final List<LocalDate> fixedDates = fixedDateDefinition.getFixedDates();
final DoubleArrayList nodePoints = new DoubleArrayList(fixedDates.size()); //TODO what about equal node points?
for (final LocalDate fixedDate : fixedDates) {
nodePoints.add(TimeCalculator.getTimeBetween(valuationDate, fixedDate)); //TODO what to do if the fixed date is before the valuation date?
}
final double anchor = nodePoints.get(0); //TODO should the anchor go into the definition?
return new GeneratorCurveYieldInterpolatedAnchorNode(nodePoints.toDoubleArray(), anchor, interpolator);
}
return new GeneratorCurveYieldInterpolated(getMaturityCalculator(), interpolator);
}
throw new OpenGammaRuntimeException("Cannot handle curves of type " + definition.getClass());
}
示例2: getGenerator
import it.unimi.dsi.fastutil.doubles.DoubleArrayList; //导入方法依赖的package包/类
private GeneratorYDCurve getGenerator(final AbstractCurveDefinition definition, LocalDate valuationDate) {
if (definition instanceof InterpolatedCurveDefinition) {
final InterpolatedCurveDefinition interpolatedDefinition = (InterpolatedCurveDefinition) definition;
final String interpolatorName = interpolatedDefinition.getInterpolatorName();
final String leftExtrapolatorName = interpolatedDefinition.getLeftExtrapolatorName();
final String rightExtrapolatorName = interpolatedDefinition.getRightExtrapolatorName();
final Interpolator1D interpolator = CombinedInterpolatorExtrapolatorFactory.getInterpolator(interpolatorName,
leftExtrapolatorName,
rightExtrapolatorName);
if (definition instanceof FixedDateInterpolatedCurveDefinition) {
final FixedDateInterpolatedCurveDefinition fixedDateDefinition = (FixedDateInterpolatedCurveDefinition) definition;
final List<LocalDate> fixedDates = fixedDateDefinition.getFixedDates();
final DoubleArrayList nodePoints = new DoubleArrayList(fixedDates.size()); //TODO what about equal node points?
for (final LocalDate fixedDate : fixedDates) {
nodePoints.add(TimeCalculator.getTimeBetween(valuationDate, fixedDate)); //TODO what to do if the fixed date is before the valuation date?
}
final double anchor = nodePoints.get(0); //TODO should the anchor go into the definition?
return new GeneratorCurveYieldInterpolatedAnchorNode(nodePoints.toDoubleArray(), anchor, interpolator);
}
return new GeneratorCurveYieldInterpolated(LastTimeCalculator.getInstance(), interpolator);
}
throw new OpenGammaRuntimeException("Cannot handle curves of type " + definition.getClass());
}
示例3: getGenerator
import it.unimi.dsi.fastutil.doubles.DoubleArrayList; //导入方法依赖的package包/类
private GeneratorYDCurve getGenerator(final AbstractCurveDefinition definition, LocalDate valuationDate) {
if (definition instanceof InterpolatedCurveDefinition) {
InterpolatedCurveDefinition interpolatedDefinition = (InterpolatedCurveDefinition) definition;
String interpolatorName = interpolatedDefinition.getInterpolatorName();
String leftExtrapolatorName = interpolatedDefinition.getLeftExtrapolatorName();
String rightExtrapolatorName = interpolatedDefinition.getRightExtrapolatorName();
Interpolator1D interpolator = CombinedInterpolatorExtrapolatorFactory.getInterpolator(interpolatorName,
leftExtrapolatorName,
rightExtrapolatorName);
if (definition instanceof FixedDateInterpolatedCurveDefinition) {
FixedDateInterpolatedCurveDefinition fixedDateDefinition = (FixedDateInterpolatedCurveDefinition) definition;
List<LocalDate> fixedDates = fixedDateDefinition.getFixedDates();
DoubleArrayList nodePoints = new DoubleArrayList(fixedDates.size()); //TODO what about equal node points?
for (final LocalDate fixedDate : fixedDates) {
//TODO what to do if the fixed date is before the valuation date?
nodePoints.add(TimeCalculator.getTimeBetween(valuationDate, fixedDate));
}
final double anchor = nodePoints.get(0); //TODO should the anchor go into the definition?
return new GeneratorCurveYieldInterpolatedAnchorNode(nodePoints.toDoubleArray(), anchor, interpolator);
}
return new GeneratorCurveYieldInterpolated(LastTimeCalculator.getInstance(), interpolator);
}
throw new OpenGammaRuntimeException("Cannot handle curves of type " + definition.getClass());
}
示例4: createCurveGenerator
import it.unimi.dsi.fastutil.doubles.DoubleArrayList; //导入方法依赖的package包/类
/**
* Creates a curve generator for a curve definition and valuation date.
*
* @param definition the curve definition
* @param valuationDate the valuation date
* @return a generator capable of generating the curve
*/
private GeneratorYDCurve createCurveGenerator(AbstractCurveDefinition definition, LocalDate valuationDate) {
if (definition instanceof InterpolatedCurveDefinition) {
InterpolatedCurveDefinition interpolatedDefinition = (InterpolatedCurveDefinition) definition;
Interpolator1D interpolator =
CombinedInterpolatorExtrapolatorFactory.getInterpolator(interpolatedDefinition.getInterpolatorName(),
interpolatedDefinition.getLeftExtrapolatorName(),
interpolatedDefinition.getRightExtrapolatorName());
if (definition instanceof FixedDateInterpolatedCurveDefinition) {
FixedDateInterpolatedCurveDefinition fixedDateDefinition = (FixedDateInterpolatedCurveDefinition) definition;
List<LocalDate> fixedDates = fixedDateDefinition.getFixedDates();
DoubleArrayList nodePoints = new DoubleArrayList(fixedDates.size()); //TODO what about equal node points?
for (LocalDate fixedDate : fixedDates) {
nodePoints.add(TimeCalculator.getTimeBetween(valuationDate, fixedDate)); //TODO what to do if the fixed date is before the valuation date?
}
double anchor = nodePoints.get(0); //TODO should the anchor go into the definition?
return new GeneratorCurveYieldInterpolatedAnchorNode(nodePoints.toDoubleArray(), anchor, interpolator);
}
return new GeneratorCurveYieldInterpolated(LastTimeCalculator.getInstance(), interpolator);
}
throw new OpenGammaRuntimeException("Cannot handle curves of type " + definition.getClass());
}
示例5: getValueOnQuantile
import it.unimi.dsi.fastutil.doubles.DoubleArrayList; //导入方法依赖的package包/类
/**
* List will be sorted after passing to this function,
* so a pre-sorting is not needed.
*
* @param list
* @param quantile
* @return
*/
public static double getValueOnQuantile(DoubleArrayList list, double quantile) {
checkArgument(quantile >= 0 && quantile <= 1, "quantile must be in range [0, 1]");
Collections.sort(list, new Comparator<Double>() {
@Override
public int compare(Double o1, Double o2) {
return o1.compareTo(o2);
}
});
int index = (int) (list.size()*quantile);
return list.get(index);
}
示例6: extractFinalResult
import it.unimi.dsi.fastutil.doubles.DoubleArrayList; //导入方法依赖的package包/类
@Nonnull
@Override
public Double extractFinalResult(@Nonnull DoubleArrayList intermediateResult) {
int size = intermediateResult.size();
if (size == 0) {
return DEFAULT_FINAL_RESULT;
} else {
Collections.sort(intermediateResult);
return intermediateResult.get((int) ((long) intermediateResult.size() * _percentile / 100));
}
}