Sort vector and return index vector | F_SSORTV/F_DSORTV | |
Name | F_SSORTV/F_DSORTV |
|
| Sort vector and return index vector |
|
Purpose | F_xSORTV sorts the entries of a real vector x in increasing or decreasing order, | |
| returns p, the permuted vector, and overwrites the vector x with the sorted | |
| vector (x = P * x). If n is less than or equal to zero, the routine returns | |
| immediately. |
|
| The permutation vector p represents a general permutation matrix P. This | |
| matrix P is represented as a product of at most n interchange permutations. An | |
| interchange permutation E is a permutation obtained by swapping two rows of | |
| the identity matrix. In other words, P = En...E1 and each Ei is the identity with | |
| rows i and pi interchanged. |
|
| F_xSORTV, like F_xSORT, strictly operates on real vectors and is not defined | |
| for complex vectors. |
|
Usage | VECLIB: |
|
| INTEGER*4 | INCP, INCX, N, SORT |
| INTEGER | P( * ) |
| REAL*4 | X( * ) |
| SUBROUTINE F_SSORTV (SORT, N, X, INCX, P, INCP) | |
| INTEGER*4 | INCP, INCX, N, SORT |
| INTEGER | P( * ) |
| REAL*8 | X( * ) |
| SUBROUTINE F_DSORTV (SORT, N, X, INCX, P, INCP) | |
| VECLIB8: |
|
| INTEGER*8 | INCP, INCX, N, SORT |
| INTEGER | P( * ) |
| REAL*4 | X( * ) |
| SUBROUTINE F_SSORTV (SORT, N, X, INCX, P, INCP) | |
| INTEGER*8 | INCP, INCX, N, SORT |
| INTEGER | P( * ) |
| REAL*8 | X( * ) |
| SUBROUTINE F_DSORTV (SORT, N, X, INCX, P, INCP) | |
Input | SORT | Specifies whether the data should be sorted in |
|
| increasing or decreasing order. Use either |
|
| BLAS_INCREASING_ORDER or |
|
| BLAS_DECREASING_ORDER. |
| N | Number of elements of vector x. |
Chapter 2 Basic Vector Operations 193