Class CompareRing
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Ring<T>>
intargmaxAbs(T... values) Computes the index of the maximum absolute value in the specified array.static <T extends Ring<T>>
intargminAbs(T... values) Computes the index of the minimum absolute value in the specified array.static <T extends Ring<T>>
doublemaxAbs(T... values) Computes the maximum absolute value in the specified array.static <T extends Ring<T>>
doublemaxAbs(T[] src, int start, int n, int stride) Returns the maximum absolute value amongnelements in the arraysrc, starting at indexstartand advancing bystridefor each subsequent element.static <T extends Ring<T>>
doubleminAbs(T... values) Computes the minimum absolute value in the specified array.static <T extends Ring<T>>
doubleminAbs(T[] src, int start, int n, int stride) Returns the minimum absolute value amongnelements in the arraysrc, starting at indexstartand advancing bystridefor each subsequent element.
-
Method Details
-
maxAbs
Computes the maximum absolute value in the specified array. This is done according to the ordering imposed byDouble.compareTo(x.mag(), y.mag())where x and y are elements ofvalues.- Parameters:
values- Values to commute maximum of.- Returns:
- The maximum value in
values. Ifvalues.lengthequals zero, thenDouble.NaNis returned.
-
minAbs
Computes the minimum absolute value in the specified array. This is done according to the ordering imposed byDouble.compareTo(x.mag(), y.mag())where x and y are elements ofvalues.- Parameters:
values- Values to compute minimum of.- Returns:
- The minimum value in
values. Ifvalues.lengthequals zero, thenDouble.NaNis returned.
-
argmaxAbs
Computes the index of the maximum absolute value in the specified array.- Parameters:
values- Values for which compute index of maximum absolute value.- Returns:
- The index of the maximum absolute value in
values. If the maximum absolute value occurs more than once, the index of the first occurrence is returned. Ifvalues.lengthequals zero, then-1is returned.
-
argminAbs
Computes the index of the minimum absolute value in the specified array.- Parameters:
values- Values for which compute index of the minimum absolute value.- Returns:
- The index of the minimum absolute value in
values. If the minimum absolute value occurs more than once, the index of the first occurrence is returned. Ifvalues.lengthequals zero, then-1is returned.
-
maxAbs
Returns the maximum absolute value among
nelements in the arraysrc, starting at indexstartand advancing bystridefor each subsequent element.More formally, this method examines the elements at indices:
start,start + stride,start + 2*stride, ...,start + (n-1)*stride.This method may be used to find the maximum absolute value within the row or column of a
matrixaas follows:- Maximum absolute value within row
i:maxAbs(a.data, i*a.numCols, a.numCols, 1); - Maximum absolute value within column
j:maxAbs(a.data, j, a.numRows, a.numRows);
- Parameters:
src- The array to search for maximum absolute value within.start- The starting index insrcto search.n- The number of elements to consider withinsrc1.stride- The gap (in indices) between consecutive elements to search withinsrc.- Returns:
- The maximum absolute value found among all elements considered in
src. - Throws:
IndexOutOfBoundsException- If the specified range extends beyond the array bounds.
- Maximum absolute value within row
-
minAbs
Returns the minimum absolute value among
nelements in the arraysrc, starting at indexstartand advancing bystridefor each subsequent element.More formally, this method examines the elements at indices:
start,start + stride,start + 2*stride, ...,start + (n-1)*stride.This method may be used to find the minimum absolute value within the row or column of a
matrixaas follows:- Minimum absolute value within row
i:maxAbs(a.data, i*a.numCols, a.numCols, 1); - Minimum absolute value within column
j:maxAbs(a.data, j, a.numRows, a.numRows);
- Parameters:
src- The array to search for Minimum absolute value within.start- The starting index insrcto search.n- The number of elements to consider withinsrc1.stride- The gap (in indices) between consecutive elements to search withinsrc.- Returns:
- If
src.length == 0thenDouble.POSITIVE_INFINITYwill be returned. - Otherwise, the minimum absolute value found among all elements considered inn
src.
- If
- Throws:
IndexOutOfBoundsException- If the specified range extends beyond the array bounds.
- Minimum absolute value within row
-