Package hec.hecmath

Class DoubleArrayUtilities

java.lang.Object
hec.hecmath.DoubleArrayUtilities

public final class DoubleArrayUtilities extends Object
  • Method Details

    • interpolatePairedArrays

      public static double interpolatePairedArrays(double xValue, double[] xArray, double[] yArray)
      interpolates the value in the yArray, based on the location of xValue in the xArray linearly xArray be either monotonically increasing or decreasing.
      Parameters:
      xValue -
      xArray -
      yArray -
      Returns:
    • binarySearch

      public static int binarySearch(double xValue, double[] xArray)
      returns the index of xValue in xArray, or the first bounding index data expected to be monotonic
      Parameters:
      xValue -
      xArray -
      Returns:
    • enforceMontonicallyDecreasing

      public static boolean enforceMontonicallyDecreasing(double[] array, int middleIndex)
    • enforceMontonicallyIncreasing

      public static void enforceMontonicallyIncreasing(double[] array, int middleIndex)
    • linearInterpolationFill

      public static double[] linearInterpolationFill(int numOrdinates, double first, double last)
      fill array with
    • interpolate

      public static Double interpolate(Double x, Double x1, Double y1, Double x2, Double y2)
      linear interpolation. Also supports extrapolation
      Parameters:
      x -
      x1 -
      y1 -
      x2 -
      y2 -
      Returns:
    • arrayTransform

      public static void arrayTransform(DoubleUnaryOperator function, double[] array)
      transforms array with function
      Parameters:
      function -
      array -
    • arrayFunctionalFill

      public static void arrayFunctionalFill(DoubleUnaryOperator function, double[] dataArray, double[] arrayToFill)
      fills array with function and supporting data array
      Parameters:
      function -
      dataArray -
      arrayToFill -
    • copyArray

      public static double[][] copyArray(double[][] array)
    • copyArray

      public static double[] copyArray(double[] array)