* Returns the index of a sorted array * @param arr1 The first array * @param arr2 The second array * @param dtype The data type of the arrays * * @returns sorted index
(arr1: ArrayType1D | ArrayType2D, arr2: ArrayType1D | ArrayType2D, dtype: string)
| 742 | * @returns sorted index |
| 743 | */ |
| 744 | sortArrayByIndex(arr1: ArrayType1D | ArrayType2D, arr2: ArrayType1D | ArrayType2D, dtype: string) { |
| 745 | const sortedIdx = arr1.map((item, index) => { |
| 746 | return [arr2[index], item]; |
| 747 | }); |
| 748 | if (dtype == "string") { |
| 749 | sortedIdx.sort(); |
| 750 | } else { |
| 751 | sortedIdx.sort(([arg1], [arg2]) => (arg2 as unknown as number) - (arg1 as unknown as number)); |
| 752 | } |
| 753 | |
| 754 | return sortedIdx.map(([, item]) => item) as number[] |
| 755 | } |
| 756 | |
| 757 | /** |
| 758 | * Returns a new series with properties of the old series |
no test coverage detected