IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 27, 2004, 1:41:42 PM (22 years ago)
Author:
gusciora
Message:

...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psStats.c

    r1904 r1907  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-09-27 20:37:48 $
     11 *  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-09-27 23:41:42 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    858858    for (i = 0; i < myData->n; i++) {
    859859        myData->data.F32[i] = (myData->data.F32[i] - min) / range;
     860    }
     861}
     862
     863/*****************************************************************************
     864p_psNormalizeVectorF64(myData): this is a private function which normalizes the
     865elements of a vector to a range between -1.0 and 1.0.
     866 
     867XXX: incorporate this into above
     868 
     869XXX: 0-1 or -1:1?
     870 *****************************************************************************/
     871void p_psNormalizeVectorF64(psVector* myData)
     872{
     873    float min = (float)HUGE;
     874    float max = (float)-HUGE;
     875    float range = 0.0;
     876    int i = 0;
     877
     878    for (i = 0; i < myData->n; i++) {
     879        if (myData->data.F64[i] < min) {
     880            min = myData->data.F64[i];
     881        }
     882        if (myData->data.F64[i] > max) {
     883            max = myData->data.F64[i];
     884        }
     885    }
     886
     887    range = max - min;
     888    for (i = 0; i < myData->n; i++) {
     889        myData->data.F64[i] = -1.0 + 2.0 *
     890                              ((myData->data.F64[i] - min) / range);
    860891    }
    861892}
Note: See TracChangeset for help on using the changeset viewer.