Package it.unimi.dsi.fastutil.doubles

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


    ArgumentChecker.isTrue(startTime < endTime, "Start time {} must be before end time {}", startTime, endTime);
    final int n = allTimes.length;
    if (n == 0) {
      return new double[] {startTime, endTime };
    }
    final DoubleLinkedOpenHashSet truncated = new DoubleLinkedOpenHashSet(n + 2, 1);
    for (final Double time : allTimes) {
      if (time > startTime && time < endTime) {
        truncated.add(time);
      }
    }
    final int truncatedSize = truncated.size();
    if (truncatedSize == 0) {
      return new double[] {startTime, endTime };
    }
    final double[] truncatedArray = truncated.toDoubleArray();
    if (!sorted) {
      Arrays.sort(truncatedArray);
    }
    if (CompareUtils.closeEquals(truncatedArray[0], startTime, tolerance)) {
      if (CompareUtils.closeEquals(truncatedArray[truncatedSize - 1], endTime, tolerance)) {
View Full Code Here


public class BlackVolatilitySurfaceUtils {
  private static final Logger s_logger = LoggerFactory.getLogger(BlackVolatilitySurfaceUtils.class);

  public static double[] getUniqueExpiries(final VolatilitySurfaceData<Object, Object> volatilitySurface) {
    final double[] expiries = getArrayOfDoubles(volatilitySurface.getXs());
    final DoubleLinkedOpenHashSet expirySet = new DoubleLinkedOpenHashSet(expiries);
    final double[] uniqueExpiries = expirySet.toDoubleArray();
    Arrays.sort(uniqueExpiries);
    return uniqueExpiries;
  }
View Full Code Here

    return uniqueXValues.toArray(new Object[uniqueXValues.size()]);
  }

  public static double[] getUniqueStrikes(final VolatilitySurfaceData<Object, Object> volatilitySurface) {
    final double[] strikes = getArrayOfDoubles(volatilitySurface.getYs());
    final DoubleLinkedOpenHashSet strikeSet = new DoubleLinkedOpenHashSet(strikes);
    final double[] uniqueStrikes = strikeSet.toDoubleArray();
    Arrays.sort(uniqueStrikes);
    return uniqueStrikes;
  }
View Full Code Here

TOP

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

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.