class MergeSortIndirect extends AnyRef
The MergeSortIndirect
class provides an implementation of Indirect Merge Sort,
a version of mergesort that does not re-arrange the array, but modifies an
Int array called 'perm' such that 'perm(i)' is the index of the i-th smallest
entry in the array (i.e., a(perm(i)) <= a(perm(i+1)).
The 'isort' method returns the permutation that sorts array 'a' in 'perm'.
Will indirectly sort any type supported by the Vec_Elem
less-than operator.
- See also
scalation.linalgebra.Vec_Elem
- Alphabetic
- By Inheritance
- MergeSortIndirect
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
MergeSortIndirect(a: Array[Any])(perm: Array[Int] = Array.range (0, a.length))
- a
the array to be indirectly sorted
- perm
the initial permutation, either 0 until a.length or result of last isort
Value Members
-
def
isort(): Array[Int]
Indirectly sort the array 'a' by updating the permutation array 'perm'.