org.jplot2d.util
Class NumberArrayUtils
- java.lang.Object
-
- org.jplot2d.util.NumberArrayUtils
-
public class NumberArrayUtils extends java.lang.ObjectThis utilities offer some high performance routine for number array. Saving loop can improve performance especially when the array is very large.
-
-
Constructor Summary
Constructors Constructor and Description NumberArrayUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static double[]arrayCopy(double[] array, int length)Copy an array into a new array with the given length.static int[]arrayCopy(int[] array, int length)Copy an array into a new array with the given length.static java.lang.Objectclone(java.lang.Object a)static double[]copyAppend(double[] array, double[] append)static booleanequals(java.lang.Object a, java.lang.Object b)static int[]getIdxesOfMinValue(double[] array)Returns the indexes of the min value of the given array.static int[]getIdxesOfValue(double[] array, double v)static int[]getIdxesOfValueBetween(ArrayPair xy, double xLo, double xHi, double yLo, double yHi)static double[]hypot(ArrayPair xy, double bx, double by)Returns the distance of the every point in ArrayPair to the base point given in bx and by.static double[]hypot(double[] x, double[] y)static doublemax(double[] array)Double.NaN is ignored.static doublemin(double[] array)Double.NaN is ignored.static double[]minMax(double[] array)Double.NaN is ignored.static double[]multiply(double[] v, double factor)static float[]multiply(float[] v, double factor)static double[]range(int n)static double[]reverse(double[] array)static long[]reverse(long[] array)static java.lang.ObjectsubArray(java.lang.Object array, int[] indexes)static java.lang.StringtoString(boolean[] array)static java.lang.StringtoString(byte[] array)static java.lang.StringtoString(double[] array)static java.lang.StringtoString(float[] array)static java.lang.StringtoString(int[] array)static java.lang.StringtoString(long[] array)static java.lang.StringtoString(java.lang.Object array)Returns a string comma delimited without brackets.static java.lang.StringtoString(short[] array)
-
-
-
Method Detail
-
range
public static double[] range(int n)
-
copyAppend
public static double[] copyAppend(double[] array, double[] append)
-
min
public static double min(double[] array)
Double.NaN is ignored. If the array contains only Double.NaN, returns Double.NaN- Parameters:
array-- Returns:
- the min value
-
max
public static double max(double[] array)
Double.NaN is ignored. If the array contains only Double.NaN, returns Double.NaN- Parameters:
array-- Returns:
- athe max value
-
minMax
public static double[] minMax(double[] array)
Double.NaN is ignored. If the array contains only Double.NaN, returns { Double.NaN, Double.NaN }.- Parameters:
array-- Returns:
- an array that contains min and max values
-
getIdxesOfValue
public static int[] getIdxesOfValue(double[] array, double v)- Parameters:
array-- Returns:
- the idx of min value.
-
getIdxesOfMinValue
public static int[] getIdxesOfMinValue(double[] array)
Returns the indexes of the min value of the given array. Double.NaN is ignored. If the array contains only Double.NaN, returns int[0].- Parameters:
array-- Returns:
- the indexes.
-
arrayCopy
public static int[] arrayCopy(int[] array, int length)Copy an array into a new array with the given length.- Parameters:
array-length-- Returns:
- a new array with the given length.
-
arrayCopy
public static double[] arrayCopy(double[] array, int length)Copy an array into a new array with the given length.- Parameters:
array-length-- Returns:
- a new array with the given length.
-
hypot
public static double[] hypot(double[] x, double[] y)
-
hypot
public static double[] hypot(ArrayPair xy, double bx, double by)
Returns the distance of the every point in ArrayPair to the base point given in bx and by.- Parameters:
xy-bx-by-- Returns:
-
multiply
public static double[] multiply(double[] v, double factor)
-
multiply
public static float[] multiply(float[] v, double factor)
-
getIdxesOfValueBetween
public static int[] getIdxesOfValueBetween(ArrayPair xy, double xLo, double xHi, double yLo, double yHi)
-
reverse
public static long[] reverse(long[] array)
-
reverse
public static double[] reverse(double[] array)
-
subArray
public static java.lang.Object subArray(java.lang.Object array, int[] indexes)
-
toString
public static java.lang.String toString(java.lang.Object array)
Returns a string comma delimited without brackets.- Parameters:
array-- Returns:
-
toString
public static java.lang.String toString(double[] array)
-
toString
public static java.lang.String toString(float[] array)
-
toString
public static java.lang.String toString(long[] array)
-
toString
public static java.lang.String toString(int[] array)
-
toString
public static java.lang.String toString(short[] array)
-
toString
public static java.lang.String toString(byte[] array)
-
toString
public static java.lang.String toString(boolean[] array)
-
equals
public static boolean equals(java.lang.Object a, java.lang.Object b)
-
clone
public static java.lang.Object clone(java.lang.Object a)
-
-
DMelt 3.0 © DataMelt by jWork.ORG