Package hec.hecmath
Class DoubleArrayUtilities
java.lang.Object
hec.hecmath.DoubleArrayUtilities
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
arrayFunctionalFill
(DoubleUnaryOperator function, double[] dataArray, double[] arrayToFill) fills array with function and supporting data arraystatic void
arrayTransform
(DoubleUnaryOperator function, double[] array) transforms array with functionstatic int
binarySearch
(double xValue, double[] xArray) returns the index of xValue in xArray, or the first bounding index data expected to be monotonicstatic double[]
copyArray
(double[] array) static double[][]
copyArray
(double[][] array) static boolean
enforceMontonicallyDecreasing
(double[] array, int middleIndex) static void
enforceMontonicallyIncreasing
(double[] array, int middleIndex) static Double
linear interpolation.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.static double[]
linearInterpolationFill
(int numOrdinates, double first, double last) fill array with
-
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
linear interpolation. Also supports extrapolation- Parameters:
x
-x1
-y1
-x2
-y2
-- Returns:
-
arrayTransform
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)
-