Package org.yamcs.studio.data.vtype
Class ListMath
java.lang.Object
org.yamcs.studio.data.vtype.ListMath
Math operations defined on lists of numbers.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ListDouble
add
(ListNumber data, double offset) Returns a new list where all elements are added to a constant.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.static List<ListNumber>
dft
(ListNumber x, ListNumber y) XXX: This is just a prototypestatic 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.static ListDouble
inverseRescale
(ListNumber data, double numerator, double offset) Performs a linear transformation on inverse value of each number in a list.static ListDouble
limit
(ListDouble data, int start, int end) Returns a sublist of the given data.static ListLong
Returns a sublist of the given data.static ListNumber
limit
(ListNumber data, int start, int end) Returns a sublist of the given data.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.static ListDouble
pow
(double base, ListNumber expons) Raises a value to the power of each value in a list.static ListDouble
pow
(ListNumber data, double expon) Raises each value in a list to the same power.static ListDouble
rescale
(ListNumber data, double factor, double offset) Performs a linear transformation on the data.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.
-
Method Details
-
limit
Returns a sublist of the given data.- Parameters:
data
- a liststart
- start point for the sublistend
- end point (exclusive) for the sublist- Returns:
- the sublist
-
limit
Returns a sublist of the given data.TODO: this should go as a member method
- Parameters:
data
- a liststart
- start point for the sublistend
- end point (exclusive) for the sublist- Returns:
- the sublist
-
limit
Returns a sublist of the given data.- Parameters:
data
- a liststart
- start point for the sublistend
- end point (exclusive) for the sublist- Returns:
- the sublist
-
rescale
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
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
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
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
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
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
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
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
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
XXX: This is just a prototype- Parameters:
x
- real party
- imaginary part- Returns:
- the real and imaginary part of the transform
-