Fast Auxiliary Space Preconditioning  1.8.4 Feb/15/2016
ordering.c File Reference

Subroutines for ordering, merging, removing duplicated integers. More...

#include "fasp.h"

Go to the source code of this file.

Functions

INT fasp_BinarySearch (INT *list, const INT value, const INT nlist)
 Binary Search. More...
 
INT fasp_aux_unique (INT numbers[], const INT size)
 Remove duplicates in an sorted (ascending order) array. More...
 
void fasp_aux_merge (INT numbers[], INT work[], INT left, INT mid, INT right)
 Merge two sorted arrays. More...
 
void fasp_aux_msort (INT numbers[], INT work[], INT left, INT right)
 Sort the INT array in ascending order with the merge sort algorithm. More...
 
void fasp_aux_iQuickSort (INT *a, INT left, INT right)
 Sort the array (INT type) in ascending order with the quick sorting algorithm. More...
 
void fasp_aux_dQuickSort (REAL *a, INT left, INT right)
 Sort the array (REAL type) in ascending order with the quick sorting algorithm. More...
 
void fasp_aux_iQuickSortIndex (INT *a, INT left, INT right, INT *index)
 Reorder the index of (INT type) so that 'a' is in ascending order. More...
 
void fasp_aux_dQuickSortIndex (REAL *a, INT left, INT right, INT *index)
 Reorder the index of (REAL type) so that 'a' is ascending in such order. More...
 
void fasp_dcsr_CMK_order (const dCSRmat *A, INT *order, INT *oindex)
 Ordering vertices of matrix graph corresponding to A. More...
 
void fasp_dcsr_RCMK_order (const dCSRmat *A, INT *order, INT *oindex, INT *rorder)
 Resverse CMK ordering. More...
 

Detailed Description

Subroutines for ordering, merging, removing duplicated integers.

Definition in file ordering.c.

Function Documentation

void fasp_aux_dQuickSort ( REAL a,
INT  left,
INT  right 
)

Sort the array (REAL type) in ascending order with the quick sorting algorithm.

Parameters
aPointer to the array needed to be sorted
leftStarting index
rightEnding index
Author
Zhiyang Zhou
Date
2009/11/28
Note
'left' and 'right' are usually set to be 0 and n-1, respectively where n is the length of 'a'.

Definition at line 239 of file ordering.c.

void fasp_aux_dQuickSortIndex ( REAL a,
INT  left,
INT  right,
INT index 
)

Reorder the index of (REAL type) so that 'a' is ascending in such order.

Parameters
aPointer to the array
leftStarting index
rightEnding index
indexIndex of 'a' (out)
Author
Zhiyang Zhou
Date
2009/12/02
Note
'left' and 'right' are usually set to be 0 and n-1,respectively,where n is the length of 'a'. 'index' should be initialized in the nature order and it has the same length as 'a'.

Definition at line 320 of file ordering.c.

void fasp_aux_iQuickSort ( INT a,
INT  left,
INT  right 
)

Sort the array (INT type) in ascending order with the quick sorting algorithm.

Parameters
aPointer to the array needed to be sorted
leftStarting index
rightEnding index
Author
Zhiyang Zhou
Date
11/28/2009
Note
'left' and 'right' are usually set to be 0 and n-1, respectively where n is the length of 'a'.

Definition at line 201 of file ordering.c.

void fasp_aux_iQuickSortIndex ( INT a,
INT  left,
INT  right,
INT index 
)

Reorder the index of (INT type) so that 'a' is in ascending order.

Parameters
aPointer to the array
leftStarting index
rightEnding index
indexIndex of 'a' (out)
Author
Zhiyang Zhou
Date
2009/12/02
Note
'left' and 'right' are usually set to be 0 and n-1,respectively,where n is the length of 'a'. 'index' should be initialized in the nature order and it has the same length as 'a'.

Definition at line 279 of file ordering.c.

void fasp_aux_merge ( INT  numbers[],
INT  work[],
INT  left,
INT  mid,
INT  right 
)

Merge two sorted arrays.

Parameters
numbersPointer to the array needed to be sorted
workPointer to the work array with same size as numbers
leftStarting index of array 1
midStarting index of array 2
rightEnding index of array 1 and 2
Author
Chensong Zhang
Date
11/21/2010
Note
Both arrays are stored in numbers! Arrays should be pre-sorted!

Definition at line 108 of file ordering.c.

void fasp_aux_msort ( INT  numbers[],
INT  work[],
INT  left,
INT  right 
)

Sort the INT array in ascending order with the merge sort algorithm.

Parameters
numbersPointer to the array needed to be sorted
workPointer to the work array with same size as numbers
leftStarting index
rightEnding index
Author
Chensong Zhang
Date
11/21/2010
Note
'left' and 'right' are usually set to be 0 and n-1, respectively

Definition at line 170 of file ordering.c.

INT fasp_aux_unique ( INT  numbers[],
const INT  size 
)

Remove duplicates in an sorted (ascending order) array.

Parameters
numbersPointer to the array needed to be sorted (in/out)
sizeLength of the target array
Returns
New size after removing duplicates
Author
Chensong Zhang
Date
11/21/2010
Note
Operation is in place. Does not use any extra or temporary storage.

Definition at line 75 of file ordering.c.

INT fasp_BinarySearch ( INT list,
const INT  value,
const INT  nlist 
)

Binary Search.

Parameters
listPointer to a set of values
valueThe target
nlistLength of the array list
Returns
The location of value in array list if succeeded; otherwise, return -1.
Author
Chunsheng Feng
Date
03/01/2011

Definition at line 30 of file ordering.c.

void fasp_dcsr_CMK_order ( const dCSRmat A,
INT order,
INT oindex 
)

Ordering vertices of matrix graph corresponding to A.

Parameters
APointer to matrix
oindexPointer to index of vertices in order
orderPointer to vertices with increasing degree
Author
Zheng Li, Chensong Zhang
Date
05/28/2014

Definition at line 356 of file ordering.c.

void fasp_dcsr_RCMK_order ( const dCSRmat A,
INT order,
INT oindex,
INT rorder 
)

Resverse CMK ordering.

Parameters
APointer to matrix
orderPointer to vertices with increasing degree
oindexPointer to index of vertices in order
rorderPointer to reverse order
Author
Zheng Li, Chensong Zhang
Date
10/10/2014

Definition at line 405 of file ordering.c.