NMath User's Guide

TOC | Previous | Next | Index

38.10 Sorting (.NET, C#, CSharp, VB, Visual Basic, F#)

The static Sort() method on class StatsFunctions sorts the elements of a data set in ascending or descending order using the quicksort algorithm and returns a new data set containing the result. The sort order is specified using a value from the SortingType enumeration.

For example:

Code Example – C#

var v = new DoubleVector( "5 7 1 3 9 4 5 2 1 0 11 3" );
v = StatsFunctions.Sort( v, SortingType.Descending );

Code Example – VB

Dim V As New DoubleVector("5 7 1 3 9 4 5 2 1 0 11 3")
V = StatsFunctions.Sort( V, SortingType.Descending )

NOTE—StatsSettings.Sorting specifies the default SortingType.


Top

Top