Package unifeat.util
Class ArraysFunc
java.lang.Object
unifeat.util.ArraysFunc
This java class is used to implement various utility methods for manipulating
arrays and matrices. The methods in this class are contained brief description
of the applications.
- Author:
- Sina Tabakhi
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int[]
Converts the ArrayList type to an array of integer valuesstatic double[][]
convertStringToDouble
(String[][] array) Converts the string input to double valuesstatic double[][]
copyDoubleArray2D
(double[][] initArray) Creates a copy of the two dimensional arraystatic double[][]
copyDoubleArray2D
(double[][] initArray, int indexStart, int indexEnd) Creates a copy of the two dimensional array by using the indices of rowsstatic void
sortArray1D
(double[] array, boolean descending) Sorts the one dimensional array (double values) as descending or ascending orderstatic void
sortArray1D
(int[] array, boolean descending) Sorts the one dimensional array (integer values) as descending or ascending orderstatic void
sortArray1D
(int[] array, boolean descending, int indexStart, int indexEnd) Sorts the one dimensional array (integer values) as descending or ascending orderstatic void
sortArray2D
(double[][] array, int col) Sorts the two dimensional array by using the index of column as ascending orderstatic void
sortArray2D
(double[][] array, int col, int indexStart, int indexEnd) Sorts the two dimensional array by using the index of column as ascending orderstatic int[]
sortWithIndex
(double[] array, boolean descending) Sorts the one dimensional array (double values) by values and returns a list of indicesstatic int[]
sortWithIndex
(int[] array, boolean descending) Sorts the one dimensional array (integer values) by values and returns a list of indices
-
Constructor Details
-
ArraysFunc
public ArraysFunc()
-
-
Method Details
-
copyDoubleArray2D
public static double[][] copyDoubleArray2D(double[][] initArray) Creates a copy of the two dimensional array- Parameters:
initArray
- initial array- Returns:
- a copy array of the input array
-
copyDoubleArray2D
public static double[][] copyDoubleArray2D(double[][] initArray, int indexStart, int indexEnd) Creates a copy of the two dimensional array by using the indices of rows- Parameters:
initArray
- initial arrayindexStart
- the start index of the dataindexEnd
- the end index of the data- Returns:
- a copy array of the input array
-
sortArray2D
public static void sortArray2D(double[][] array, int col) Sorts the two dimensional array by using the index of column as ascending order- Parameters:
array
- the input arraycol
- the index of the column
-
sortArray2D
public static void sortArray2D(double[][] array, int col, int indexStart, int indexEnd) Sorts the two dimensional array by using the index of column as ascending order- Parameters:
array
- the input arraycol
- the index of the columnindexStart
- the start index of the dataindexEnd
- the end index of the data
-
sortArray1D
public static void sortArray1D(double[] array, boolean descending) Sorts the one dimensional array (double values) as descending or ascending order- Parameters:
array
- the input arraydescending
- indicates the type of sorting
-
sortArray1D
public static void sortArray1D(int[] array, boolean descending) Sorts the one dimensional array (integer values) as descending or ascending order- Parameters:
array
- the input arraydescending
- indicates the type of sorting
-
sortArray1D
public static void sortArray1D(int[] array, boolean descending, int indexStart, int indexEnd) Sorts the one dimensional array (integer values) as descending or ascending order- Parameters:
array
- the input arraydescending
- indicates the type of sortingindexStart
- the start index of the dataindexEnd
- the end index of the data
-
sortWithIndex
public static int[] sortWithIndex(double[] array, boolean descending) Sorts the one dimensional array (double values) by values and returns a list of indices- Parameters:
array
- the input arraydescending
- indicates the type of sorting- Returns:
- the sorted array
-
sortWithIndex
public static int[] sortWithIndex(int[] array, boolean descending) Sorts the one dimensional array (integer values) by values and returns a list of indices- Parameters:
array
- the input arraydescending
- indicates the type of sorting- Returns:
- the sorted array
-
convertStringToDouble
Converts the string input to double values- Parameters:
array
- the string input array- Returns:
- the double array obtained from input array
-
convertArrayListToInt
Converts the ArrayList type to an array of integer values- Parameters:
list
- the input ArrayList- Returns:
- an array of integer values
-