Package jline.util
Class Utils
java.lang.Object
jline.util.Utils
Miscellaneous utilities
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classContainer class for MAPE calculation results -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringdoubleArrayToString(double[] array) Convert double array to string representationstatic intfindString(Map<Integer, String> map, String target) Finds the key corresponding to a target string value in a map.static booleanisInf(double val) Checks if a value represents infinity.static doubleReturn mean absolute percentage error of approx with respect to exactstatic Utils.MapeResultmapeWithNanMean(Matrix approx, Matrix exact) Polymorphic version that returns both MAPE and nanMean.static int[]parseIntArray(String str) Parse integer array from string representationstatic <T> List<T>
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
findString
Finds the key corresponding to a target string value in a map.- Parameters:
map- the map to searchtarget- the string value to find- Returns:
- the key associated with the target value, or 0 if not found
-
isInf
public static boolean isInf(double val) Checks if a value represents infinity. Considers Double infinity and integer limit values as infinite.- Parameters:
val- the value to check- Returns:
- true if the value represents infinity, false otherwise
-
mape
Return mean absolute percentage error of approx with respect to exact- Parameters:
approx- The approximate values matrixexact- The exact values matrix- Returns:
- The mean absolute percentage error as a percentage
-
mapeWithNanMean
Polymorphic version that returns both MAPE and nanMean. Calculates mean absolute percentage error and handles NaN/zero values appropriately.- Parameters:
approx- The approximate values matrixexact- The exact values matrix- Returns:
- MapeResult containing MAPE, nanMean, and count of valid comparisons
-
unique
-
doubleArrayToString
Convert double array to string representation- Parameters:
array- The double array to convert- Returns:
- String representation in format [1.0,2.0,3.0]
-
parseIntArray
Parse integer array from string representation- Parameters:
str- String representation in format [1,2,3] or 1,2,3- Returns:
- Parsed integer array
-