Packages

c

scalation.util

MergeSortIndirect

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

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. MergeSortIndirect
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. 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

  1. def isort(): Array[Int]

    Indirectly sort the array 'a' by updating the permutation array 'perm'.