IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 5, 2004, 10:43:57 AM (22 years ago)
Author:
harman
Message:

Updated per SDR documentation bug fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/collections/psSort.c

    r486 r578  
    1414 *  @author Ross Harman, MHPCC
    1515 *   
    16  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    17  *  @date $Date: 2004-04-21 00:40:32 $
     16 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     17 *  @date $Date: 2004-05-05 20:43:22 $
    1818 *
    1919 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    104104/*****************************************************************************/
    105105
    106 psFloatArray *psSort(
    107     psFloatArray *restrict outArray,        /**< Sorted output array. */
    108     const psFloatArray *restrict inArray    /**< Input array to sort. */
     106psArray *psSort(
     107    psArray *restrict outArray,        /**< Sorted output array. */
     108    const psArray *restrict inArray    /**< Input array to sort. */
    109109)
    110110{
     
    129129    inN = inArray->n;
    130130    outN = outArray->n;
    131     inArr = inArray->arr;
    132     outArr = outArray->arr;
     131    inArr = inArray->arr.fltArr;
     132    outArr = outArray->arr.fltArr;
    133133    elSize = sizeof(float);
    134134
     
    139139    }
    140140
     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
    141151    // Copy input array values into output array
    142152    for(i=0; i<inN; i++) {
     
    150160}
    151161
    152 psIntArray *psSortIndex(
    153     psIntArray *restrict outArray,          /**< Output array of sorted indices. */
    154     const psFloatArray *restrict inArray    /**< Input array to be sorted. */
     162psArray *psSortIndex(
     163    psArray *restrict outArray,         /**< Output array of sorted indices. */
     164    const psArray *restrict inArray     /**< Input array to be sorted. */
    155165)
    156166{
     
    163173    int *outArr = NULL;
    164174    float diff = 0.0f;
    165     psFloatArray *tmpFloatArray = NULL;
     175    psArray *tmpFloatArray = NULL;
    166176
    167177    if(outArray == NULL) {
     
    178188    inN = inArray->n;
    179189    outN = outArray->n;
    180     inArr = inArray->arr;
    181     outArr = outArray->arr;
     190    inArr = inArray->arr.fltArr;
     191    outArr = outArray->arr.intArr;
    182192
    183193    if(inN != outN) {
     
    188198
    189199    tmpFloatArray = psFloatArrayAlloc(inN);
     200    tmpFloatArray->n = inN;
    190201    tmpFloatArray = psSort(tmpFloatArray, inArray);
    191202
    192203    for(i=0; i<inN; i++) {
    193         tempVal = tmpFloatArray->arr[i];
     204        tempVal = tmpFloatArray->arr.fltArr[i];
    194205        for(j=0; j<inN; j++) {
    195206            diff = fabsf(tempVal - inArr[j]);
Note: See TracChangeset for help on using the changeset viewer.