IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 831


Ignore:
Timestamp:
Jun 2, 2004, 1:29:39 PM (22 years ago)
Author:
harman
Message:

Changed psVector to be consistent with psImage

Location:
trunk/psLib
Files:
31 edited

Legend:

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

    r670 r831  
    1414 *  @author Ross Harman, MHPCC
    1515 *   
    16  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    17  *  @date $Date: 2004-05-13 22:47:52 $
     16 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     17 *  @date $Date: 2004-06-02 23:29:14 $
    1818 *
    1919 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    129129    inN = inVector->n;
    130130    outN = outVector->n;
    131     inVec = inVector->vec.f;
    132     outVec = outVector->vec.f;
     131    inVec = inVector->data.F32;
     132    outVec = outVector->data.F32;
    133133    elSize = sizeof(float);
    134134
     
    188188    inN = inVector->n;
    189189    outN = outVector->n;
    190     inVec = inVector->vec.f;
    191     outVec = outVector->vec.i32;
     190    inVec = inVector->data.F32;
     191    outVec = outVector->data.S32;
    192192
    193193    if(inN != outN) {
     
    197197    }
    198198
    199     tmpFloatVector = psVectorAlloc(PS_TYPE_FLOAT, inN);
     199    tmpFloatVector = psVectorAlloc(inN, PS_TYPE_F32);
    200200    tmpFloatVector->n = inN;
    201201    tmpFloatVector = psSort(tmpFloatVector, inVector);
    202202
    203203    for(i=0; i<inN; i++) {
    204         tempVal = tmpFloatVector->vec.f[i];
     204        tempVal = tmpFloatVector->data.F32[i];
    205205        for(j=0; j<inN; j++) {
    206206            diff = fabsf(tempVal - inVec[j]);
  • trunk/psLib/src/collections/psVector.c

    r811 r831  
    1919 *  @author Ross Harman, MHPCC
    2020 *   
    21  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    22  *  @date $Date: 2004-05-29 01:08:46 $
     21 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     22 *  @date $Date: 2004-06-02 23:29:14 $
    2323 *
    2424 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6464/* FUNCTION IMPLEMENTATION - PUBLIC                                          */
    6565/*****************************************************************************/
    66 psVector* psVectorAlloc(psElemType elemType, unsigned int nalloc)
     66psVector* psVectorAlloc(unsigned int nalloc, psElemType elemType)
    6767{
    6868    psVector *psVec = NULL;
     
    8686
    8787    // Create vector data array
    88     psVec->vec.v = psAlloc(nalloc*elementSize);
     88    psVec->data.V = psAlloc(nalloc*elementSize);
    8989
    9090    return psVec;
    9191}
    9292
    93 psVector *psVectorRealloc(psVector *restrict in, unsigned int nalloc)
     93psVector *psVectorRealloc(unsigned int nalloc, psVector *restrict in)
    9494{
    9595    int elementSize = 0;
     
    110110            if (elemType == PS_TYPE_PTR) {
    111111                for (int i = nalloc; i < in->n; i++) {   // For reduction in vector size
    112                     psMemDecrRefCounter(in->vec.vp[i]);
     112                    psMemDecrRefCounter(in->data.PTR[i]);
    113113                }
    114114            }
     
    117117
    118118        // Realloc after decrementation to avoid accessing freed array elements
    119         in->vec.v = psRealloc(in->vec.v,nalloc*elementSize);
     119        in->data.V = psRealloc(in->data.V,nalloc*elementSize);
    120120        in->nalloc = nalloc;
    121121    }
     
    129129
    130130    if (in == NULL) {
    131         return psVectorAlloc(type,nalloc);
     131        return psVectorAlloc(nalloc, type);
    132132    }
    133133
     
    150150    if (elemType == PS_TYPE_PTR) {
    151151        for (int i = 0; i < in->n; i++) {   // For reduction in vector size
    152             psMemDecrRefCounter(in->vec.vp[i]);
    153             in->vec.vp[i] = NULL;
     152            psMemDecrRefCounter(in->data.PTR[i]);
     153            in->data.PTR[i] = NULL;
    154154        }
    155155    }
    156156
    157     in->vec.v = psRealloc(in->vec.v,nalloc*PSELEMTYPE_SIZEOF(elemType));
     157    in->data.V = psRealloc(in->data.V,nalloc*PSELEMTYPE_SIZEOF(elemType));
    158158
    159159    in->n = 0;
     
    170170    }
    171171
    172     psFree(psVec->vec.v);
     172    psFree(psVec->data.V);
    173173    psFree(psVec);
    174174}
     
    188188    for(int i = 0; i < psVec->nalloc; i++) {
    189189        if(elemFree == NULL) {
    190             psMemDecrRefCounter(psVec->vec.vp[i]);
     190            psMemDecrRefCounter(psVec->data.PTR[i]);
    191191        } else {
    192             elemFree(psMemDecrRefCounter(psVec->vec.vp[i]));
     192            elemFree(psMemDecrRefCounter(psVec->data.PTR[i]));
    193193        }
    194         psVec->vec.vp[i] = NULL;
     194        psVec->data.PTR[i] = NULL;
    195195    }
    196196}
  • trunk/psLib/src/collections/psVector.h

    r811 r831  
    11/** @file  psVector.h
    22 *
    3  *  @brief Contains support for basic vector types
     3 *  @brief Contains basic vector definitions and operations
    44 *
    5  *  This file defines types and functions for one dimensional vectors which include:
    6  *      char
    7  *      short
    8  *      int
    9  *      long
    10  *      unsigned char
    11  *      unsigned short
    12  *      unsigned int
    13  *      unsigned long
    14  *      float
    15  *      double
    16  *      complex float
    17  *      void **
     5 *  This file defines the basic type for a vector struct and functions useful
     6 *  in manupulating vectors.
    187 *
     8 *  @author Robert DeSonia, MHPCC
    199 *  @author Ross Harman, MHPCC
    2010 *
    21  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    22  *  @date $Date: 2004-05-29 01:08:46 $
     11 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-06-02 23:29:14 $
    2313 *
    2414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4232
    4333    union {
    44         int8_t *i8;                     ///< Pointers to char integer data.
    45         int16_t *i16;                   ///< Pointers to short integer data.
    46         int32_t *i32;                   ///< Pointers to integer data.
    47         int64_t *i64;                   ///< Pointers to long integer data.
    48         uint8_t *ui8;                   ///< Pointers to unsigned char integer data.
    49         uint16_t*ui16;                  ///< Pointers to unsigned short integer data.
    50         uint32_t *ui32;                 ///< Pointers to unsigned integer data.
    51         uint64_t *ui64;                 ///< Pointers to unsigned long integer data.
    52         float *f;                       ///< Pointers to floating point data.
    53         double *d;                      ///< Pointers to double precision data.
    54         complex float *cf;              ///< Pointers to complex floating point data.
    55         void *v;                        ///< Pointers to generic void data
    56         void **vp;                      ///< Void pointer vector.
    57     }vec;                               ///< Union for data types.
     34        psU8    *U8;                    ///< Unsigned 8-bit integer data.
     35        psU16   *U16;                   ///< Unsigned 16-bit integer data.
     36        psU32   *U32;                   ///< Unsigned 32-bit integer data.
     37        psU64   *U64;                   ///< Unsigned 64-bit integer data.
     38        psS8    *S8;                    ///< Signed 8-bit integer data.
     39        psS16   *S16;                   ///< Signed 16-bit integer data.
     40        psS32   *S32;                   ///< Signed 32-bit integer data.
     41        psS64   *S64;                   ///< Signed 64-bit integer data.
     42        psF32   *F32;                   ///< Single-precision float data.
     43        psF64   *F64;                   ///< Double-precision float data.
     44        psC32   *C32;                   ///< Single-precision complex data.
     45        psC64   *C64;                   ///< Double-precision complex data.
     46        psPTR   *PTR;                   ///< Void pointers
     47        psPTR    V;                     ///< Pointer to data
     48    } data;                             ///< Union for data types.
    5849}
    5950psVector;
     
    7162 */
    7263psVector *psVectorAlloc(
    73     psElemType dataType,                ///< Type of data to be held by vector.
    74     unsigned int nalloc                 ///< Total number of elements to make available.
     64    unsigned int nalloc,                ///< Total number of elements to make available.
     65    psElemType dataType                 ///< Type of data to be held by vector.
    7566);
    7667
     
    8475 */
    8576psVector *psVectorRealloc(
    86     psVector *restrict psVec,           ///< Vector to reallocate.
    87     unsigned int nalloc                 ///< Total number of elements to make available.
     77    unsigned int nalloc,                ///< Total number of elements to make available.
     78    psVector *restrict psVec            ///< Vector to reallocate.
    8879);
    8980
  • trunk/psLib/src/dataManip/psFFT.c

    r827 r831  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-06-02 03:02:48 $
     7 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-06-02 23:29:21 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    448448    numElements = in->n;
    449449
    450     out = psVectorRecycle(out,PS_TYPE_C32,numElements);
     450    out = psVectorRecycle(out, numElements, PS_TYPE_C32);
    451451
    452452    if (type == PS_TYPE_F32) {
    453453        // need to convert to complex
    454         psC32* outVec = out->vec.cf;
    455         psF32* inVec = in->vec.f;
     454        psC32* outVec = out->data.C32;
     455        psF32* inVec = in->data.F32;
    456456        for (unsigned int i=0;i<numElements;i++) {
    457457            outVec[i] = inVec[i];
    458458        }
    459459    } else {
    460         psC32* outVec = out->vec.cf;
    461         psC32* inVec = in->vec.cf;
     460        psC32* outVec = out->data.C32;
     461        psC32* inVec = in->data.C32;
    462462        for (unsigned int i=0;i<numElements;i++) {
    463463            outVec[i] = inVec[i];
     
    466466
    467467    plan = fftwf_plan_dft_1d(numElements,
    468                              (fftwf_complex*)out->vec.cf,
    469                              (fftwf_complex*)out->vec.cf,
     468                             (fftwf_complex*)out->data.C32,
     469                             (fftwf_complex*)out->data.C32,
    470470                             direction,
    471471                             P_FFTW_PLAN_RIGOR);
     
    504504        psLogMsg(__func__,PS_LOG_WARN,"Real portion of a non-Complex type called called for. "
    505505                 "Just a vector copy was performed.");
    506         out = psVectorRecycle(out,type,numElements);
    507         memcpy(out->vec.v,in->vec.v,numElements*PSELEMTYPE_SIZEOF(type));
     506        out = psVectorRecycle(out,numElements,type);
     507        memcpy(out->data.V,in->data.V,numElements*PSELEMTYPE_SIZEOF(type));
    508508        return out;
    509509    }
     
    511511    if (type == PS_TYPE_C32) {
    512512        psF32* outVec;
    513         psC32* inVec = in->vec.cf;
    514 
    515         out = psVectorRecycle(out,PS_TYPE_F32,numElements);
    516         outVec = out->vec.f;
     513        psC32* inVec = in->data.C32;
     514
     515        out = psVectorRecycle(out,numElements,PS_TYPE_F32);
     516        outVec = out->data.F32;
    517517
    518518        for (unsigned int i=0;i<numElements;i++) {
     
    548548                 "A zeroed vector was returned.");
    549549        out = psVectorRecycle(out,numElements,type);
    550         memset(out->vec.v,0,PSELEMTYPE_SIZEOF(type)*numElements);
     550        memset(out->data.V,0,PSELEMTYPE_SIZEOF(type)*numElements);
    551551        return out;
    552552    }
     
    554554    if (type == PS_TYPE_C32) {
    555555        psF32* outVec;
    556         psC32* inVec = in->vec.cf;
    557 
    558         out = psVectorRecycle(out,PS_TYPE_F32,numElements);
    559         outVec = out->vec.f;
     556        psC32* inVec = in->data.C32;
     557
     558        out = psVectorRecycle(out,numElements, PS_TYPE_F32);
     559        outVec = out->data.F32;
    560560
    561561        for (unsigned int i=0;i<numElements;i++) {
     
    601601    if (type == PS_TYPE_F32) {
    602602        psC32* outVec;
    603         psF32* realVec = real->vec.f;
    604         psF32* imagVec = imag->vec.f;
    605 
    606         out = psVectorRecycle(out,PS_TYPE_C32,numElements);
    607         outVec = out->vec.cf;
     603        psF32* realVec = real->data.F32;
     604        psF32* imagVec = imag->data.F32;
     605
     606        out = psVectorRecycle(out,numElements, PS_TYPE_C32);
     607        outVec = out->data.C32;
    608608
    609609        for (unsigned int i=0;i<numElements;i++) {
     
    639639                 "Vector copy was performed instead.");
    640640
    641         out = psVectorRecycle(out,type,numElements);
    642         memcpy(out->vec.v,in->vec.v,PSELEMTYPE_SIZEOF(type)*numElements);
     641        out = psVectorRecycle(out,numElements,type);
     642        memcpy(out->data.V,in->data.V,PSELEMTYPE_SIZEOF(type)*numElements);
    643643        return out;
    644644    }
     
    646646    if (type == PS_TYPE_C32) {
    647647        psC32* outVec;
    648         psC32* inVec = in->vec.cf;
    649 
    650         out = psVectorRecycle(out,PS_TYPE_C32,numElements);
    651         outVec = out->vec.cf;
     648        psC32* inVec = in->data.C32;
     649
     650        out = psVectorRecycle(out,numElements,PS_TYPE_C32);
     651        outVec = out->data.C32;
    652652
    653653        for (unsigned int i=0;i<numElements;i++) {
     
    686686    if (type == PS_TYPE_C32) {
    687687        psF32* outVec;
    688         psC32* inVec = in->vec.cf;
     688        psC32* inVec = in->data.C32;
    689689        psF32 real;
    690690        psF32 imag;
    691691
    692692
    693         out = psVectorRecycle(out,PS_TYPE_F32,numElements);
    694         outVec = out->vec.f;
     693        out = psVectorRecycle(out,numElements,PS_TYPE_F32);
     694        outVec = out->data.F32;
    695695
    696696        for (unsigned int i=0;i<numElements;i++) {
  • trunk/psLib/src/dataManip/psFunctions.c

    r822 r831  
    66 *  @author George Gusciora, MHPCC
    77 *
    8  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-06-01 22:24:55 $
     8 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-06-02 23:29:21 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7575    int i = 0;
    7676
    77     gauss = psVectorAlloc(Npts, PS_TYPE_FLOAT);
     77    gauss = psVectorAlloc(Npts, PS_TYPE_F32);
    7878    gsl_rng_env_setup();
    7979    T = gsl_rng_default;
     
    8181
    8282    for (i = 0; i < Npts; i++) {
    83         gauss->vec.f[i] = mean + gsl_ran_gaussian(r, sigma);
     83        gauss->data.F32[i] = mean + gsl_ran_gaussian(r, sigma);
    8484    }
    8585
  • trunk/psLib/src/dataManip/psMatrix.c

    r824 r831  
    2020 *  @author Ross Harman, MHPCC
    2121 *   
    22  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    23  *  @date $Date: 2004-06-01 22:42:57 $
     22 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     23 *  @date $Date: 2004-06-02 23:29:21 $
    2424 *
    2525 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7070/** Preprocessor macro to generate error a NULL image */
    7171#define PS_CHECK_NULL_VECTOR(NAME, RETURN)                                                          \
    72 if (NAME == NULL || NAME->vec.v == NULL) {                                                          \
     72if (NAME == NULL || NAME->data.V == NULL) {                                                          \
    7373    psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME);                          \
    7474    return RETURN;                                                                                  \
     
    7878#define PS_CHECK_ALLOC_VECTOR(NAME, SIZE, PS_TYPE)                                                  \
    7979if(NAME == NULL) {                                                                                  \
    80     NAME = psVectorAlloc(PS_TYPE, SIZE);                                                            \
     80    NAME = psVectorAlloc(SIZE, PS_TYPE);                                                            \
    8181}
    8282
     
    173173    perm.size = numCols;
    174174    outPerm->n = numCols;
    175     perm.data = outPerm->vec.v;
     175    perm.data = outPerm->data.V;
    176176    PS_GSL_MATRIX_INITIALIZE(lu, outImage->data.V[0]);
    177177
     
    226226
    227227    perm.size = inPerm->n;
    228     perm.data = inPerm->vec.v;
     228    perm.data = inPerm->data.V;
    229229
    230230    b.size = inVector->n;
    231231    b.stride = 1;
    232     b.data = inVector->vec.v;
     232    b.data = inVector->data.V;
    233233
    234234    x.size = numCols;
    235235    x.stride = 1;
    236     x.data = outVector->vec.v;
     236    x.data = outVector->data.V;
    237237
    238238    // Solve for {x} in equation: {b} = [A]{x}
     
    483483
    484484    colSize = PSELEMTYPE_SIZEOF(inImage->type.type)*inImage->numRows;
    485     memcpy(outVector->vec.v, inImage->data.V[0], colSize);
     485    memcpy(outVector->data.V, inImage->data.V[0], colSize);
    486486
    487487    return outVector;
     
    510510
    511511    colSize = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numRows;
    512     memcpy(outImage->data.V[0], inVector->vec.v, colSize);
     512    memcpy(outImage->data.V[0], inVector->data.V, colSize);
    513513
    514514    return outImage;
  • trunk/psLib/src/dataManip/psStats.c

    r797 r831  
    8686
    8787    newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
    88     newHist->bounds = psVectorAlloc(PS_TYPE_FLOAT, n+1);
     88    newHist->bounds = psVectorAlloc(n+1, PS_TYPE_F32);
    8989    binSize = (upper - lower) / (float) n;
    9090    for (i=0;i<n+1;i++) {
    91         newHist->bounds->vec.f[i] = lower + (binSize * (float) i);
    92     }
    93     newHist->nums =  psVectorAlloc(PS_TYPE_INT32, n);
     91        newHist->bounds->data.F32[i] = lower + (binSize * (float) i);
     92    }
     93    newHist->nums =  psVectorAlloc(n, PS_TYPE_S32);
    9494    newHist->minNum = 0;
    9595    newHist->maxNum = 0;
     
    106106
    107107    newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
    108     newHist->bounds = psVectorAlloc(PS_TYPE_FLOAT, bounds->n);
     108    newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32);
    109109    for (i=0;i<bounds->n;i++) {
    110         newHist->bounds->vec.f[i] = bounds->vec.f[i];
    111     }
    112     newHist->nums = psVectorAlloc(PS_TYPE_INT32, (bounds->n)-1);
     110        newHist->bounds->data.F32[i] = bounds->data.F32[i];
     111    }
     112    newHist->nums = psVectorAlloc((bounds->n)-1, PS_TYPE_S32);
    113113
    114114    newHist->minNum = 0;
     
    152152    for (i=0;i<in->n;i++) {
    153153        // Check if this pixel is masked, and if so, skip it.
    154         if (!(mask->vec.i32[i] & maskVal)) {
     154        if (!(mask->data.S32[i] & maskVal)) {
    155155            // Check if this pixel is below the minimum value, and if so
    156156            // count it, then skip it.
    157             if (in->vec.f[i] < out->bounds->vec.f[0]) {
     157            if (in->data.F32[i] < out->bounds->data.F32[0]) {
    158158                out->minNum++;
    159159
    160160                // Check if this pixel is above the maximum value, and if so
    161161                // count it, then skip it.
    162             } else if (in->vec.f[i] > out->bounds->vec.f[numBins]) {
     162            } else if (in->data.F32[i] > out->bounds->data.F32[numBins]) {
    163163                out->maxNum++;
    164164            } else {
     
    166166                // number is trivial.
    167167                if (out->uniform == true) {
    168                     binSize = out->bounds->vec.f[1] - out->bounds->vec.f[0];
    169 
    170                     binNum = (int) ((in->vec.f[i] - out->bounds->vec.f[0]) /
     168                    binSize = out->bounds->data.F32[1] - out->bounds->data.F32[0];
     169
     170                    binNum = (int) ((in->data.F32[i] - out->bounds->data.F32[0]) /
    171171                                    binSize);
    172                     (out->nums->vec.i32[binNum])++;
     172                    (out->nums->data.S32[binNum])++;
    173173                    // If this is a non-uniform histogram, determining the correct
    174174                    // bin number requires a bit more work.
     
    177177                    // find the correct bin number (bin search, probably)
    178178                    for (j=0;j<(out->bounds->n)-1;j++) {
    179                         if ((out->bounds->vec.i32[j] <= in->vec.f[i]) &&
    180                                 (in->vec.f[i] <= out->bounds->vec.i32[j+1])) {
    181                             (out->nums->vec.i32[j])++;
     179                        if ((out->bounds->data.S32[j] <= in->data.F32[i]) &&
     180                                (in->data.F32[i] <= out->bounds->data.S32[j+1])) {
     181                            (out->nums->data.S32[j])++;
    182182                        }
    183183                    }
     
    198198    for (i=0;i<myVector->n;i++) {
    199199        if (maskVector != NULL)
    200             printf("Element %d is %f (mask is %d)\n", i, myVector->vec.f[i], maskVector->vec.ui8[i]);
     200            printf("Element %d is %f (mask is %d)\n", i, myVector->data.F32[i], maskVector->data.U8[i]);
    201201        else
    202             printf("Element %d is %f\n", i, myVector->vec.f[i]);
     202            printf("Element %d is %f\n", i, myVector->data.F32[i]);
    203203    }
    204204}
     
    234234        if (maskVector != NULL) {
    235235            for (i=0;i<myVector->n;i++) {
    236                 if (!(maskVal & maskVector->vec.ui8[i]) &&
    237                         (rangeMin <= myVector->vec.f[i]) &&
    238                         (myVector->vec.f[i] <= rangeMax)) {
    239                     mean+= myVector->vec.f[i];
     236                if (!(maskVal & maskVector->data.U8[i]) &&
     237                        (rangeMin <= myVector->data.F32[i]) &&
     238                        (myVector->data.F32[i] <= rangeMax)) {
     239                    mean+= myVector->data.F32[i];
    240240                    count++;
    241241                }
     
    244244        } else {
    245245            for (i=0;i<myVector->n;i++) {
    246                 if ((rangeMin <= myVector->vec.f[i]) &&
    247                         (myVector->vec.f[i] <= rangeMax)) {
    248                     mean+= myVector->vec.f[i];
     246                if ((rangeMin <= myVector->data.F32[i]) &&
     247                        (myVector->data.F32[i] <= rangeMax)) {
     248                    mean+= myVector->data.F32[i];
    249249                    count++;
    250250                }
     
    255255        if (maskVector != NULL) {
    256256            for (i=0;i<myVector->n;i++) {
    257                 if (!(maskVal & maskVector->vec.ui8[i])) {
    258                     mean+= myVector->vec.f[i];
     257                if (!(maskVal & maskVector->data.U8[i])) {
     258                    mean+= myVector->data.F32[i];
    259259                    count++;
    260260                }
     
    263263        } else {
    264264            for (i=0;i<myVector->n;i++) {
    265                 mean+= myVector->vec.f[i];
     265                mean+= myVector->data.F32[i];
    266266            }
    267267            mean/= (float) myVector->n;
     
    287287        if (maskVector != NULL) {
    288288            for (i=0;i<myVector->n;i++) {
    289                 if (!(maskVal & maskVector->vec.ui8[i])) {
    290                     if ((myVector->vec.f[i] > max) &&
    291                             (rangeMin <= myVector->vec.f[i]) &&
    292                             (myVector->vec.f[i] <= rangeMax)) {
    293                         max = myVector->vec.f[i];
     289                if (!(maskVal & maskVector->data.U8[i])) {
     290                    if ((myVector->data.F32[i] > max) &&
     291                            (rangeMin <= myVector->data.F32[i]) &&
     292                            (myVector->data.F32[i] <= rangeMax)) {
     293                        max = myVector->data.F32[i];
    294294                    }
    295295                }
     
    297297        } else {
    298298            for (i=0;i<myVector->n;i++) {
    299                 if ((myVector->vec.f[i] > max) &&
    300                         (rangeMin <= myVector->vec.f[i]) &&
    301                         (myVector->vec.f[i] <= rangeMax)) {
    302                     max = myVector->vec.f[i];
     299                if ((myVector->data.F32[i] > max) &&
     300                        (rangeMin <= myVector->data.F32[i]) &&
     301                        (myVector->data.F32[i] <= rangeMax)) {
     302                    max = myVector->data.F32[i];
    303303                }
    304304            }
     
    307307        if (maskVector != NULL) {
    308308            for (i=0;i<myVector->n;i++) {
    309                 if (!(maskVal & maskVector->vec.ui8[i])) {
    310                     if (myVector->vec.f[i] > max) {
    311                         max = myVector->vec.f[i];
     309                if (!(maskVal & maskVector->data.U8[i])) {
     310                    if (myVector->data.F32[i] > max) {
     311                        max = myVector->data.F32[i];
    312312                    }
    313313                }
     
    315315        } else {
    316316            for (i=0;i<myVector->n;i++) {
    317                 if (myVector->vec.f[i] > max) {
    318                     max = myVector->vec.f[i];
     317                if (myVector->data.F32[i] > max) {
     318                    max = myVector->data.F32[i];
    319319                }
    320320            }
     
    340340        if (maskVector != NULL) {
    341341            for (i=0;i<myVector->n;i++) {
    342                 if (!(maskVal & maskVector->vec.ui8[i])) {
    343                     if ((myVector->vec.f[i] < min) &&
    344                             (rangeMin <= myVector->vec.f[i]) &&
    345                             (myVector->vec.f[i] <= rangeMax)) {
    346                         min = myVector->vec.f[i];
     342                if (!(maskVal & maskVector->data.U8[i])) {
     343                    if ((myVector->data.F32[i] < min) &&
     344                            (rangeMin <= myVector->data.F32[i]) &&
     345                            (myVector->data.F32[i] <= rangeMax)) {
     346                        min = myVector->data.F32[i];
    347347                    }
    348348                }
     
    350350        } else {
    351351            for (i=0;i<myVector->n;i++) {
    352                 if ((myVector->vec.f[i] < min) &&
    353                         (rangeMin <= myVector->vec.f[i]) &&
    354                         (myVector->vec.f[i] <= rangeMax)) {
    355                     min = myVector->vec.f[i];
     352                if ((myVector->data.F32[i] < min) &&
     353                        (rangeMin <= myVector->data.F32[i]) &&
     354                        (myVector->data.F32[i] <= rangeMax)) {
     355                    min = myVector->data.F32[i];
    356356                }
    357357            }
     
    360360        if (maskVector != NULL) {
    361361            for (i=0;i<myVector->n;i++) {
    362                 if (!(maskVal & maskVector->vec.ui8[i])) {
    363                     if (myVector->vec.f[i] < min) {
    364                         min = myVector->vec.f[i];
     362                if (!(maskVal & maskVector->data.U8[i])) {
     363                    if (myVector->data.F32[i] < min) {
     364                        min = myVector->data.F32[i];
    365365                    }
    366366                }
     
    368368        } else {
    369369            for (i=0;i<myVector->n;i++) {
    370                 if (myVector->vec.f[i] < min) {
    371                     min = myVector->vec.f[i];
     370                if (myVector->data.F32[i] < min) {
     371                    min = myVector->data.F32[i];
    372372                }
    373373            }
     
    397397        if (maskVector != NULL) {
    398398            for (i=0;i<myVector->n;i++) {
    399                 if (!(maskVal & maskVector->vec.ui8[i]) &&
    400                         (rangeMin <= myVector->vec.f[i]) &&
    401                         (myVector->vec.f[i] <= rangeMax)) {
     399                if (!(maskVal & maskVector->data.U8[i]) &&
     400                        (rangeMin <= myVector->data.F32[i]) &&
     401                        (myVector->data.F32[i] <= rangeMax)) {
    402402                    numData++;
    403403                }
     
    405405        } else {
    406406            for (i=0;i<myVector->n;i++) {
    407                 if ((rangeMin <= myVector->vec.f[i]) &&
    408                         (myVector->vec.f[i] <= rangeMax)) {
     407                if ((rangeMin <= myVector->data.F32[i]) &&
     408                        (myVector->data.F32[i] <= rangeMax)) {
    409409                    numData++;
    410410                }
     
    416416        if (maskVector != NULL) {
    417417            for (i=0;i<myVector->n;i++) {
    418                 if (!(maskVal & maskVector->vec.ui8[i])) {
     418                if (!(maskVal & maskVector->data.U8[i])) {
    419419                    numData++;
    420420                }
     
    469469
    470470    // Allocate temporary vectors for the data.
    471     unsortedVector = psVectorAlloc(PS_TYPE_FLOAT, nValues);
     471    unsortedVector = psVectorAlloc(nValues, PS_TYPE_F32);
    472472    unsortedVector->n = unsortedVector->nalloc;
    473     sortedVector   = psVectorAlloc(PS_TYPE_FLOAT, nValues);
     473    sortedVector   = psVectorAlloc(nValues, PS_TYPE_F32);
    474474    sortedVector->n = sortedVector->nalloc;
    475475
     
    484484        if (maskVector != NULL) {
    485485            for (i=0;i<myVector->n;i++) {
    486                 if (!(maskVal & maskVector->vec.ui8[i]) &&
    487                         (rangeMin <= myVector->vec.f[i]) &&
    488                         (myVector->vec.f[i] <= rangeMax)) {
    489                     unsortedVector->vec.f[count++] = maskVector->vec.f[i];
    490                 }
    491             }
    492         } else {
    493             for (i=0;i<myVector->n;i++) {
    494                 if ((rangeMin <= myVector->vec.f[i]) &&
    495                         (myVector->vec.f[i] <= rangeMax)) {
    496                     unsortedVector->vec.f[count++] = maskVector->vec.f[i];
     486                if (!(maskVal & maskVector->data.U8[i]) &&
     487                        (rangeMin <= myVector->data.F32[i]) &&
     488                        (myVector->data.F32[i] <= rangeMax)) {
     489                    unsortedVector->data.F32[count++] = maskVector->data.F32[i];
     490                }
     491            }
     492        } else {
     493            for (i=0;i<myVector->n;i++) {
     494                if ((rangeMin <= myVector->data.F32[i]) &&
     495                        (myVector->data.F32[i] <= rangeMax)) {
     496                    unsortedVector->data.F32[count++] = maskVector->data.F32[i];
    497497                }
    498498            }
     
    503503        if (maskVector != NULL) {
    504504            for (i=0;i<myVector->n;i++) {
    505                 if (!(maskVal & maskVector->vec.ui8[i])) {
    506                     unsortedVector->vec.f[count++] = maskVector->vec.f[i];
    507                 }
    508             }
    509         } else {
    510             for (i=0;i<myVector->n;i++) {
    511                 unsortedVector->vec.f[i] = maskVector->vec.f[i];
     505                if (!(maskVal & maskVector->data.U8[i])) {
     506                    unsortedVector->data.F32[count++] = maskVector->data.F32[i];
     507                }
     508            }
     509        } else {
     510            for (i=0;i<myVector->n;i++) {
     511                unsortedVector->data.F32[i] = maskVector->data.F32[i];
    512512            }
    513513        }
     
    518518    // Calculate the median exactly.
    519519    if (0 == (nValues % 2)) {
    520         stats->sampleMedian = 0.5 * (sortedVector->vec.f[(nValues/2)-1] +
    521                                      sortedVector->vec.f[nValues/2]);
     520        stats->sampleMedian = 0.5 * (sortedVector->data.F32[(nValues/2)-1] +
     521                                     sortedVector->data.F32[nValues/2]);
    522522    } else {
    523         stats->sampleMedian = sortedVector->vec.f[nValues/2];
     523        stats->sampleMedian = sortedVector->data.F32[nValues/2];
    524524    }
    525525
     
    569569        for (j=-GAUSS_WIDTH;j<=+GAUSS_WIDTH;j++) {
    570570            if (((j+i) >= 0) && ((j+i) < robustHistogram->nums->n)) {
    571                 robustHistogram->nums->vec.i32[j+i]+=
     571                robustHistogram->nums->data.S32[j+i]+=
    572572                    (gaussianCoefs[j+GAUSS_WIDTH] *
    573                      (float) robustHistogram->nums->vec.i32[j+i]);
     573                     (float) robustHistogram->nums->data.S32[j+i]);
    574574            }
    575575        }
     
    623623
    624624    // Allocate temporary vectors for the data.
    625     unsortedVector = psVectorAlloc(PS_TYPE_FLOAT, nValues);
     625    unsortedVector = psVectorAlloc(nValues, PS_TYPE_F32);
    626626    unsortedVector->n = unsortedVector->nalloc;
    627     sortedVector   = psVectorAlloc(PS_TYPE_FLOAT, nValues);
     627    sortedVector   = psVectorAlloc(nValues, PS_TYPE_F32);
    628628    sortedVector->n = sortedVector->nalloc;
    629629
     
    637637        if (maskVector != NULL) {
    638638            for (i=0;i<myVector->n;i++) {
    639                 if (!(maskVal & maskVector->vec.ui8[i]) &&
    640                         (rangeMin <= myVector->vec.f[i]) &&
    641                         (myVector->vec.f[i] <= rangeMax)) {
    642                     unsortedVector->vec.f[count++] = maskVector->vec.f[i];
    643                 }
    644             }
    645         } else {
    646             for (i=0;i<myVector->n;i++) {
    647                 if ((rangeMin <= myVector->vec.f[i]) &&
    648                         (myVector->vec.f[i] <= rangeMax)) {
    649                     unsortedVector->vec.f[count++] = maskVector->vec.f[i];
     639                if (!(maskVal & maskVector->data.U8[i]) &&
     640                        (rangeMin <= myVector->data.F32[i]) &&
     641                        (myVector->data.F32[i] <= rangeMax)) {
     642                    unsortedVector->data.F32[count++] = maskVector->data.F32[i];
     643                }
     644            }
     645        } else {
     646            for (i=0;i<myVector->n;i++) {
     647                if ((rangeMin <= myVector->data.F32[i]) &&
     648                        (myVector->data.F32[i] <= rangeMax)) {
     649                    unsortedVector->data.F32[count++] = maskVector->data.F32[i];
    650650                }
    651651            }
     
    656656        if (maskVector != NULL) {
    657657            for (i=0;i<myVector->n;i++) {
    658                 if (!(maskVal & maskVector->vec.ui8[i])) {
    659                     unsortedVector->vec.f[count++] = maskVector->vec.f[i];
    660                 }
    661             }
    662         } else {
    663             for (i=0;i<myVector->n;i++) {
    664                 unsortedVector->vec.f[i] = maskVector->vec.f[i];
     658                if (!(maskVal & maskVector->data.U8[i])) {
     659                    unsortedVector->data.F32[count++] = maskVector->data.F32[i];
     660                }
     661            }
     662        } else {
     663            for (i=0;i<myVector->n;i++) {
     664                unsortedVector->data.F32[i] = maskVector->data.F32[i];
    665665            }
    666666        }
     
    672672    // Calculate the quartile points exactly.
    673673    ind = 3 * (nValues / 4);
    674     stats->sampleUQ = sortedVector->vec.f[ind];
     674    stats->sampleUQ = sortedVector->data.F32[ind];
    675675    ind = (nValues / 4);
    676     stats->sampleLQ = sortedVector->vec.f[ind];
     676    stats->sampleLQ = sortedVector->data.F32[ind];
    677677
    678678    // Free the temporary data structures.
     
    765765    UQBinNum = -1;
    766766    for (i=0;i<robustHistogram->nums->n;i++) {
    767         if ((robustHistogram->nums->vec.i32[i] <= stats->sampleLQ) &&
    768                 (stats->sampleLQ <= robustHistogram->nums->vec.i32[i])) {
     767        if ((robustHistogram->nums->data.S32[i] <= stats->sampleLQ) &&
     768                (stats->sampleLQ <= robustHistogram->nums->data.S32[i])) {
    769769            LQBinNum = i;
    770770        }
    771771
    772         if ((robustHistogram->nums->vec.i32[i] <= stats->sampleUQ) &&
    773                 (stats->sampleUQ <= robustHistogram->nums->vec.i32[i])) {
     772        if ((robustHistogram->nums->data.S32[i] <= stats->sampleUQ) &&
     773                (stats->sampleUQ <= robustHistogram->nums->data.S32[i])) {
    774774            UQBinNum = i;
    775775        }
     
    778778    // Determine the bin with the peak value in the range LQ to UQ.
    779779    maxBinNum = LQBinNum;
    780     maxBinCount = robustHistogram->nums->vec.i32[maxBinNum];
     780    maxBinCount = robustHistogram->nums->data.S32[maxBinNum];
    781781    for (i=LQBinNum;i<=UQBinNum;i++) {
    782         if (robustHistogram->nums->vec.i32[i] > maxBinCount) {
     782        if (robustHistogram->nums->data.S32[i] > maxBinCount) {
    783783            maxBinNum = i;
    784             maxBinCount = robustHistogram->nums->vec.i32[i];
     784            maxBinCount = robustHistogram->nums->data.S32[i];
    785785        }
    786786    }
     
    843843        if (maskVector != NULL) {
    844844            for (i=0;i<myVector->n;i++) {
    845                 if (!(maskVal & maskVector->vec.ui8[i]) &&
    846                         (rangeMin <= myVector->vec.f[i]) &&
    847                         (myVector->vec.f[i] <= rangeMax)) {
    848                     diff = myVector->vec.f[i] - mean;
     845                if (!(maskVal & maskVector->data.U8[i]) &&
     846                        (rangeMin <= myVector->data.F32[i]) &&
     847                        (myVector->data.F32[i] <= rangeMax)) {
     848                    diff = myVector->data.F32[i] - mean;
    849849                    sumSquares+= (diff * diff);
    850850                    sumDiffs+= diff;
     
    854854        } else {
    855855            for (i=0;i<myVector->n;i++) {
    856                 if ((rangeMin <= myVector->vec.f[i]) &&
    857                         (myVector->vec.f[i] <= rangeMax)) {
    858                     diff = myVector->vec.f[i] - mean;
     856                if ((rangeMin <= myVector->data.F32[i]) &&
     857                        (myVector->data.F32[i] <= rangeMax)) {
     858                    diff = myVector->data.F32[i] - mean;
    859859                    sumSquares+= (diff * diff);
    860860                    sumDiffs+= diff;
     
    867867        if (maskVector != NULL) {
    868868            for (i=0;i<myVector->n;i++) {
    869                 if (!(maskVal & maskVector->vec.ui8[i])) {
    870                     diff = myVector->vec.f[i] - mean;
     869                if (!(maskVal & maskVector->data.U8[i])) {
     870                    diff = myVector->data.F32[i] - mean;
    871871                    sumSquares+= (diff * diff);
    872872                    sumDiffs+= diff;
     
    876876        } else {
    877877            for (i=0;i<myVector->n;i++) {
    878                 diff = myVector->vec.f[i] - mean;
     878                diff = myVector->data.F32[i] - mean;
    879879                sumSquares+= (diff * diff);
    880880                sumDiffs+= diff;
     
    920920    }
    921921
    922     tmpMask = psVectorAlloc(maskVector->type.type, myVector->nalloc);
     922    tmpMask = psVectorAlloc(myVector->nalloc, maskVector->type.type);
    923923
    924924    tmpMask->n = maskVector->n;
    925925    for (i=0;i<tmpMask->n;i++) {
    926         tmpMask->vec.ui8[i] = maskVector->vec.ui8[i];
     926        tmpMask->data.U8[i] = maskVector->data.U8[i];
    927927    }
    928928
     
    944944        for (j=0;j<myVector->n;j++) {
    945945            // a) Exclude all values x_i for which |x_i - x| > K * stdev
    946             if ( fabs(myVector->vec.f[j] - clippedMean) >
     946            if ( fabs(myVector->data.F32[j] - clippedMean) >
    947947                    (stats->clipSigma * clippedStdev)) {
    948                 tmpMask->vec.ui8[i] = 0xff;
     948                tmpMask->data.U8[i] = 0xff;
    949949            }
    950950            // b) compute new mean and stdev
     
    979979 
    980980    NOTE: The current strategy is to implement everything assuming that all
    981     input data is of type PS_TYPE_FLOAT.  Once the basic code is in place,
    982     we will macro-ize everything and add PS_TYPE_UINT16 and PS_TYPE_DOUBLE.
     981    input data is of type PS_TYPE_F32.  Once the basic code is in place,
     982    we will macro-ize everything and add PS_TYPE_U16 and PS_TYPE_F64.
    983983 
    984984 *****************************************************************************/
     
    992992    }
    993993
    994     if (in->type.type != PS_TYPE_FLOAT) {
     994    if (in->type.type != PS_TYPE_F32) {
    995995        psAbort(__func__,
    996                 "Only data type PS_TYPE_FLOAT is currently supported.");
     996                "Only data type PS_TYPE_F32 is currently supported.");
    997997    }
    998998    if (mask != NULL) {
     
    10011001                    "Vector data and vector mask are of different sizes.");
    10021002        }
    1003         if (mask->type.type != PS_TYPE_UINT8) {
     1003        if (mask->type.type != PS_TYPE_U8) {
    10041004            psAbort(__func__,
    1005                     "Vector mask must be type PS_TYPE_UINT8");
     1005                    "Vector mask must be type PS_TYPE_U8");
    10061006        }
    10071007    }
  • trunk/psLib/src/dataManip/psVectorFFT.c

    r827 r831  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-06-02 03:02:48 $
     7 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-06-02 23:29:21 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    448448    numElements = in->n;
    449449
    450     out = psVectorRecycle(out,PS_TYPE_C32,numElements);
     450    out = psVectorRecycle(out, numElements, PS_TYPE_C32);
    451451
    452452    if (type == PS_TYPE_F32) {
    453453        // need to convert to complex
    454         psC32* outVec = out->vec.cf;
    455         psF32* inVec = in->vec.f;
     454        psC32* outVec = out->data.C32;
     455        psF32* inVec = in->data.F32;
    456456        for (unsigned int i=0;i<numElements;i++) {
    457457            outVec[i] = inVec[i];
    458458        }
    459459    } else {
    460         psC32* outVec = out->vec.cf;
    461         psC32* inVec = in->vec.cf;
     460        psC32* outVec = out->data.C32;
     461        psC32* inVec = in->data.C32;
    462462        for (unsigned int i=0;i<numElements;i++) {
    463463            outVec[i] = inVec[i];
     
    466466
    467467    plan = fftwf_plan_dft_1d(numElements,
    468                              (fftwf_complex*)out->vec.cf,
    469                              (fftwf_complex*)out->vec.cf,
     468                             (fftwf_complex*)out->data.C32,
     469                             (fftwf_complex*)out->data.C32,
    470470                             direction,
    471471                             P_FFTW_PLAN_RIGOR);
     
    504504        psLogMsg(__func__,PS_LOG_WARN,"Real portion of a non-Complex type called called for. "
    505505                 "Just a vector copy was performed.");
    506         out = psVectorRecycle(out,type,numElements);
    507         memcpy(out->vec.v,in->vec.v,numElements*PSELEMTYPE_SIZEOF(type));
     506        out = psVectorRecycle(out,numElements,type);
     507        memcpy(out->data.V,in->data.V,numElements*PSELEMTYPE_SIZEOF(type));
    508508        return out;
    509509    }
     
    511511    if (type == PS_TYPE_C32) {
    512512        psF32* outVec;
    513         psC32* inVec = in->vec.cf;
    514 
    515         out = psVectorRecycle(out,PS_TYPE_F32,numElements);
    516         outVec = out->vec.f;
     513        psC32* inVec = in->data.C32;
     514
     515        out = psVectorRecycle(out,numElements,PS_TYPE_F32);
     516        outVec = out->data.F32;
    517517
    518518        for (unsigned int i=0;i<numElements;i++) {
     
    548548                 "A zeroed vector was returned.");
    549549        out = psVectorRecycle(out,numElements,type);
    550         memset(out->vec.v,0,PSELEMTYPE_SIZEOF(type)*numElements);
     550        memset(out->data.V,0,PSELEMTYPE_SIZEOF(type)*numElements);
    551551        return out;
    552552    }
     
    554554    if (type == PS_TYPE_C32) {
    555555        psF32* outVec;
    556         psC32* inVec = in->vec.cf;
    557 
    558         out = psVectorRecycle(out,PS_TYPE_F32,numElements);
    559         outVec = out->vec.f;
     556        psC32* inVec = in->data.C32;
     557
     558        out = psVectorRecycle(out,numElements, PS_TYPE_F32);
     559        outVec = out->data.F32;
    560560
    561561        for (unsigned int i=0;i<numElements;i++) {
     
    601601    if (type == PS_TYPE_F32) {
    602602        psC32* outVec;
    603         psF32* realVec = real->vec.f;
    604         psF32* imagVec = imag->vec.f;
    605 
    606         out = psVectorRecycle(out,PS_TYPE_C32,numElements);
    607         outVec = out->vec.cf;
     603        psF32* realVec = real->data.F32;
     604        psF32* imagVec = imag->data.F32;
     605
     606        out = psVectorRecycle(out,numElements, PS_TYPE_C32);
     607        outVec = out->data.C32;
    608608
    609609        for (unsigned int i=0;i<numElements;i++) {
     
    639639                 "Vector copy was performed instead.");
    640640
    641         out = psVectorRecycle(out,type,numElements);
    642         memcpy(out->vec.v,in->vec.v,PSELEMTYPE_SIZEOF(type)*numElements);
     641        out = psVectorRecycle(out,numElements,type);
     642        memcpy(out->data.V,in->data.V,PSELEMTYPE_SIZEOF(type)*numElements);
    643643        return out;
    644644    }
     
    646646    if (type == PS_TYPE_C32) {
    647647        psC32* outVec;
    648         psC32* inVec = in->vec.cf;
    649 
    650         out = psVectorRecycle(out,PS_TYPE_C32,numElements);
    651         outVec = out->vec.cf;
     648        psC32* inVec = in->data.C32;
     649
     650        out = psVectorRecycle(out,numElements,PS_TYPE_C32);
     651        outVec = out->data.C32;
    652652
    653653        for (unsigned int i=0;i<numElements;i++) {
     
    686686    if (type == PS_TYPE_C32) {
    687687        psF32* outVec;
    688         psC32* inVec = in->vec.cf;
     688        psC32* inVec = in->data.C32;
    689689        psF32 real;
    690690        psF32 imag;
    691691
    692692
    693         out = psVectorRecycle(out,PS_TYPE_F32,numElements);
    694         outVec = out->vec.f;
     693        out = psVectorRecycle(out,numElements,PS_TYPE_F32);
     694        outVec = out->data.F32;
    695695
    696696        for (unsigned int i=0;i<numElements;i++) {
  • trunk/psLib/src/fft/psVectorFFT.c

    r827 r831  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-06-02 03:02:48 $
     7 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-06-02 23:29:21 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    448448    numElements = in->n;
    449449
    450     out = psVectorRecycle(out,PS_TYPE_C32,numElements);
     450    out = psVectorRecycle(out, numElements, PS_TYPE_C32);
    451451
    452452    if (type == PS_TYPE_F32) {
    453453        // need to convert to complex
    454         psC32* outVec = out->vec.cf;
    455         psF32* inVec = in->vec.f;
     454        psC32* outVec = out->data.C32;
     455        psF32* inVec = in->data.F32;
    456456        for (unsigned int i=0;i<numElements;i++) {
    457457            outVec[i] = inVec[i];
    458458        }
    459459    } else {
    460         psC32* outVec = out->vec.cf;
    461         psC32* inVec = in->vec.cf;
     460        psC32* outVec = out->data.C32;
     461        psC32* inVec = in->data.C32;
    462462        for (unsigned int i=0;i<numElements;i++) {
    463463            outVec[i] = inVec[i];
     
    466466
    467467    plan = fftwf_plan_dft_1d(numElements,
    468                              (fftwf_complex*)out->vec.cf,
    469                              (fftwf_complex*)out->vec.cf,
     468                             (fftwf_complex*)out->data.C32,
     469                             (fftwf_complex*)out->data.C32,
    470470                             direction,
    471471                             P_FFTW_PLAN_RIGOR);
     
    504504        psLogMsg(__func__,PS_LOG_WARN,"Real portion of a non-Complex type called called for. "
    505505                 "Just a vector copy was performed.");
    506         out = psVectorRecycle(out,type,numElements);
    507         memcpy(out->vec.v,in->vec.v,numElements*PSELEMTYPE_SIZEOF(type));
     506        out = psVectorRecycle(out,numElements,type);
     507        memcpy(out->data.V,in->data.V,numElements*PSELEMTYPE_SIZEOF(type));
    508508        return out;
    509509    }
     
    511511    if (type == PS_TYPE_C32) {
    512512        psF32* outVec;
    513         psC32* inVec = in->vec.cf;
    514 
    515         out = psVectorRecycle(out,PS_TYPE_F32,numElements);
    516         outVec = out->vec.f;
     513        psC32* inVec = in->data.C32;
     514
     515        out = psVectorRecycle(out,numElements,PS_TYPE_F32);
     516        outVec = out->data.F32;
    517517
    518518        for (unsigned int i=0;i<numElements;i++) {
     
    548548                 "A zeroed vector was returned.");
    549549        out = psVectorRecycle(out,numElements,type);
    550         memset(out->vec.v,0,PSELEMTYPE_SIZEOF(type)*numElements);
     550        memset(out->data.V,0,PSELEMTYPE_SIZEOF(type)*numElements);
    551551        return out;
    552552    }
     
    554554    if (type == PS_TYPE_C32) {
    555555        psF32* outVec;
    556         psC32* inVec = in->vec.cf;
    557 
    558         out = psVectorRecycle(out,PS_TYPE_F32,numElements);
    559         outVec = out->vec.f;
     556        psC32* inVec = in->data.C32;
     557
     558        out = psVectorRecycle(out,numElements, PS_TYPE_F32);
     559        outVec = out->data.F32;
    560560
    561561        for (unsigned int i=0;i<numElements;i++) {
     
    601601    if (type == PS_TYPE_F32) {
    602602        psC32* outVec;
    603         psF32* realVec = real->vec.f;
    604         psF32* imagVec = imag->vec.f;
    605 
    606         out = psVectorRecycle(out,PS_TYPE_C32,numElements);
    607         outVec = out->vec.cf;
     603        psF32* realVec = real->data.F32;
     604        psF32* imagVec = imag->data.F32;
     605
     606        out = psVectorRecycle(out,numElements, PS_TYPE_C32);
     607        outVec = out->data.C32;
    608608
    609609        for (unsigned int i=0;i<numElements;i++) {
     
    639639                 "Vector copy was performed instead.");
    640640
    641         out = psVectorRecycle(out,type,numElements);
    642         memcpy(out->vec.v,in->vec.v,PSELEMTYPE_SIZEOF(type)*numElements);
     641        out = psVectorRecycle(out,numElements,type);
     642        memcpy(out->data.V,in->data.V,PSELEMTYPE_SIZEOF(type)*numElements);
    643643        return out;
    644644    }
     
    646646    if (type == PS_TYPE_C32) {
    647647        psC32* outVec;
    648         psC32* inVec = in->vec.cf;
    649 
    650         out = psVectorRecycle(out,PS_TYPE_C32,numElements);
    651         outVec = out->vec.cf;
     648        psC32* inVec = in->data.C32;
     649
     650        out = psVectorRecycle(out,numElements,PS_TYPE_C32);
     651        outVec = out->data.C32;
    652652
    653653        for (unsigned int i=0;i<numElements;i++) {
     
    686686    if (type == PS_TYPE_C32) {
    687687        psF32* outVec;
    688         psC32* inVec = in->vec.cf;
     688        psC32* inVec = in->data.C32;
    689689        psF32 real;
    690690        psF32 imag;
    691691
    692692
    693         out = psVectorRecycle(out,PS_TYPE_F32,numElements);
    694         outVec = out->vec.f;
     693        out = psVectorRecycle(out,numElements,PS_TYPE_F32);
     694        outVec = out->data.F32;
    695695
    696696        for (unsigned int i=0;i<numElements;i++) {
  • trunk/psLib/src/image/psImage.h

    r824 r831  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-06-01 22:42:57 $
     11 *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-06-02 23:29:14 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4646
    4747    union {
    48         psU8    **U8;                   ///< unsigned 8-bit integer data.
    49         psU16   **U16;                  ///< unsigned 16-bit integer data.
    50         psU32   **U32;                  ///< unsigned 32-bit integer data.
    51         psU64   **U64;                  ///< unsigned 64-bit integer data.
    52         psS8    **S8;                   ///< signed 8-bit integer data.
    53         psS16   **S16;                  ///< signed 16-bit integer data.
    54         psS32   **S32;                  ///< signed 32-bit integer data.
    55         psS64   **S64;                  ///< signed 64-bit integer data.
    56         psF32   **F32;                  ///< single-precision float data.
    57         psF64   **F64;                  ///< double-precision float data.
    58         psC32   **C32;                  ///< single-precision complex data.
    59         psC64   **C64;                  ///< double-precision complex data.
    60         psPTR   **PTR;                  ///< void pointers
    61         void    **V;                    ///< pointer to data
     48        psU8    **U8;                   ///< Unsigned 8-bit integer data.
     49        psU16   **U16;                  ///< Unsigned 16-bit integer data.
     50        psU32   **U32;                  ///< Unsigned 32-bit integer data.
     51        psU64   **U64;                  ///< Unsigned 64-bit integer data.
     52        psS8    **S8;                   ///< Signed 8-bit integer data.
     53        psS16   **S16;                  ///< Signed 16-bit integer data.
     54        psS32   **S32;                  ///< Signed 32-bit integer data.
     55        psS64   **S64;                  ///< Signed 64-bit integer data.
     56        psF32   **F32;                  ///< Single-precision float data.
     57        psF64   **F64;                  ///< Double-precision float data.
     58        psC32   **C32;                  ///< Single-precision complex data.
     59        psC64   **C64;                  ///< Double-precision complex data.
     60        psPTR   **PTR;                  ///< Void pointers.
     61        psPTR    *V;                    ///< Pointer to data.
    6262    } data;                             ///< Union for data types.
    6363    const struct psImage *parent;       ///< Parent, if a subimage.
  • trunk/psLib/src/image/psImageStats.c

    r797 r831  
    3131
    3232    // GUS: figure out mask types
    33     junkData->vec.f = (float *) in->data.F32;
    34     junkMask->vec.f = (float *) mask->data.F32;
     33    junkData->data.F32 = (float *) in->data.F32;
     34    junkMask->data.F32 = (float *) mask->data.F32;
    3535    stats = psVectorStats(stats, junkData, junkMask, maskVal);
    3636
     
    5757
    5858    // GUS: figure out mask types
    59     junkData->vec.f = (float *) in->data.F32;
    60     junkMask->vec.f = (float *) mask->data.F32;
     59    junkData->data.F32 = (float *) in->data.F32;
     60    junkMask->data.F32 = (float *) mask->data.F32;
    6161
    6262    out = psHistogramVector(out, junkData, junkMask, maskVal);
  • trunk/psLib/src/imageops/psImageStats.c

    r797 r831  
    3131
    3232    // GUS: figure out mask types
    33     junkData->vec.f = (float *) in->data.F32;
    34     junkMask->vec.f = (float *) mask->data.F32;
     33    junkData->data.F32 = (float *) in->data.F32;
     34    junkMask->data.F32 = (float *) mask->data.F32;
    3535    stats = psVectorStats(stats, junkData, junkMask, maskVal);
    3636
     
    5757
    5858    // GUS: figure out mask types
    59     junkData->vec.f = (float *) in->data.F32;
    60     junkMask->vec.f = (float *) mask->data.F32;
     59    junkData->data.F32 = (float *) in->data.F32;
     60    junkMask->data.F32 = (float *) mask->data.F32;
    6161
    6262    out = psHistogramVector(out, junkData, junkMask, maskVal);
  • trunk/psLib/src/math/psMatrix.c

    r824 r831  
    2020 *  @author Ross Harman, MHPCC
    2121 *   
    22  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    23  *  @date $Date: 2004-06-01 22:42:57 $
     22 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     23 *  @date $Date: 2004-06-02 23:29:21 $
    2424 *
    2525 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7070/** Preprocessor macro to generate error a NULL image */
    7171#define PS_CHECK_NULL_VECTOR(NAME, RETURN)                                                          \
    72 if (NAME == NULL || NAME->vec.v == NULL) {                                                          \
     72if (NAME == NULL || NAME->data.V == NULL) {                                                          \
    7373    psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME);                          \
    7474    return RETURN;                                                                                  \
     
    7878#define PS_CHECK_ALLOC_VECTOR(NAME, SIZE, PS_TYPE)                                                  \
    7979if(NAME == NULL) {                                                                                  \
    80     NAME = psVectorAlloc(PS_TYPE, SIZE);                                                            \
     80    NAME = psVectorAlloc(SIZE, PS_TYPE);                                                            \
    8181}
    8282
     
    173173    perm.size = numCols;
    174174    outPerm->n = numCols;
    175     perm.data = outPerm->vec.v;
     175    perm.data = outPerm->data.V;
    176176    PS_GSL_MATRIX_INITIALIZE(lu, outImage->data.V[0]);
    177177
     
    226226
    227227    perm.size = inPerm->n;
    228     perm.data = inPerm->vec.v;
     228    perm.data = inPerm->data.V;
    229229
    230230    b.size = inVector->n;
    231231    b.stride = 1;
    232     b.data = inVector->vec.v;
     232    b.data = inVector->data.V;
    233233
    234234    x.size = numCols;
    235235    x.stride = 1;
    236     x.data = outVector->vec.v;
     236    x.data = outVector->data.V;
    237237
    238238    // Solve for {x} in equation: {b} = [A]{x}
     
    483483
    484484    colSize = PSELEMTYPE_SIZEOF(inImage->type.type)*inImage->numRows;
    485     memcpy(outVector->vec.v, inImage->data.V[0], colSize);
     485    memcpy(outVector->data.V, inImage->data.V[0], colSize);
    486486
    487487    return outVector;
     
    510510
    511511    colSize = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numRows;
    512     memcpy(outImage->data.V[0], inVector->vec.v, colSize);
     512    memcpy(outImage->data.V[0], inVector->data.V, colSize);
    513513
    514514    return outImage;
  • trunk/psLib/src/math/psPolynomial.c

    r822 r831  
    66 *  @author George Gusciora, MHPCC
    77 *
    8  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-06-01 22:24:55 $
     8 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-06-02 23:29:21 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7575    int i = 0;
    7676
    77     gauss = psVectorAlloc(Npts, PS_TYPE_FLOAT);
     77    gauss = psVectorAlloc(Npts, PS_TYPE_F32);
    7878    gsl_rng_env_setup();
    7979    T = gsl_rng_default;
     
    8181
    8282    for (i = 0; i < Npts; i++) {
    83         gauss->vec.f[i] = mean + gsl_ran_gaussian(r, sigma);
     83        gauss->data.F32[i] = mean + gsl_ran_gaussian(r, sigma);
    8484    }
    8585
  • trunk/psLib/src/math/psSpline.c

    r822 r831  
    66 *  @author George Gusciora, MHPCC
    77 *
    8  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-06-01 22:24:55 $
     8 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-06-02 23:29:21 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7575    int i = 0;
    7676
    77     gauss = psVectorAlloc(Npts, PS_TYPE_FLOAT);
     77    gauss = psVectorAlloc(Npts, PS_TYPE_F32);
    7878    gsl_rng_env_setup();
    7979    T = gsl_rng_default;
     
    8181
    8282    for (i = 0; i < Npts; i++) {
    83         gauss->vec.f[i] = mean + gsl_ran_gaussian(r, sigma);
     83        gauss->data.F32[i] = mean + gsl_ran_gaussian(r, sigma);
    8484    }
    8585
  • trunk/psLib/src/math/psStats.c

    r797 r831  
    8686
    8787    newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
    88     newHist->bounds = psVectorAlloc(PS_TYPE_FLOAT, n+1);
     88    newHist->bounds = psVectorAlloc(n+1, PS_TYPE_F32);
    8989    binSize = (upper - lower) / (float) n;
    9090    for (i=0;i<n+1;i++) {
    91         newHist->bounds->vec.f[i] = lower + (binSize * (float) i);
    92     }
    93     newHist->nums =  psVectorAlloc(PS_TYPE_INT32, n);
     91        newHist->bounds->data.F32[i] = lower + (binSize * (float) i);
     92    }
     93    newHist->nums =  psVectorAlloc(n, PS_TYPE_S32);
    9494    newHist->minNum = 0;
    9595    newHist->maxNum = 0;
     
    106106
    107107    newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
    108     newHist->bounds = psVectorAlloc(PS_TYPE_FLOAT, bounds->n);
     108    newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32);
    109109    for (i=0;i<bounds->n;i++) {
    110         newHist->bounds->vec.f[i] = bounds->vec.f[i];
    111     }
    112     newHist->nums = psVectorAlloc(PS_TYPE_INT32, (bounds->n)-1);
     110        newHist->bounds->data.F32[i] = bounds->data.F32[i];
     111    }
     112    newHist->nums = psVectorAlloc((bounds->n)-1, PS_TYPE_S32);
    113113
    114114    newHist->minNum = 0;
     
    152152    for (i=0;i<in->n;i++) {
    153153        // Check if this pixel is masked, and if so, skip it.
    154         if (!(mask->vec.i32[i] & maskVal)) {
     154        if (!(mask->data.S32[i] & maskVal)) {
    155155            // Check if this pixel is below the minimum value, and if so
    156156            // count it, then skip it.
    157             if (in->vec.f[i] < out->bounds->vec.f[0]) {
     157            if (in->data.F32[i] < out->bounds->data.F32[0]) {
    158158                out->minNum++;
    159159
    160160                // Check if this pixel is above the maximum value, and if so
    161161                // count it, then skip it.
    162             } else if (in->vec.f[i] > out->bounds->vec.f[numBins]) {
     162            } else if (in->data.F32[i] > out->bounds->data.F32[numBins]) {
    163163                out->maxNum++;
    164164            } else {
     
    166166                // number is trivial.
    167167                if (out->uniform == true) {
    168                     binSize = out->bounds->vec.f[1] - out->bounds->vec.f[0];
    169 
    170                     binNum = (int) ((in->vec.f[i] - out->bounds->vec.f[0]) /
     168                    binSize = out->bounds->data.F32[1] - out->bounds->data.F32[0];
     169
     170                    binNum = (int) ((in->data.F32[i] - out->bounds->data.F32[0]) /
    171171                                    binSize);
    172                     (out->nums->vec.i32[binNum])++;
     172                    (out->nums->data.S32[binNum])++;
    173173                    // If this is a non-uniform histogram, determining the correct
    174174                    // bin number requires a bit more work.
     
    177177                    // find the correct bin number (bin search, probably)
    178178                    for (j=0;j<(out->bounds->n)-1;j++) {
    179                         if ((out->bounds->vec.i32[j] <= in->vec.f[i]) &&
    180                                 (in->vec.f[i] <= out->bounds->vec.i32[j+1])) {
    181                             (out->nums->vec.i32[j])++;
     179                        if ((out->bounds->data.S32[j] <= in->data.F32[i]) &&
     180                                (in->data.F32[i] <= out->bounds->data.S32[j+1])) {
     181                            (out->nums->data.S32[j])++;
    182182                        }
    183183                    }
     
    198198    for (i=0;i<myVector->n;i++) {
    199199        if (maskVector != NULL)
    200             printf("Element %d is %f (mask is %d)\n", i, myVector->vec.f[i], maskVector->vec.ui8[i]);
     200            printf("Element %d is %f (mask is %d)\n", i, myVector->data.F32[i], maskVector->data.U8[i]);
    201201        else
    202             printf("Element %d is %f\n", i, myVector->vec.f[i]);
     202            printf("Element %d is %f\n", i, myVector->data.F32[i]);
    203203    }
    204204}
     
    234234        if (maskVector != NULL) {
    235235            for (i=0;i<myVector->n;i++) {
    236                 if (!(maskVal & maskVector->vec.ui8[i]) &&
    237                         (rangeMin <= myVector->vec.f[i]) &&
    238                         (myVector->vec.f[i] <= rangeMax)) {
    239                     mean+= myVector->vec.f[i];
     236                if (!(maskVal & maskVector->data.U8[i]) &&
     237                        (rangeMin <= myVector->data.F32[i]) &&
     238                        (myVector->data.F32[i] <= rangeMax)) {
     239                    mean+= myVector->data.F32[i];
    240240                    count++;
    241241                }
     
    244244        } else {
    245245            for (i=0;i<myVector->n;i++) {
    246                 if ((rangeMin <= myVector->vec.f[i]) &&
    247                         (myVector->vec.f[i] <= rangeMax)) {
    248                     mean+= myVector->vec.f[i];
     246                if ((rangeMin <= myVector->data.F32[i]) &&
     247                        (myVector->data.F32[i] <= rangeMax)) {
     248                    mean+= myVector->data.F32[i];
    249249                    count++;
    250250                }
     
    255255        if (maskVector != NULL) {
    256256            for (i=0;i<myVector->n;i++) {
    257                 if (!(maskVal & maskVector->vec.ui8[i])) {
    258                     mean+= myVector->vec.f[i];
     257                if (!(maskVal & maskVector->data.U8[i])) {
     258                    mean+= myVector->data.F32[i];
    259259                    count++;
    260260                }
     
    263263        } else {
    264264            for (i=0;i<myVector->n;i++) {
    265                 mean+= myVector->vec.f[i];
     265                mean+= myVector->data.F32[i];
    266266            }
    267267            mean/= (float) myVector->n;
     
    287287        if (maskVector != NULL) {
    288288            for (i=0;i<myVector->n;i++) {
    289                 if (!(maskVal & maskVector->vec.ui8[i])) {
    290                     if ((myVector->vec.f[i] > max) &&
    291                             (rangeMin <= myVector->vec.f[i]) &&
    292                             (myVector->vec.f[i] <= rangeMax)) {
    293                         max = myVector->vec.f[i];
     289                if (!(maskVal & maskVector->data.U8[i])) {
     290                    if ((myVector->data.F32[i] > max) &&
     291                            (rangeMin <= myVector->data.F32[i]) &&
     292                            (myVector->data.F32[i] <= rangeMax)) {
     293                        max = myVector->data.F32[i];
    294294                    }
    295295                }
     
    297297        } else {
    298298            for (i=0;i<myVector->n;i++) {
    299                 if ((myVector->vec.f[i] > max) &&
    300                         (rangeMin <= myVector->vec.f[i]) &&
    301                         (myVector->vec.f[i] <= rangeMax)) {
    302                     max = myVector->vec.f[i];
     299                if ((myVector->data.F32[i] > max) &&
     300                        (rangeMin <= myVector->data.F32[i]) &&
     301                        (myVector->data.F32[i] <= rangeMax)) {
     302                    max = myVector->data.F32[i];
    303303                }
    304304            }
     
    307307        if (maskVector != NULL) {
    308308            for (i=0;i<myVector->n;i++) {
    309                 if (!(maskVal & maskVector->vec.ui8[i])) {
    310                     if (myVector->vec.f[i] > max) {
    311                         max = myVector->vec.f[i];
     309                if (!(maskVal & maskVector->data.U8[i])) {
     310                    if (myVector->data.F32[i] > max) {
     311                        max = myVector->data.F32[i];
    312312                    }
    313313                }
     
    315315        } else {
    316316            for (i=0;i<myVector->n;i++) {
    317                 if (myVector->vec.f[i] > max) {
    318                     max = myVector->vec.f[i];
     317                if (myVector->data.F32[i] > max) {
     318                    max = myVector->data.F32[i];
    319319                }
    320320            }
     
    340340        if (maskVector != NULL) {
    341341            for (i=0;i<myVector->n;i++) {
    342                 if (!(maskVal & maskVector->vec.ui8[i])) {
    343                     if ((myVector->vec.f[i] < min) &&
    344                             (rangeMin <= myVector->vec.f[i]) &&
    345                             (myVector->vec.f[i] <= rangeMax)) {
    346                         min = myVector->vec.f[i];
     342                if (!(maskVal & maskVector->data.U8[i])) {
     343                    if ((myVector->data.F32[i] < min) &&
     344                            (rangeMin <= myVector->data.F32[i]) &&
     345                            (myVector->data.F32[i] <= rangeMax)) {
     346                        min = myVector->data.F32[i];
    347347                    }
    348348                }
     
    350350        } else {
    351351            for (i=0;i<myVector->n;i++) {
    352                 if ((myVector->vec.f[i] < min) &&
    353                         (rangeMin <= myVector->vec.f[i]) &&
    354                         (myVector->vec.f[i] <= rangeMax)) {
    355                     min = myVector->vec.f[i];
     352                if ((myVector->data.F32[i] < min) &&
     353                        (rangeMin <= myVector->data.F32[i]) &&
     354                        (myVector->data.F32[i] <= rangeMax)) {
     355                    min = myVector->data.F32[i];
    356356                }
    357357            }
     
    360360        if (maskVector != NULL) {
    361361            for (i=0;i<myVector->n;i++) {
    362                 if (!(maskVal & maskVector->vec.ui8[i])) {
    363                     if (myVector->vec.f[i] < min) {
    364                         min = myVector->vec.f[i];
     362                if (!(maskVal & maskVector->data.U8[i])) {
     363                    if (myVector->data.F32[i] < min) {
     364                        min = myVector->data.F32[i];
    365365                    }
    366366                }
     
    368368        } else {
    369369            for (i=0;i<myVector->n;i++) {
    370                 if (myVector->vec.f[i] < min) {
    371                     min = myVector->vec.f[i];
     370                if (myVector->data.F32[i] < min) {
     371                    min = myVector->data.F32[i];
    372372                }
    373373            }
     
    397397        if (maskVector != NULL) {
    398398            for (i=0;i<myVector->n;i++) {
    399                 if (!(maskVal & maskVector->vec.ui8[i]) &&
    400                         (rangeMin <= myVector->vec.f[i]) &&
    401                         (myVector->vec.f[i] <= rangeMax)) {
     399                if (!(maskVal & maskVector->data.U8[i]) &&
     400                        (rangeMin <= myVector->data.F32[i]) &&
     401                        (myVector->data.F32[i] <= rangeMax)) {
    402402                    numData++;
    403403                }
     
    405405        } else {
    406406            for (i=0;i<myVector->n;i++) {
    407                 if ((rangeMin <= myVector->vec.f[i]) &&
    408                         (myVector->vec.f[i] <= rangeMax)) {
     407                if ((rangeMin <= myVector->data.F32[i]) &&
     408                        (myVector->data.F32[i] <= rangeMax)) {
    409409                    numData++;
    410410                }
     
    416416        if (maskVector != NULL) {
    417417            for (i=0;i<myVector->n;i++) {
    418                 if (!(maskVal & maskVector->vec.ui8[i])) {
     418                if (!(maskVal & maskVector->data.U8[i])) {
    419419                    numData++;
    420420                }
     
    469469
    470470    // Allocate temporary vectors for the data.
    471     unsortedVector = psVectorAlloc(PS_TYPE_FLOAT, nValues);
     471    unsortedVector = psVectorAlloc(nValues, PS_TYPE_F32);
    472472    unsortedVector->n = unsortedVector->nalloc;
    473     sortedVector   = psVectorAlloc(PS_TYPE_FLOAT, nValues);
     473    sortedVector   = psVectorAlloc(nValues, PS_TYPE_F32);
    474474    sortedVector->n = sortedVector->nalloc;
    475475
     
    484484        if (maskVector != NULL) {
    485485            for (i=0;i<myVector->n;i++) {
    486                 if (!(maskVal & maskVector->vec.ui8[i]) &&
    487                         (rangeMin <= myVector->vec.f[i]) &&
    488                         (myVector->vec.f[i] <= rangeMax)) {
    489                     unsortedVector->vec.f[count++] = maskVector->vec.f[i];
    490                 }
    491             }
    492         } else {
    493             for (i=0;i<myVector->n;i++) {
    494                 if ((rangeMin <= myVector->vec.f[i]) &&
    495                         (myVector->vec.f[i] <= rangeMax)) {
    496                     unsortedVector->vec.f[count++] = maskVector->vec.f[i];
     486                if (!(maskVal & maskVector->data.U8[i]) &&
     487                        (rangeMin <= myVector->data.F32[i]) &&
     488                        (myVector->data.F32[i] <= rangeMax)) {
     489                    unsortedVector->data.F32[count++] = maskVector->data.F32[i];
     490                }
     491            }
     492        } else {
     493            for (i=0;i<myVector->n;i++) {
     494                if ((rangeMin <= myVector->data.F32[i]) &&
     495                        (myVector->data.F32[i] <= rangeMax)) {
     496                    unsortedVector->data.F32[count++] = maskVector->data.F32[i];
    497497                }
    498498            }
     
    503503        if (maskVector != NULL) {
    504504            for (i=0;i<myVector->n;i++) {
    505                 if (!(maskVal & maskVector->vec.ui8[i])) {
    506                     unsortedVector->vec.f[count++] = maskVector->vec.f[i];
    507                 }
    508             }
    509         } else {
    510             for (i=0;i<myVector->n;i++) {
    511                 unsortedVector->vec.f[i] = maskVector->vec.f[i];
     505                if (!(maskVal & maskVector->data.U8[i])) {
     506                    unsortedVector->data.F32[count++] = maskVector->data.F32[i];
     507                }
     508            }
     509        } else {
     510            for (i=0;i<myVector->n;i++) {
     511                unsortedVector->data.F32[i] = maskVector->data.F32[i];
    512512            }
    513513        }
     
    518518    // Calculate the median exactly.
    519519    if (0 == (nValues % 2)) {
    520         stats->sampleMedian = 0.5 * (sortedVector->vec.f[(nValues/2)-1] +
    521                                      sortedVector->vec.f[nValues/2]);
     520        stats->sampleMedian = 0.5 * (sortedVector->data.F32[(nValues/2)-1] +
     521                                     sortedVector->data.F32[nValues/2]);
    522522    } else {
    523         stats->sampleMedian = sortedVector->vec.f[nValues/2];
     523        stats->sampleMedian = sortedVector->data.F32[nValues/2];
    524524    }
    525525
     
    569569        for (j=-GAUSS_WIDTH;j<=+GAUSS_WIDTH;j++) {
    570570            if (((j+i) >= 0) && ((j+i) < robustHistogram->nums->n)) {
    571                 robustHistogram->nums->vec.i32[j+i]+=
     571                robustHistogram->nums->data.S32[j+i]+=
    572572                    (gaussianCoefs[j+GAUSS_WIDTH] *
    573                      (float) robustHistogram->nums->vec.i32[j+i]);
     573                     (float) robustHistogram->nums->data.S32[j+i]);
    574574            }
    575575        }
     
    623623
    624624    // Allocate temporary vectors for the data.
    625     unsortedVector = psVectorAlloc(PS_TYPE_FLOAT, nValues);
     625    unsortedVector = psVectorAlloc(nValues, PS_TYPE_F32);
    626626    unsortedVector->n = unsortedVector->nalloc;
    627     sortedVector   = psVectorAlloc(PS_TYPE_FLOAT, nValues);
     627    sortedVector   = psVectorAlloc(nValues, PS_TYPE_F32);
    628628    sortedVector->n = sortedVector->nalloc;
    629629
     
    637637        if (maskVector != NULL) {
    638638            for (i=0;i<myVector->n;i++) {
    639                 if (!(maskVal & maskVector->vec.ui8[i]) &&
    640                         (rangeMin <= myVector->vec.f[i]) &&
    641                         (myVector->vec.f[i] <= rangeMax)) {
    642                     unsortedVector->vec.f[count++] = maskVector->vec.f[i];
    643                 }
    644             }
    645         } else {
    646             for (i=0;i<myVector->n;i++) {
    647                 if ((rangeMin <= myVector->vec.f[i]) &&
    648                         (myVector->vec.f[i] <= rangeMax)) {
    649                     unsortedVector->vec.f[count++] = maskVector->vec.f[i];
     639                if (!(maskVal & maskVector->data.U8[i]) &&
     640                        (rangeMin <= myVector->data.F32[i]) &&
     641                        (myVector->data.F32[i] <= rangeMax)) {
     642                    unsortedVector->data.F32[count++] = maskVector->data.F32[i];
     643                }
     644            }
     645        } else {
     646            for (i=0;i<myVector->n;i++) {
     647                if ((rangeMin <= myVector->data.F32[i]) &&
     648                        (myVector->data.F32[i] <= rangeMax)) {
     649                    unsortedVector->data.F32[count++] = maskVector->data.F32[i];
    650650                }
    651651            }
     
    656656        if (maskVector != NULL) {
    657657            for (i=0;i<myVector->n;i++) {
    658                 if (!(maskVal & maskVector->vec.ui8[i])) {
    659                     unsortedVector->vec.f[count++] = maskVector->vec.f[i];
    660                 }
    661             }
    662         } else {
    663             for (i=0;i<myVector->n;i++) {
    664                 unsortedVector->vec.f[i] = maskVector->vec.f[i];
     658                if (!(maskVal & maskVector->data.U8[i])) {
     659                    unsortedVector->data.F32[count++] = maskVector->data.F32[i];
     660                }
     661            }
     662        } else {
     663            for (i=0;i<myVector->n;i++) {
     664                unsortedVector->data.F32[i] = maskVector->data.F32[i];
    665665            }
    666666        }
     
    672672    // Calculate the quartile points exactly.
    673673    ind = 3 * (nValues / 4);
    674     stats->sampleUQ = sortedVector->vec.f[ind];
     674    stats->sampleUQ = sortedVector->data.F32[ind];
    675675    ind = (nValues / 4);
    676     stats->sampleLQ = sortedVector->vec.f[ind];
     676    stats->sampleLQ = sortedVector->data.F32[ind];
    677677
    678678    // Free the temporary data structures.
     
    765765    UQBinNum = -1;
    766766    for (i=0;i<robustHistogram->nums->n;i++) {
    767         if ((robustHistogram->nums->vec.i32[i] <= stats->sampleLQ) &&
    768                 (stats->sampleLQ <= robustHistogram->nums->vec.i32[i])) {
     767        if ((robustHistogram->nums->data.S32[i] <= stats->sampleLQ) &&
     768                (stats->sampleLQ <= robustHistogram->nums->data.S32[i])) {
    769769            LQBinNum = i;
    770770        }
    771771
    772         if ((robustHistogram->nums->vec.i32[i] <= stats->sampleUQ) &&
    773                 (stats->sampleUQ <= robustHistogram->nums->vec.i32[i])) {
     772        if ((robustHistogram->nums->data.S32[i] <= stats->sampleUQ) &&
     773                (stats->sampleUQ <= robustHistogram->nums->data.S32[i])) {
    774774            UQBinNum = i;
    775775        }
     
    778778    // Determine the bin with the peak value in the range LQ to UQ.
    779779    maxBinNum = LQBinNum;
    780     maxBinCount = robustHistogram->nums->vec.i32[maxBinNum];
     780    maxBinCount = robustHistogram->nums->data.S32[maxBinNum];
    781781    for (i=LQBinNum;i<=UQBinNum;i++) {
    782         if (robustHistogram->nums->vec.i32[i] > maxBinCount) {
     782        if (robustHistogram->nums->data.S32[i] > maxBinCount) {
    783783            maxBinNum = i;
    784             maxBinCount = robustHistogram->nums->vec.i32[i];
     784            maxBinCount = robustHistogram->nums->data.S32[i];
    785785        }
    786786    }
     
    843843        if (maskVector != NULL) {
    844844            for (i=0;i<myVector->n;i++) {
    845                 if (!(maskVal & maskVector->vec.ui8[i]) &&
    846                         (rangeMin <= myVector->vec.f[i]) &&
    847                         (myVector->vec.f[i] <= rangeMax)) {
    848                     diff = myVector->vec.f[i] - mean;
     845                if (!(maskVal & maskVector->data.U8[i]) &&
     846                        (rangeMin <= myVector->data.F32[i]) &&
     847                        (myVector->data.F32[i] <= rangeMax)) {
     848                    diff = myVector->data.F32[i] - mean;
    849849                    sumSquares+= (diff * diff);
    850850                    sumDiffs+= diff;
     
    854854        } else {
    855855            for (i=0;i<myVector->n;i++) {
    856                 if ((rangeMin <= myVector->vec.f[i]) &&
    857                         (myVector->vec.f[i] <= rangeMax)) {
    858                     diff = myVector->vec.f[i] - mean;
     856                if ((rangeMin <= myVector->data.F32[i]) &&
     857                        (myVector->data.F32[i] <= rangeMax)) {
     858                    diff = myVector->data.F32[i] - mean;
    859859                    sumSquares+= (diff * diff);
    860860                    sumDiffs+= diff;
     
    867867        if (maskVector != NULL) {
    868868            for (i=0;i<myVector->n;i++) {
    869                 if (!(maskVal & maskVector->vec.ui8[i])) {
    870                     diff = myVector->vec.f[i] - mean;
     869                if (!(maskVal & maskVector->data.U8[i])) {
     870                    diff = myVector->data.F32[i] - mean;
    871871                    sumSquares+= (diff * diff);
    872872                    sumDiffs+= diff;
     
    876876        } else {
    877877            for (i=0;i<myVector->n;i++) {
    878                 diff = myVector->vec.f[i] - mean;
     878                diff = myVector->data.F32[i] - mean;
    879879                sumSquares+= (diff * diff);
    880880                sumDiffs+= diff;
     
    920920    }
    921921
    922     tmpMask = psVectorAlloc(maskVector->type.type, myVector->nalloc);
     922    tmpMask = psVectorAlloc(myVector->nalloc, maskVector->type.type);
    923923
    924924    tmpMask->n = maskVector->n;
    925925    for (i=0;i<tmpMask->n;i++) {
    926         tmpMask->vec.ui8[i] = maskVector->vec.ui8[i];
     926        tmpMask->data.U8[i] = maskVector->data.U8[i];
    927927    }
    928928
     
    944944        for (j=0;j<myVector->n;j++) {
    945945            // a) Exclude all values x_i for which |x_i - x| > K * stdev
    946             if ( fabs(myVector->vec.f[j] - clippedMean) >
     946            if ( fabs(myVector->data.F32[j] - clippedMean) >
    947947                    (stats->clipSigma * clippedStdev)) {
    948                 tmpMask->vec.ui8[i] = 0xff;
     948                tmpMask->data.U8[i] = 0xff;
    949949            }
    950950            // b) compute new mean and stdev
     
    979979 
    980980    NOTE: The current strategy is to implement everything assuming that all
    981     input data is of type PS_TYPE_FLOAT.  Once the basic code is in place,
    982     we will macro-ize everything and add PS_TYPE_UINT16 and PS_TYPE_DOUBLE.
     981    input data is of type PS_TYPE_F32.  Once the basic code is in place,
     982    we will macro-ize everything and add PS_TYPE_U16 and PS_TYPE_F64.
    983983 
    984984 *****************************************************************************/
     
    992992    }
    993993
    994     if (in->type.type != PS_TYPE_FLOAT) {
     994    if (in->type.type != PS_TYPE_F32) {
    995995        psAbort(__func__,
    996                 "Only data type PS_TYPE_FLOAT is currently supported.");
     996                "Only data type PS_TYPE_F32 is currently supported.");
    997997    }
    998998    if (mask != NULL) {
     
    10011001                    "Vector data and vector mask are of different sizes.");
    10021002        }
    1003         if (mask->type.type != PS_TYPE_UINT8) {
     1003        if (mask->type.type != PS_TYPE_U8) {
    10041004            psAbort(__func__,
    1005                     "Vector mask must be type PS_TYPE_UINT8");
     1005                    "Vector mask must be type PS_TYPE_U8");
    10061006        }
    10071007    }
  • trunk/psLib/src/mathtypes/psImage.h

    r824 r831  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-06-01 22:42:57 $
     11 *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-06-02 23:29:14 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4646
    4747    union {
    48         psU8    **U8;                   ///< unsigned 8-bit integer data.
    49         psU16   **U16;                  ///< unsigned 16-bit integer data.
    50         psU32   **U32;                  ///< unsigned 32-bit integer data.
    51         psU64   **U64;                  ///< unsigned 64-bit integer data.
    52         psS8    **S8;                   ///< signed 8-bit integer data.
    53         psS16   **S16;                  ///< signed 16-bit integer data.
    54         psS32   **S32;                  ///< signed 32-bit integer data.
    55         psS64   **S64;                  ///< signed 64-bit integer data.
    56         psF32   **F32;                  ///< single-precision float data.
    57         psF64   **F64;                  ///< double-precision float data.
    58         psC32   **C32;                  ///< single-precision complex data.
    59         psC64   **C64;                  ///< double-precision complex data.
    60         psPTR   **PTR;                  ///< void pointers
    61         void    **V;                    ///< pointer to data
     48        psU8    **U8;                   ///< Unsigned 8-bit integer data.
     49        psU16   **U16;                  ///< Unsigned 16-bit integer data.
     50        psU32   **U32;                  ///< Unsigned 32-bit integer data.
     51        psU64   **U64;                  ///< Unsigned 64-bit integer data.
     52        psS8    **S8;                   ///< Signed 8-bit integer data.
     53        psS16   **S16;                  ///< Signed 16-bit integer data.
     54        psS32   **S32;                  ///< Signed 32-bit integer data.
     55        psS64   **S64;                  ///< Signed 64-bit integer data.
     56        psF32   **F32;                  ///< Single-precision float data.
     57        psF64   **F64;                  ///< Double-precision float data.
     58        psC32   **C32;                  ///< Single-precision complex data.
     59        psC64   **C64;                  ///< Double-precision complex data.
     60        psPTR   **PTR;                  ///< Void pointers.
     61        psPTR    *V;                    ///< Pointer to data.
    6262    } data;                             ///< Union for data types.
    6363    const struct psImage *parent;       ///< Parent, if a subimage.
  • trunk/psLib/src/mathtypes/psVector.c

    r811 r831  
    1919 *  @author Ross Harman, MHPCC
    2020 *   
    21  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    22  *  @date $Date: 2004-05-29 01:08:46 $
     21 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     22 *  @date $Date: 2004-06-02 23:29:14 $
    2323 *
    2424 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6464/* FUNCTION IMPLEMENTATION - PUBLIC                                          */
    6565/*****************************************************************************/
    66 psVector* psVectorAlloc(psElemType elemType, unsigned int nalloc)
     66psVector* psVectorAlloc(unsigned int nalloc, psElemType elemType)
    6767{
    6868    psVector *psVec = NULL;
     
    8686
    8787    // Create vector data array
    88     psVec->vec.v = psAlloc(nalloc*elementSize);
     88    psVec->data.V = psAlloc(nalloc*elementSize);
    8989
    9090    return psVec;
    9191}
    9292
    93 psVector *psVectorRealloc(psVector *restrict in, unsigned int nalloc)
     93psVector *psVectorRealloc(unsigned int nalloc, psVector *restrict in)
    9494{
    9595    int elementSize = 0;
     
    110110            if (elemType == PS_TYPE_PTR) {
    111111                for (int i = nalloc; i < in->n; i++) {   // For reduction in vector size
    112                     psMemDecrRefCounter(in->vec.vp[i]);
     112                    psMemDecrRefCounter(in->data.PTR[i]);
    113113                }
    114114            }
     
    117117
    118118        // Realloc after decrementation to avoid accessing freed array elements
    119         in->vec.v = psRealloc(in->vec.v,nalloc*elementSize);
     119        in->data.V = psRealloc(in->data.V,nalloc*elementSize);
    120120        in->nalloc = nalloc;
    121121    }
     
    129129
    130130    if (in == NULL) {
    131         return psVectorAlloc(type,nalloc);
     131        return psVectorAlloc(nalloc, type);
    132132    }
    133133
     
    150150    if (elemType == PS_TYPE_PTR) {
    151151        for (int i = 0; i < in->n; i++) {   // For reduction in vector size
    152             psMemDecrRefCounter(in->vec.vp[i]);
    153             in->vec.vp[i] = NULL;
     152            psMemDecrRefCounter(in->data.PTR[i]);
     153            in->data.PTR[i] = NULL;
    154154        }
    155155    }
    156156
    157     in->vec.v = psRealloc(in->vec.v,nalloc*PSELEMTYPE_SIZEOF(elemType));
     157    in->data.V = psRealloc(in->data.V,nalloc*PSELEMTYPE_SIZEOF(elemType));
    158158
    159159    in->n = 0;
     
    170170    }
    171171
    172     psFree(psVec->vec.v);
     172    psFree(psVec->data.V);
    173173    psFree(psVec);
    174174}
     
    188188    for(int i = 0; i < psVec->nalloc; i++) {
    189189        if(elemFree == NULL) {
    190             psMemDecrRefCounter(psVec->vec.vp[i]);
     190            psMemDecrRefCounter(psVec->data.PTR[i]);
    191191        } else {
    192             elemFree(psMemDecrRefCounter(psVec->vec.vp[i]));
     192            elemFree(psMemDecrRefCounter(psVec->data.PTR[i]));
    193193        }
    194         psVec->vec.vp[i] = NULL;
     194        psVec->data.PTR[i] = NULL;
    195195    }
    196196}
  • trunk/psLib/src/mathtypes/psVector.h

    r811 r831  
    11/** @file  psVector.h
    22 *
    3  *  @brief Contains support for basic vector types
     3 *  @brief Contains basic vector definitions and operations
    44 *
    5  *  This file defines types and functions for one dimensional vectors which include:
    6  *      char
    7  *      short
    8  *      int
    9  *      long
    10  *      unsigned char
    11  *      unsigned short
    12  *      unsigned int
    13  *      unsigned long
    14  *      float
    15  *      double
    16  *      complex float
    17  *      void **
     5 *  This file defines the basic type for a vector struct and functions useful
     6 *  in manupulating vectors.
    187 *
     8 *  @author Robert DeSonia, MHPCC
    199 *  @author Ross Harman, MHPCC
    2010 *
    21  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    22  *  @date $Date: 2004-05-29 01:08:46 $
     11 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-06-02 23:29:14 $
    2313 *
    2414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4232
    4333    union {
    44         int8_t *i8;                     ///< Pointers to char integer data.
    45         int16_t *i16;                   ///< Pointers to short integer data.
    46         int32_t *i32;                   ///< Pointers to integer data.
    47         int64_t *i64;                   ///< Pointers to long integer data.
    48         uint8_t *ui8;                   ///< Pointers to unsigned char integer data.
    49         uint16_t*ui16;                  ///< Pointers to unsigned short integer data.
    50         uint32_t *ui32;                 ///< Pointers to unsigned integer data.
    51         uint64_t *ui64;                 ///< Pointers to unsigned long integer data.
    52         float *f;                       ///< Pointers to floating point data.
    53         double *d;                      ///< Pointers to double precision data.
    54         complex float *cf;              ///< Pointers to complex floating point data.
    55         void *v;                        ///< Pointers to generic void data
    56         void **vp;                      ///< Void pointer vector.
    57     }vec;                               ///< Union for data types.
     34        psU8    *U8;                    ///< Unsigned 8-bit integer data.
     35        psU16   *U16;                   ///< Unsigned 16-bit integer data.
     36        psU32   *U32;                   ///< Unsigned 32-bit integer data.
     37        psU64   *U64;                   ///< Unsigned 64-bit integer data.
     38        psS8    *S8;                    ///< Signed 8-bit integer data.
     39        psS16   *S16;                   ///< Signed 16-bit integer data.
     40        psS32   *S32;                   ///< Signed 32-bit integer data.
     41        psS64   *S64;                   ///< Signed 64-bit integer data.
     42        psF32   *F32;                   ///< Single-precision float data.
     43        psF64   *F64;                   ///< Double-precision float data.
     44        psC32   *C32;                   ///< Single-precision complex data.
     45        psC64   *C64;                   ///< Double-precision complex data.
     46        psPTR   *PTR;                   ///< Void pointers
     47        psPTR    V;                     ///< Pointer to data
     48    } data;                             ///< Union for data types.
    5849}
    5950psVector;
     
    7162 */
    7263psVector *psVectorAlloc(
    73     psElemType dataType,                ///< Type of data to be held by vector.
    74     unsigned int nalloc                 ///< Total number of elements to make available.
     64    unsigned int nalloc,                ///< Total number of elements to make available.
     65    psElemType dataType                 ///< Type of data to be held by vector.
    7566);
    7667
     
    8475 */
    8576psVector *psVectorRealloc(
    86     psVector *restrict psVec,           ///< Vector to reallocate.
    87     unsigned int nalloc                 ///< Total number of elements to make available.
     77    unsigned int nalloc,                ///< Total number of elements to make available.
     78    psVector *restrict psVec            ///< Vector to reallocate.
    8879);
    8980
  • trunk/psLib/src/sys/psType.h

    r813 r831  
    33 *  @brief Contains support for basic types
    44 *
    5  *  This file defines datatypes which include:
    6  *      char
    7  *      short
    8  *      int
    9  *      long
    10  *      unsigned char
    11  *      unsigned short
    12  *      unsigned int
    13  *      unsigned long
    14  *      float
    15  *      double
    16  *      complex float
    17  *      void **
     5 *  This file defines common datatypes used throughout psLib.
    186 *
    197 *  @author Robert DeSonia, MHPCC
    208 *  @author Ross Harman, MHPCC
    219 *
    22  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    23  *  @date $Date: 2004-05-29 01:10:22 $
     10 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-06-02 23:29:14 $
    2412 *
    2513 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5947
    6048typedef enum {
    61     PS_TYPE_INT8             = 0x0101,  ///< Character.
    62     PS_TYPE_INT16            = 0x0102,  ///< Short integer.
    63     PS_TYPE_INT32            = 0x0104,  ///< Integer.
    64     PS_TYPE_INT64            = 0x0108,  ///< Long integer.
    65     PS_TYPE_UINT8            = 0x0301,  ///< Unsigned character.
    66     PS_TYPE_UINT16           = 0x0302,  ///< Unsigned short integer.
    67     PS_TYPE_UINT32           = 0x0304,  ///< Unsigned integer.
    68     PS_TYPE_UINT64           = 0x0308,  ///< Unsigned long integer.
    69     PS_TYPE_FLOAT            = 0x0404,  ///< Single-precision Floating point.
    70     PS_TYPE_DOUBLE           = 0x0408,  ///< Double-precision floating point.
    71     PS_TYPE_COMPLEX_FLOAT    = 0x0808,  ///< Complex numbers consisting of single-precision floating point.
    72     PS_TYPE_COMPLEX_DOUBLE   = 0x0810,  ///< Complex numbers consisting of double-precision floating point.
    73     PS_TYPE_OTHER            = 0x0000,  ///< Something else that's not supported for arithmetic.
    74 
    75     // Abbreviated versions of the above types
    7649    PS_TYPE_S8               = 0x0101,  ///< Character.
    7750    PS_TYPE_S16              = 0x0102,  ///< Short integer.
     
    8760    PS_TYPE_C64              = 0x0810,  ///< Complex numbers consisting of double-precision floating point.
    8861    PS_TYPE_PTR              = 0x0000   ///< Something else that's not supported for arithmetic.
    89 
    9062} psElemType;
    9163
  • trunk/psLib/src/sysUtils/psType.h

    r813 r831  
    33 *  @brief Contains support for basic types
    44 *
    5  *  This file defines datatypes which include:
    6  *      char
    7  *      short
    8  *      int
    9  *      long
    10  *      unsigned char
    11  *      unsigned short
    12  *      unsigned int
    13  *      unsigned long
    14  *      float
    15  *      double
    16  *      complex float
    17  *      void **
     5 *  This file defines common datatypes used throughout psLib.
    186 *
    197 *  @author Robert DeSonia, MHPCC
    208 *  @author Ross Harman, MHPCC
    219 *
    22  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    23  *  @date $Date: 2004-05-29 01:10:22 $
     10 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-06-02 23:29:14 $
    2412 *
    2513 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5947
    6048typedef enum {
    61     PS_TYPE_INT8             = 0x0101,  ///< Character.
    62     PS_TYPE_INT16            = 0x0102,  ///< Short integer.
    63     PS_TYPE_INT32            = 0x0104,  ///< Integer.
    64     PS_TYPE_INT64            = 0x0108,  ///< Long integer.
    65     PS_TYPE_UINT8            = 0x0301,  ///< Unsigned character.
    66     PS_TYPE_UINT16           = 0x0302,  ///< Unsigned short integer.
    67     PS_TYPE_UINT32           = 0x0304,  ///< Unsigned integer.
    68     PS_TYPE_UINT64           = 0x0308,  ///< Unsigned long integer.
    69     PS_TYPE_FLOAT            = 0x0404,  ///< Single-precision Floating point.
    70     PS_TYPE_DOUBLE           = 0x0408,  ///< Double-precision floating point.
    71     PS_TYPE_COMPLEX_FLOAT    = 0x0808,  ///< Complex numbers consisting of single-precision floating point.
    72     PS_TYPE_COMPLEX_DOUBLE   = 0x0810,  ///< Complex numbers consisting of double-precision floating point.
    73     PS_TYPE_OTHER            = 0x0000,  ///< Something else that's not supported for arithmetic.
    74 
    75     // Abbreviated versions of the above types
    7649    PS_TYPE_S8               = 0x0101,  ///< Character.
    7750    PS_TYPE_S16              = 0x0102,  ///< Short integer.
     
    8760    PS_TYPE_C64              = 0x0810,  ///< Complex numbers consisting of double-precision floating point.
    8861    PS_TYPE_PTR              = 0x0000   ///< Something else that's not supported for arithmetic.
    89 
    9062} psElemType;
    9163
  • trunk/psLib/test/collections/tst_psSort_01.c

    r717 r831  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-05-18 19:22:34 $
     12 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-06-02 23:29:29 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2929    // Test A - Create float vectors
    3030    printPositiveTestHeader(stdout,"psSort", "Create float vectors");
    31     in = psVectorAlloc(PS_TYPE_FLOAT, 5);
     31    in = psVectorAlloc(5, PS_TYPE_F32);
    3232    in->n = 5;
    33     out = psVectorAlloc(PS_TYPE_FLOAT, 5);
     33    out = psVectorAlloc(5, PS_TYPE_F32);
    3434    out->n = 5;
    35     in->vec.f[0] = 7.0f;
    36     in->vec.f[1] = 9.0f;
    37     in->vec.f[2] = 3.0f;
    38     in->vec.f[3] = 1.0f;
    39     in->vec.f[4] = 5.0f;
     35    in->data.F32[0] = 7.0f;
     36    in->data.F32[1] = 9.0f;
     37    in->data.F32[2] = 3.0f;
     38    in->data.F32[3] = 1.0f;
     39    in->data.F32[4] = 5.0f;
    4040    for(int i=0; i<5; i++) {
    41         printf("vec[%d] = %f\n", i, in->vec.f[i]);
     41        printf("vec[%d] = %f\n", i, in->data.F32[i]);
    4242    }
    4343    printFooter(stdout, "psSort", "Create float vectors", true);
     
    4848    out = psSort(out, in);
    4949    for(int i=0; i<5; i++) {
    50         printf("vec[%d] = %f\n", i, out->vec.f[i]);
     50        printf("vec[%d] = %f\n", i, out->data.F32[i]);
    5151    }
    5252    printFooter(stdout, "psSort", "Sort float vector", true);
  • trunk/psLib/test/collections/tst_psSort_02.c

    r717 r831  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-05-18 19:22:34 $
     12 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-06-02 23:29:29 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2929    // Test A - Create float vectors
    3030    printPositiveTestHeader(stdout,"psSort", "Create vectors");
    31     in = psVectorAlloc(PS_TYPE_FLOAT, 5);
     31    in = psVectorAlloc(5, PS_TYPE_F32);
    3232    in->n = 5;
    33     out = psVectorAlloc(PS_TYPE_INT32, 5);
     33    out = psVectorAlloc(5, PS_TYPE_F32);
    3434    out->n = 5;
    35     in->vec.f[0] = 7.0f;
    36     in->vec.f[1] = 9.0f;
    37     in->vec.f[2] = 3.0f;
    38     in->vec.f[3] = 1.0f;
    39     in->vec.f[4] = 5.0f;
     35    in->data.F32[0] = 7.0f;
     36    in->data.F32[1] = 9.0f;
     37    in->data.F32[2] = 3.0f;
     38    in->data.F32[3] = 1.0f;
     39    in->data.F32[4] = 5.0f;
    4040    for(int i=0; i<5; i++) {
    41         printf("arr[%d] = %f\n", i, in->vec.f[i]);
     41        printf("arr[%d] = %f\n", i, in->data.F32[i]);
    4242    }
    4343    printFooter(stdout, "psSort", "Create vectors", true);
     
    4848    out = psSortIndex(out, in);
    4949    for(int i=0; i<5; i++) {
    50         printf("arr[%d] = %d\n", i, out->vec.i32[i]);
     50        printf("arr[%d] = %d\n", i, out->data.S32[i]);
    5151    }
    5252    printFooter(stdout, "psSort", "Create sorted index vector", true);
  • trunk/psLib/test/collections/tst_psSort_03.c

    r717 r831  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-05-18 19:22:34 $
     12 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-06-02 23:29:29 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2929    // Test A - Create float vectors
    3030    printPositiveTestHeader(stdout,"psSort", "Create float vectors of different sizes");
    31     in = psVectorAlloc(PS_TYPE_FLOAT, 5);
     31    in = psVectorAlloc(5, PS_TYPE_F32);
    3232    in->n = 5;
    33     out = psVectorAlloc(PS_TYPE_FLOAT, 6);
     33    out = psVectorAlloc(6, PS_TYPE_F32);
    3434    out->n = 6;
    3535    in->n = 5;
    3636    for(int i=0; i<5; i++) {
    37         printf("arr[%d] = %f\n", i, in->vec.f[i]);
     37        printf("arr[%d] = %f\n", i, in->data.F32[i]);
    3838    }
    3939    printFooter(stdout, "psSort", "Create float vectors of different sizes", true);
  • trunk/psLib/test/collections/tst_psSort_04.c

    r717 r831  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-05-18 19:22:34 $
     12 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-06-02 23:29:29 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2525    psVector *badIn = NULL;
    2626    psVector *badOut = NULL;
    27     psVector *goodIn = psVectorAlloc(PS_TYPE_FLOAT, 5);
    28     psVector *goodOut = psVectorAlloc(PS_TYPE_FLOAT, 5);
     27    psVector *goodIn = psVectorAlloc(5, PS_TYPE_F32);
     28    psVector *goodOut = psVectorAlloc(5, PS_TYPE_F32);
    2929
    3030    // Test A - Attempt to sort with null input vector
  • trunk/psLib/test/collections/tst_psVector_01.c

    r717 r831  
    44 *
    55 *  This test driver contains the following tests for psVector test point 1:
    6  *     A)  Create INT32 vector
    7  *     B)  Add data to INT32 vector
    8  *     C)  Reallocate INT32 vector bigger
    9  *     D)  Reallocate INT32 vector smaller
    10  *     E)  Free INT32 vector
     6 *     A)  Create S32 vector
     7 *     B)  Add data to S32 vector
     8 *     C)  Reallocate S32 vector bigger
     9 *     D)  Reallocate S32 vector smaller
     10 *     E)  Free S32 vector
    1111 *
    1212 *  @author  Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
    15  *  @date  $Date: 2004-05-18 19:22:34 $
     14 *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
     15 *  @date  $Date: 2004-06-02 23:29:29 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2727
    2828
    29     // Test A - Create INT32 vector
    30     printPositiveTestHeader(stdout,"psVector", "Create INT32 vector");
    31     psVector *psVec = psVectorAlloc(PS_TYPE_INT32, 5);
     29    // Test A - Create S32 vector
     30    printPositiveTestHeader(stdout,"psVector", "Create S32 vector");
     31    psVector *psVec = psVectorAlloc(5, PS_TYPE_S32);
    3232    printf("Vector size = %d\n", psVec->nalloc);
    3333    printf("Vector population = %d\n", psVec->n);
    34     printFooter(stdout, "psVector", "Create INT32 vector", true);
     34    printFooter(stdout, "psVector", "Create S32 vector", true);
    3535
    3636
    3737    // Test B - Add data to integer vector
    38     printPositiveTestHeader(stdout, "psVector", "Add data to INT32 vector");
     38    printPositiveTestHeader(stdout, "psVector", "Add data to S32 vector");
    3939    for(int i = 0; i < 5; i++) {
    40         psVec->vec.i32[i] = i*10;
     40        psVec->data.S32[i] = i*10;
    4141        psVec->n++;
    42         printf("Elem %d = %d\n", i, psVec->vec.i32[i]);
     42        printf("Elem %d = %d\n", i, psVec->data.S32[i]);
    4343    }
    4444    printf("Vector size = %d\n", psVec->nalloc);
    4545    printf("Vector population = %d\n", psVec->n);
    46     printFooter(stdout, "psVector", "Add data to INT32 vector", true);
     46    printFooter(stdout, "psVector", "Add data to S32 vector", true);
    4747
    4848
    49     // Test C - Reallocate INT32 vector bigger
    50     printPositiveTestHeader(stdout,"psVector", "Reallocate INT32 vector bigger");
    51     psVec = psVectorRealloc(psVec, 10);
    52     printf("Adding more elements to INT32 vector...\n");
     49    // Test C - Reallocate S32 vector bigger
     50    printPositiveTestHeader(stdout,"psVector", "Reallocate S32 vector bigger");
     51    psVec = psVectorRealloc(10, psVec);
     52    printf("Adding more elements to S32 vector...\n");
    5353    for(int i = 5; i < 10; i++) {
    54         psVec->vec.i32[i] = i*10;
     54        psVec->data.S32[i] = i*10;
    5555        psVec->n++;
    56         printf("Elem %d = %d\n", i, psVec->vec.i32[i]);
     56        printf("Elem %d = %d\n", i, psVec->data.S32[i]);
    5757    }
    5858    printf("Vector size = %d\n", psVec->nalloc);
    5959    printf("Vector population = %d\n", psVec->n);
    60     printFooter(stdout, "psVector", "Reallocate INT32 vector bigger", true);
     60    printFooter(stdout, "psVector", "Reallocate S32 vector bigger", true);
    6161
    6262
    63     // Test D - Reallocate INT32 vector smaller
    64     printPositiveTestHeader(stdout,"psVector","Reallocate INT32 vector smaller");
    65     psVec = psVectorRealloc(psVec, 3);
     63    // Test D - Reallocate S32 vector smaller
     64    printPositiveTestHeader(stdout,"psVector","Reallocate S32 vector smaller");
     65    psVec = psVectorRealloc(3, psVec);
    6666    printf("Vector size = %d\n", psVec->nalloc);
    6767    for(int i = 0; i < 3; i++) {
    68         printf("Elem %d = %d\n", i, psVec->vec.i32[i]);
     68        printf("Elem %d = %d\n", i, psVec->data.S32[i]);
    6969    }
    7070    printf("Vector size = %d\n", psVec->nalloc);
    7171    printf("Vector population = %d\n", psVec->n);
    72     printFooter(stdout, "psVector", "Reallocate integer INT32 smaller", true);
     72    printFooter(stdout, "psVector", "Reallocate integer S32 smaller", true);
    7373
    7474
    75     // Test E - Free INT32 vector
    76     printPositiveTestHeader(stdout, "psVector", "Free INT32 vector");
     75    // Test E - Free S32 vector
     76    printPositiveTestHeader(stdout, "psVector", "Free S32 vector");
    7777    psVectorFree(psVec);
    7878    psMemCheckLeaks(0, NULL, stdout);
     
    8181        printf("ERROR: Found %d bad memory blocks\n", nBad);
    8282    }
    83     printFooter(stdout, "psVector" ,"Free INT32 vector", true);
     83    printFooter(stdout, "psVector" ,"Free S32 vector", true);
    8484
    8585    return 0;
  • trunk/psLib/test/collections/tst_psVector_02.c

    r717 r831  
    1212 *  @author  Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
    15  *  @date  $Date: 2004-05-18 19:22:34 $
     14 *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
     15 *  @date  $Date: 2004-06-02 23:29:29 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3939    // Test A - Create void pointer vector
    4040    printPositiveTestHeader(stdout,"psVector", "Create void pointer vector");
    41     psVector *psVec = psVectorAlloc(PS_TYPE_PTR, 5);
     41    psVector *psVec = psVectorAlloc(5, PS_TYPE_PTR);
    4242    printf("Vector size = %d\n", psVec->nalloc);
    4343    printf("Vector population = %d\n", psVec->n);
     
    5252        ts->y = 10.1*i;
    5353        mySt[i] = ts;
    54         psVec->vec.vp[i] = ts;
     54        psVec->data.PTR[i] = ts;
    5555        psVec->n++;
    5656        psMemIncrRefCounter(ts);
     
    5858
    5959    for(int i = 0; i < 5; i++) {
    60         testStruct *ts = (testStruct*)psVec->vec.vp[i];
     60        testStruct *ts = (testStruct*)psVec->data.PTR[i];
    6161        printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y);
    6262    }
     
    6868    // Test C - Reallocate void pointer vector bigger
    6969    printPositiveTestHeader(stdout,"psVector", "Reallocate void pointer vector bigger");
    70     psVec = psVectorRealloc(psVec, 10);
     70    psVec = psVectorRealloc(10, psVec);
    7171    printf("Adding more elements to void pointer vector...\n");
    7272    for(int i = 5; i < 10; i++) {
     
    7575        ts->y = 10.1*i;
    7676        mySt[i] = ts;
    77         psVec->vec.vp[i] = ts;
     77        psVec->data.PTR[i] = ts;
    7878        psVec->n++;
    7979        psMemIncrRefCounter(ts);
    8080    }
    8181    for(int i = 0; i < 10; i++) {
    82         testStruct *ts = (testStruct*)psVec->vec.vp[i];
     82        testStruct *ts = (testStruct*)psVec->data.PTR[i];
    8383        printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y);
    8484    }
     
    9090    // Test D - Reallocate void pointer vector smaller
    9191    printPositiveTestHeader(stdout,"psVector","Reallocate void pointer vector smaller");
    92     psVec = psVectorRealloc(psVec, 3);
     92    psVec = psVectorRealloc(3, psVec);
    9393    for(int i = 0; i < 3; i++) {
    94         testStruct *ts = (testStruct*)psVec->vec.vp[i];
     94        testStruct *ts = (testStruct*)psVec->data.PTR[i];
    9595        printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y);
    9696    }
  • trunk/psLib/test/collections/tst_psVector_03.c

    r717 r831  
    1212 *  @author  Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
    15  *  @date  $Date: 2004-05-18 19:22:34 $
     14 *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
     15 *  @date  $Date: 2004-06-02 23:29:29 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4444    // Test A - Create void pointer vector
    4545    printPositiveTestHeader(stdout,"psVector", "Create void pointer vector");
    46     psVector *psVec = psVectorAlloc(PS_TYPE_PTR, 5);
     46    psVector *psVec = psVectorAlloc(5, PS_TYPE_PTR);
    4747    printf("Vector size = %d\n", psVec->nalloc);
    4848    printf("Vector population = %d\n", psVec->n);
     
    5757        ts->y = 10.1*i;
    5858        mySt[i] = ts;
    59         psVec->vec.vp[i] = ts;
     59        psVec->data.PTR[i] = ts;
    6060        psVec->n++;
    6161        psMemIncrRefCounter(ts);
     
    6363
    6464    for(int i = 0; i < 5; i++) {
    65         testStruct *ts = (testStruct*)psVec->vec.vp[i];
     65        testStruct *ts = (testStruct*)psVec->data.PTR[i];
    6666        printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y);
    6767    }
     
    7373    // Test C - Reallocate void pointer vector bigger
    7474    printPositiveTestHeader(stdout,"psVector", "Reallocate void pointer vector bigger");
    75     psVec = psVectorRealloc(psVec, 10);
     75    psVec = psVectorRealloc(10, psVec);
    7676    printf("Adding more elements to void pointer vector...\n");
    7777    for(int i = 5; i < 10; i++) {
     
    8080        ts->y = 10.1*i;
    8181        mySt[i] = ts;
    82         psVec->vec.vp[i] = ts;
     82        psVec->data.PTR[i] = ts;
    8383        psVec->n++;
    8484        psMemIncrRefCounter(ts);
    8585    }
    8686    for(int i = 0; i < 10; i++) {
    87         testStruct *ts = (testStruct*)psVec->vec.vp[i];
     87        testStruct *ts = (testStruct*)psVec->data.PTR[i];
    8888        printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y);
    8989    }
     
    9595    // Test D - Reallocate void pointer vector smaller
    9696    printPositiveTestHeader(stdout,"psVector","Reallocate void pointer vector smaller");
    97     psVec = psVectorRealloc(psVec, 3);
     97    psVec = psVectorRealloc(3, psVec);
    9898    for(int i = 0; i < 3; i++) {
    99         testStruct *ts = (testStruct*)psVec->vec.vp[i];
     99        testStruct *ts = (testStruct*)psVec->data.PTR[i];
    100100        printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y);
    101101    }
  • trunk/psLib/test/dataManip/tst_psMatrix03.c

    r798 r831  
    1111 *  @author  Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
    14  *  @date  $Date: 2004-05-28 02:52:23 $
     13 *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
     14 *  @date  $Date: 2004-06-02 23:29:39 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3131#define PRINT_VECTOR(VECTOR)                        \
    3232for(int i=0; i<VECTOR->n; i++) {               \
    33     printf("%f\n", VECTOR->vec.d[i]);          \
     33    printf("%f\n", VECTOR->data.F64[i]);          \
    3434}
    3535
     
    4848    printPositiveTestHeader(stdout, "psMatrix", "Create input and output images and vectors");
    4949    luImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
    50     perm = (psVector*)psVectorAlloc(PS_TYPE_F64, 3);
    51     outVector = (psVector*)psVectorAlloc(PS_TYPE_F64, 3);
    52     inVector = (psVector*)psVectorAlloc(PS_TYPE_F64, 3);
     50    perm = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
     51    outVector = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
     52    inVector = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
    5353    inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
    5454    inImage->data.F64[0][0] =  2;
     
    6161    inImage->data.F64[2][1] =  1;
    6262    inImage->data.F64[2][2] = -2;
    63     inVector->vec.d[0] = 18.0;
    64     inVector->vec.d[1] = 24.0;
    65     inVector->vec.d[2] =  4.0;
     63    inVector->data.F64[0] = 18.0;
     64    inVector->data.F64[1] = 24.0;
     65    inVector->data.F64[2] =  4.0;
    6666    inVector->n = 3;
    6767    PRINT_MATRIX(inImage);
  • trunk/psLib/test/dataManip/tst_psMatrix07.c

    r798 r831  
    1111 *  @author  Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
    14  *  @date  $Date: 2004-05-28 02:52:23 $
     13 *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
     14 *  @date  $Date: 2004-06-02 23:29:39 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3131#define PRINT_VECTOR(VECTOR)                        \
    3232for(int i=0; i<VECTOR->n; i++) {               \
    33     printf("%f\n", VECTOR->vec.d[i]);          \
     33    printf("%f\n", VECTOR->data.F64[i]);          \
    3434}
    3535
     
    4646    // Test A - Create input and output images
    4747    printPositiveTestHeader(stdout, "psMatrix", "Create input and output images and vectors");
    48     v1 = (psVector*)psVectorAlloc(PS_TYPE_F64, 3);
     48    v1 = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
    4949    m1 = (psImage*)psImageAlloc(1, 3, PS_TYPE_F64);
    50     v2 = (psVector*)psVectorAlloc(PS_TYPE_F64, 3);
     50    v2 = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
    5151    m2 = (psImage*)psImageAlloc(1, 3, PS_TYPE_F64);
    5252    m1->data.F64[0][0] = 0.0;
    5353    m1->data.F64[1][0] = 1.0;
    5454    m1->data.F64[2][0] = 2.0;
    55     v2->vec.d[0] = 0.0;
    56     v2->vec.d[1] = 1.0;
    57     v2->vec.d[2] = 2.0;
     55    v2->data.F64[0] = 0.0;
     56    v2->data.F64[1] = 1.0;
     57    v2->data.F64[2] = 2.0;
    5858    v2->n = 3;
    5959    PRINT_MATRIX(m1);
  • trunk/psLib/test/image/tst_psImage.c

    r782 r831  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-05-25 23:59:17 $
     8 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-06-02 23:29:29 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4848    unsigned int numRows[] = {0,1,100,1,150,100};
    4949    unsigned int types = 12;
    50     psElemType type[] = { PS_TYPE_INT8, PS_TYPE_INT16, PS_TYPE_INT32, PS_TYPE_INT64,
    51                           PS_TYPE_UINT8, PS_TYPE_UINT16, PS_TYPE_UINT32, PS_TYPE_UINT64,
    52                           PS_TYPE_FLOAT, PS_TYPE_DOUBLE, PS_TYPE_COMPLEX_FLOAT, PS_TYPE_COMPLEX_DOUBLE };
     50    psElemType type[] = { PS_TYPE_S8, PS_TYPE_S16, PS_TYPE_S32, PS_TYPE_S64,
     51                          PS_TYPE_U8, PS_TYPE_U16, PS_TYPE_U32, PS_TYPE_U64,
     52                          PS_TYPE_F32, PS_TYPE_F64, PS_TYPE_C32, PS_TYPE_C64 };
    5353
    5454    psLogMsg(__func__,PS_LOG_INFO,"#546 - psImageAlloc shall allocate memory for a psImage structure");
     
    111111
    112112            switch (type[t]) {
    113             case PS_TYPE_UINT16: {
     113            case PS_TYPE_U16: {
    114114                    unsigned int rows = numRows[i];
    115115                    unsigned int cols = numCols[i];
     
    131131                }
    132132                break;
    133             case PS_TYPE_FLOAT: {
     133            case PS_TYPE_F32: {
    134134                    unsigned int rows = numRows[i];
    135135                    unsigned int cols = numCols[i];
     
    151151                }
    152152                break;
    153             case PS_TYPE_DOUBLE: {
     153            case PS_TYPE_F64: {
    154154                    unsigned int rows = numRows[i];
    155155                    unsigned int cols = numCols[i];
     
    171171                }
    172172                break;
    173             case PS_TYPE_COMPLEX_FLOAT: {
     173            case PS_TYPE_C32: {
    174174                    unsigned int rows = numRows[i];
    175175                    unsigned int cols = numCols[i];
Note: See TracChangeset for help on using the changeset viewer.