Package org.epics.util.array
Class ListMath
- java.lang.Object
-
- org.epics.util.array.ListMath
-
public class ListMath extends Object
Math operations defined on lists of numbers.- Author:
- carcassi, Mark Davis (NSCL/FRIB)
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ListDoubleadd(ListNumber data, double offset)Returns a new list where all elements are added to a constant.static ListDoubleadd(ListNumber data1, ListNumber data2)Returns a list where each element is the sum of the elements of the two lists at the same index.static List<ListNumber>dft(ListNumber x, ListNumber y)XXX: This is just a prototypestatic ListDoubledivide(ListNumber data1, ListNumber data2)Returns a list where each element is the division of the elements of the two lists at the same index.static ListDoubleinverseRescale(ListNumber data, double numerator, double offset)Performs a linear transformation on inverse value of each number in a list.static ListDoublemultiply(ListNumber data1, ListNumber data2)Returns a list where each element is the product of the elements of the two lists at the same index.static ListDoublepow(double base, ListNumber expons)Raises a value to the power of each value in a list.static ListDoublepow(ListNumber data, double expon)Raises each value in a list to the same power.static ListDoublerescale(ListNumber data, double factor, double offset)Performs a linear transformation on the data.static ListDoublesubtract(ListNumber data1, ListNumber data2)Returns a list where each element is the difference of the elements of the two lists at the same index.
-
-
-
Method Detail
-
rescale
public static ListDouble rescale(ListNumber data, double factor, double offset)
Performs a linear transformation on the data.- Parameters:
data- A list of numbersfactor- The multiplicative constantoffset- The additive constant- Returns:
- result[x] = data[x] * factor + offset
-
inverseRescale
public static ListDouble inverseRescale(ListNumber data, double numerator, double offset)
Performs a linear transformation on inverse value of each number in a list.- Parameters:
data- The list of numbers to divide the numerator bynumerator- The numerator for each divisionoffset- The additive constant- Returns:
- result[x] = numerator / data[x] + offset
-
pow
public static ListDouble pow(ListNumber data, double expon)
Raises each value in a list to the same power.- Parameters:
data- The list of numbers to raise to a powerexpon- The power to raise each number in the list to- Returns:
- result[x] = data[x] ** expon
-
pow
public static ListDouble pow(double base, ListNumber expons)
Raises a value to the power of each value in a list.- Parameters:
base- The value to raise to each powerexpons- The list of exponents to raise the base value to- Returns:
- result[x] = base ** expons[x]
-
add
public static ListDouble add(ListNumber data, double offset)
Returns a new list where all elements are added to a constant.- Parameters:
data- a list of numberoffset- the additive constant- Returns:
- result[x] = data[x] + offset
-
add
public static ListDouble add(ListNumber data1, ListNumber data2)
Returns a list where each element is the sum of the elements of the two lists at the same index. The lists have to match in size.- Parameters:
data1- a list of numbersdata2- another list of numbers- Returns:
- result[x] = data1[x] + data2[x]
-
subtract
public static ListDouble subtract(ListNumber data1, ListNumber data2)
Returns a list where each element is the difference of the elements of the two lists at the same index. The lists have to match in size.- Parameters:
data1- a list of numbersdata2- another list of numbers- Returns:
- result[x] = data1[x] - data2[x]
-
multiply
public static ListDouble multiply(ListNumber data1, ListNumber data2)
Returns a list where each element is the product of the elements of the two lists at the same index. The lists have to match in size.- Parameters:
data1- a list of numbersdata2- another list of numbers- Returns:
- result[x] = data1[x] * data2[x]
-
divide
public static ListDouble divide(ListNumber data1, ListNumber data2)
Returns a list where each element is the division of the elements of the two lists at the same index. The lists have to match in size.- Parameters:
data1- a list of numbersdata2- another list of numbers- Returns:
- result[x] = data1[x] / data2[x]
-
dft
public static List<ListNumber> dft(ListNumber x, ListNumber y)
XXX: This is just a prototype- Parameters:
x- real party- imaginary part- Returns:
- the real and imaginary part of the transform
-
-