Changeset 578 for trunk/psLib/src/collections/psSort.c
- Timestamp:
- May 5, 2004, 10:43:57 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/collections/psSort.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psSort.c
r486 r578 14 14 * @author Ross Harman, MHPCC 15 15 * 16 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $17 * @date $Date: 2004-0 4-21 00:40:32 $16 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2004-05-05 20:43:22 $ 18 18 * 19 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 104 104 /*****************************************************************************/ 105 105 106 ps FloatArray *psSort(107 ps FloatArray *restrict outArray, /**< Sorted output array. */108 const ps FloatArray *restrict inArray /**< Input array to sort. */106 psArray *psSort( 107 psArray *restrict outArray, /**< Sorted output array. */ 108 const psArray *restrict inArray /**< Input array to sort. */ 109 109 ) 110 110 { … … 129 129 inN = inArray->n; 130 130 outN = outArray->n; 131 inArr = inArray->arr ;132 outArr = outArray->arr ;131 inArr = inArray->arr.fltArr; 132 outArr = outArray->arr.fltArr; 133 133 elSize = sizeof(float); 134 134 … … 139 139 } 140 140 141 if(inN == 0) { 142 psError(__func__, " : Line %d - No elements in use for input array\n", __LINE__); 143 return outArray; 144 } 145 146 if(outN == 0) { 147 psError(__func__, " : Line %d - No elements in use for output array\n", __LINE__); 148 return outArray; 149 } 150 141 151 // Copy input array values into output array 142 152 for(i=0; i<inN; i++) { … … 150 160 } 151 161 152 ps IntArray *psSortIndex(153 ps IntArray *restrict outArray,/**< Output array of sorted indices. */154 const ps FloatArray *restrict inArray/**< Input array to be sorted. */162 psArray *psSortIndex( 163 psArray *restrict outArray, /**< Output array of sorted indices. */ 164 const psArray *restrict inArray /**< Input array to be sorted. */ 155 165 ) 156 166 { … … 163 173 int *outArr = NULL; 164 174 float diff = 0.0f; 165 ps FloatArray *tmpFloatArray = NULL;175 psArray *tmpFloatArray = NULL; 166 176 167 177 if(outArray == NULL) { … … 178 188 inN = inArray->n; 179 189 outN = outArray->n; 180 inArr = inArray->arr ;181 outArr = outArray->arr ;190 inArr = inArray->arr.fltArr; 191 outArr = outArray->arr.intArr; 182 192 183 193 if(inN != outN) { … … 188 198 189 199 tmpFloatArray = psFloatArrayAlloc(inN); 200 tmpFloatArray->n = inN; 190 201 tmpFloatArray = psSort(tmpFloatArray, inArray); 191 202 192 203 for(i=0; i<inN; i++) { 193 tempVal = tmpFloatArray->arr [i];204 tempVal = tmpFloatArray->arr.fltArr[i]; 194 205 for(j=0; j<inN; j++) { 195 206 diff = fabsf(tempVal - inArr[j]);
Note:
See TracChangeset
for help on using the changeset viewer.
