|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mbari.util.MathUtil
Static methods for doing useful math
The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement. This information should not be published or distributed to third parties without specific written permission from MBARI.
| Constructor Summary | |
MathUtil()
|
|
| Method Summary | |
static int |
binarySearch(double[] a,
double key)
Searches the specified array of doubles for the specified value using the binary search algorithm. |
static double[] |
cumSum(double[] n)
Cumulatively sum a vector Example: cumSum([1 1 1 1 2]) = [1 2 3 4 6] |
static int |
find(double[] array,
double valueToFind)
|
static double |
fix(double x)
|
static double[] |
interpLinear(double[] x,
double[] y,
double[] xi)
|
static double[] |
interpLinear(long[] x,
double[] y,
long[] xi)
|
static boolean |
isEven(double x)
|
static double |
mod(double x,
double y)
|
static int |
near(double[] values,
double key)
Find the index of the value nearest to the key. |
static double[] |
orderVector(double[] values,
int[] order)
Useful method for ordering a 1-D array based on an array of indices |
static float[] |
orderVector(float[] values,
int[] order)
|
static long[] |
orderVector(long[] values,
int[] order)
|
static double |
rem(double x,
double y)
|
static int |
sign(double x)
|
static int[] |
uniqueSort(double[] x)
Returns an array of indices indicating the order the data should be sorted in. |
static int[] |
uniqueSort(long[] x)
Returns an array of indices indicating the order the data should be sorted in. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public MathUtil()
| Method Detail |
public static final double[] interpLinear(double[] x,
double[] y,
double[] xi)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static final double[] interpLinear(long[] x,
double[] y,
long[] xi)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static final int find(double[] array,
double valueToFind)
public static double mod(double x,
double y)
public static double rem(double x,
double y)
public static double fix(double x)
public static int sign(double x)
public static double[] cumSum(double[] n)
public static boolean isEven(double x)
public static final int[] uniqueSort(double[] x)
x - An array of data that is to be sorted.
public static final int[] uniqueSort(long[] x)
x - An array of data that is to be sorted.
public static final double[] orderVector(double[] values,
int[] order)
values - A 1-D array of data to be sorted based on an array of indicesorder - A 1-D array of indices specifying the ordering of the data.uniqueSort
public static final float[] orderVector(float[] values,
int[] order)
public static final long[] orderVector(long[] values,
int[] order)
public static final int near(double[] values,
double key)
values - Values to search through for the nearest point.key - The key to search for the nearest neighbor in values.
public static int binarySearch(double[] a,
double key)
a - the array to be searched.key - the value to be searched for.
#sort(double[])
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||