Synopsis

PDX_MSGT mth_SortDoubleArrayByBubble(long option, long len, int dim, double *array, int key_index, int *info)

Purpose

Sort a 2-D double array with a 1-D integer array

Description

A 2-D double array with a 1-D integer array will be sorted according to the specified column of the double array which is the comparing key, and the specified sorting direction. The key_index starts from 0 and key_index < dim should hold true. The bubble algorithm is used.

The sorting direction option must be chosen.

The array of info could be NULL.

Input

option

MTH_ASCENDING

Sort along the ascending direction.

MTH_DESCENDING

Sort along the descending direction.

len

The size of the two arrays

dim

The number of columns of the double array.

array

The 2-D double array

key_index

The comparing column index number

info

The 1-D integer array or NULL

Output

array

The 2-D double array

info

The 1-D integer array

Return

      MTH_NOERR
      MTH_INVALID_OPT
      Low level error return
      .fi