IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 6, 2004, 12:34:06 PM (22 years ago)
Author:
desonia
Message:

astyle fixed?

Location:
trunk/psLib/test/dataManip
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/dataManip/tst_psHist02.c

    r1365 r1406  
    22   This routine must ensure that the psHistogram structure is correctly
    33   populated by the procedure psGetArrayHistogram().
    4 
     4 
    55*****************************************************************************/
    66#include <stdio.h>
     
    2626    int i = 0;
    2727    int currentId = 0;
    28    
     28
    2929    currentId = psMemGetId();
    30    
     30
    3131    /*********************************************************************/
    3232    /*  Allocate and initialize data structures                          */
     
    3535    myData->n = myData->nalloc;
    3636    for ( i = 0;i < NUM_DATA;i++ ) {
    37             myData->data.F32[ i ] = LOWER + ( ( UPPER - LOWER ) / ( float ) NUM_DATA ) * ( float ) i;
    38         }
    39        
     37        myData->data.F32[ i ] = LOWER + ( ( UPPER - LOWER ) / ( float ) NUM_DATA ) * ( float ) i;
     38    }
     39
    4040    myMask = psVectorAlloc( NUM_DATA, PS_TYPE_U8 );
    4141    myMask->n = myMask->nalloc;
    4242    for ( i = 0;i < NUM_DATA;i++ ) {
    43             if ( i >= ( NUM_DATA / 2 ) ) {
    44                     myMask->data.U8[ i ] = 1;
    45                 } else {
    46                     myMask->data.U8[ i ] = 0;
    47                 }
     43        if ( i >= ( NUM_DATA / 2 ) ) {
     44            myMask->data.U8[ i ] = 1;
     45        } else {
     46            myMask->data.U8[ i ] = 0;
    4847        }
    49        
     48    }
     49
    5050    for ( nb = 0;nb < 4;nb++ ) {
    51             if ( nb == 0 )
    52                 numBins = 1;
    53             if ( nb == 1 )
    54                 numBins = 2;
    55             if ( nb == 2 )
    56                 numBins = 10;
    57             if ( nb == 3 )
    58                 numBins = 20;
    59                
    60             /*********************************************************************/
    61             /*  Allocate and Perform Histogram, no mask                          */
    62             /*********************************************************************/
    63             printPositiveTestHeader( stdout,
    64                                      "psStats functions",
    65                                      "Allocate and Perform Histogram, no mask" );
    66                                      
    67             myHist = psHistogramAlloc( LOWER, UPPER, numBins );
    68             myHist = psVectorHistogram( myHist, myData, NULL, 0 );
    69            
    70             for ( i = 0;i < numBins;i++ ) {
    71                     printf( "Bin number %d bounds: (%.2f - %.2f) data (%d)\n", i,
    72                             myHist->bounds->data.F32[ i ],
    73                             myHist->bounds->data.F32[ i + 1 ],
    74                             myHist->nums->data.U32[ i ] );
    75                 }
    76             psMemCheckCorruption( 1 );
    77             psFree( myHist );
    78             psMemCheckCorruption( 1 );
    79            
    80             printFooter( stdout,
    81                          "psStats functions",
    82                          "Allocate and Perform Histogram, no mask",
    83                          testStatus );
    84                          
    85             /*********************************************************************/
    86             /*  Allocate and Perform Histogram with mask                         */
    87             /*********************************************************************/
    88             printPositiveTestHeader( stdout,
    89                                      "psStats functions",
    90                                      "Allocate and Perform Histogram with mask" );
    91                                      
    92             myHist = psHistogramAlloc( LOWER, UPPER, numBins );
    93             myHist = psVectorHistogram( myHist, myData, myMask, 1 );
    94            
    95             for ( i = 0;i < numBins;i++ ) {
    96                     printf( "Bin number %d bounds: (%6.3f - %6.3f) data (%d)\n", i,
    97                             myHist->bounds->data.F32[ i ],
    98                             myHist->bounds->data.F32[ i + 1 ],
    99                             myHist->nums->data.U32[ i ] );
    100                 }
    101             psMemCheckCorruption( 1 );
    102             psFree( myHist );
    103             psMemCheckCorruption( 1 );
    104            
    105             printFooter( stdout,
    106                          "psStats functions",
    107                          "Allocate and Perform Histogram with mask",
    108                          testStatus );
     51        if ( nb == 0 )
     52            numBins = 1;
     53        if ( nb == 1 )
     54            numBins = 2;
     55        if ( nb == 2 )
     56            numBins = 10;
     57        if ( nb == 3 )
     58            numBins = 20;
     59
     60        /*********************************************************************/
     61        /*  Allocate and Perform Histogram, no mask                          */
     62        /*********************************************************************/
     63        printPositiveTestHeader( stdout,
     64                                 "psStats functions",
     65                                 "Allocate and Perform Histogram, no mask" );
     66
     67        myHist = psHistogramAlloc( LOWER, UPPER, numBins );
     68        myHist = psVectorHistogram( myHist, myData, NULL, 0 );
     69
     70        for ( i = 0;i < numBins;i++ ) {
     71            printf( "Bin number %d bounds: (%.2f - %.2f) data (%d)\n", i,
     72                    myHist->bounds->data.F32[ i ],
     73                    myHist->bounds->data.F32[ i + 1 ],
     74                    myHist->nums->data.U32[ i ] );
    10975        }
     76        psMemCheckCorruption( 1 );
     77        psFree( myHist );
     78        psMemCheckCorruption( 1 );
     79
     80        printFooter( stdout,
     81                     "psStats functions",
     82                     "Allocate and Perform Histogram, no mask",
     83                     testStatus );
     84
     85        /*********************************************************************/
     86        /*  Allocate and Perform Histogram with mask                         */
     87        /*********************************************************************/
     88        printPositiveTestHeader( stdout,
     89                                 "psStats functions",
     90                                 "Allocate and Perform Histogram with mask" );
     91
     92        myHist = psHistogramAlloc( LOWER, UPPER, numBins );
     93        myHist = psVectorHistogram( myHist, myData, myMask, 1 );
     94
     95        for ( i = 0;i < numBins;i++ ) {
     96            printf( "Bin number %d bounds: (%6.3f - %6.3f) data (%d)\n", i,
     97                    myHist->bounds->data.F32[ i ],
     98                    myHist->bounds->data.F32[ i + 1 ],
     99                    myHist->nums->data.U32[ i ] );
     100        }
     101        psMemCheckCorruption( 1 );
     102        psFree( myHist );
     103        psMemCheckCorruption( 1 );
     104
     105        printFooter( stdout,
     106                     "psStats functions",
     107                     "Allocate and Perform Histogram with mask",
     108                     testStatus );
     109    }
    110110    psFree( myMask );
    111    
     111
    112112    printPositiveTestHeader( stdout,
    113113                             "psStats functions",
    114114                             "Calling psVectorHistogram() with various NULL inputs." );
    115                              
     115
    116116    // Verify the return value is null and program execution doesn't stop,
    117117    // if input parameter myHist is null.
    118    
     118
    119119    myHist2 = psVectorHistogram( NULL, myData, NULL, 0 );
    120120    if ( myHist2 != NULL ) {
    121             printf( "ERROR: myHist2!=NULL\n" );
    122             testStatus = false;
    123         }
     121        printf( "ERROR: myHist2!=NULL\n" );
     122        testStatus = false;
     123    }
    124124    psFree( myData );
    125    
    126    
     125
     126
    127127    // Verify the retrun value is the same as the input parameter myHist and
    128128    // program execution doesn't stop, if the input parameter myArray is
    129129    // null.
    130    
     130
    131131    myHist = psHistogramAlloc( LOWER, UPPER, numBins );
    132132    myHist = psVectorHistogram( myHist, NULL, NULL, 0 );
    133133    if ( myHist == NULL ) {
    134             printf( "ERROR: myHist==NULL\n" );
    135             testStatus = false;
    136         }
     134        printf( "ERROR: myHist==NULL\n" );
     135        testStatus = false;
     136    }
    137137    psFree( myHist );
    138    
    139    
     138
     139
    140140    // Verify the return value is the same as the input parameter myHist and
    141141    // program execution doesn't stop, if the input parameter myArray has no
     
    159159                 "Calling psVectorHistogram() with various NULL inputs.",
    160160                 testStatus );
    161                  
     161
    162162    /*************************************************************************/
    163163    /*  Deallocate data structures                                   */
     
    166166                             "psStats functions",
    167167                             "Deallocate the psHistogram structure." );
    168                              
     168
    169169    psMemCheckCorruption( 1 );
    170170    memLeaks = psMemCheckLeaks( currentId, NULL, NULL );
    171171    if ( 0 != memLeaks ) {
    172             psAbort( __func__, "Memory Leaks! (%d leaks)", memLeaks );
    173         }
     172        psAbort( __func__, "Memory Leaks! (%d leaks)", memLeaks );
     173    }
    174174    psMemCheckCorruption( 1 );
    175    
     175
    176176    printFooter( stdout,
    177177                 "psStats functions",
    178178                 "Deallocate the psHistogram structure.",
    179179                 testStatus );
    180                  
     180
    181181    return ( !testStatus );
    182182}
  • trunk/psLib/test/dataManip/tst_psMatrix01.c

    r1346 r1406  
    1111*  @author  Ross Harman, MHPCC
    1212*
    13 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
    14 *  @date  $Date: 2004-07-30 02:55:47 $
     13*  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
     14*  @date  $Date: 2004-08-06 22:34:06 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2323#define PRINT_MATRIX(IMAGE)                         \
    2424for(int i=IMAGE->numRows-1; i>-1; i--) {        \
    25         for(int j=0; j<IMAGE->numCols; j++) {       \
    26                 printf("%f ", IMAGE->data.F64[i][j]);   \
    27             }                                          \
    28         printf("\n");                              \
    29     }
    30    
     25    for(int j=0; j<IMAGE->numCols; j++) {       \
     26        printf("%f ", IMAGE->data.F64[i][j]);   \
     27    }                                          \
     28    printf("\n");                              \
     29}
     30
    3131int main( int argc,
    3232          char* argv[] )
    3333{
    3434    psImage * tempImage = NULL;
    35    
    36    
     35
     36
    3737    // Test A - Create input and output images
    3838    printPositiveTestHeader( stdout, "psMatrix", "Create input and output images" );
     
    5050    PRINT_MATRIX( inImage );
    5151    printFooter( stdout, "psMatrix", "Create input and output images", true );
    52    
    53    
     52
     53
    5454    // Test B - Transpose input image into output image
    5555    printPositiveTestHeader( stdout, "psMatrix", "Transpose input image into output image" );
     
    5858    PRINT_MATRIX( outImage );
    5959    if ( outImage->type.dimen != PS_DIMEN_IMAGE ) {
    60             printf( "Error: Resulting image is not PS_DIMEN_IMAGE\n" );
    61         } else if ( outImage != tempImage ) {
     60        printf( "Error: Resulting image is not PS_DIMEN_IMAGE\n" );
     61    } else
     62        if ( outImage != tempImage ) {
    6263            printf( "Error: Return pointer not equal to output argument pointer\n" );
    6364        }
    6465    printFooter( stdout, "psMatrix", "Transpose input image into output image", true );
    65    
    66    
     66
     67
    6768    // Test C -  Transpose input image into auto allocated NULL output image
    6869    printPositiveTestHeader( stdout, "psMatrix", "ranspose input image into auto allocated NULL output image" );
     
    7172    PRINT_MATRIX( outImageNull );
    7273    printFooter( stdout, "psMatrix", "ranspose input image into auto allocated NULL output image", true );
    73    
    74    
     74
     75
    7576    // Test D - Free images and check for leaks
    7677    printPositiveTestHeader( stdout, "psMatrix", "Free images and check for leaks" );
     
    8081    int nLeaks = psMemCheckLeaks( 0, NULL, stdout );
    8182    if ( nLeaks != 0 ) {
    82             printf( "ERROR: Found %d memory leaks\n", nLeaks );
    83         }
     83        printf( "ERROR: Found %d memory leaks\n", nLeaks );
     84    }
    8485    int nBad = psMemCheckCorruption( 0 );
    8586    if ( nBad ) {
    86             printf( "ERROR: Found %d bad memory blocks\n", nBad );
    87         }
     87        printf( "ERROR: Found %d bad memory blocks\n", nBad );
     88    }
    8889    printFooter( stdout, "psMatrix" , "Free images and check for leaks", true );
    89    
     90
    9091    return 0;
    9192}
  • trunk/psLib/test/dataManip/tst_psMatrix02.c

    r798 r1406  
    1313 *  @author  Ross Harman, MHPCC
    1414 *
    15  *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
    16  *  @date  $Date: 2004-05-28 02:52:23 $
     15 *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
     16 *  @date  $Date: 2004-08-06 22:34:06 $
    1717 *
    1818 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  • trunk/psLib/test/dataManip/tst_psMatrix03.c

    r1181 r1406  
    1414 *  @author  Ross Harman, MHPCC
    1515 *
    16  *  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
    17  *  @date  $Date: 2004-07-01 23:29:34 $
     16 *  @version $Revision: 1.8 $  $Name: not supported by cvs2svn $
     17 *  @date  $Date: 2004-08-06 22:34:06 $
    1818 *
    1919 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8383    if(luImage->type.dimen != PS_DIMEN_IMAGE) {
    8484        printf("Error: Resulting image is not PS_DIMEN_IMAGE\n");
    85     } else if(luImage != tempImage) {
    86         printf("Error: Return pointer not equal to output argument pointer\n");
    87     }
     85    } else
     86        if(luImage != tempImage) {
     87            printf("Error: Return pointer not equal to output argument pointer\n");
     88        }
    8889    printFooter(stdout, "psMatrix", "Calculate LU matrix", true);
    8990
     
    9697    if(outVector->type.dimen != PS_DIMEN_VECTOR) {
    9798        printf("Error: Resulting image is not PS_DIMEN_VECTOR\n");
    98     } else if(outVector != tempVector) {
    99         printf("Error: Return pointer not equal to output argument pointer\n");
    100     }
     99    } else
     100        if(outVector != tempVector) {
     101            printf("Error: Return pointer not equal to output argument pointer\n");
     102        }
    101103    printFooter(stdout, "psMatrix", "Determine solution to matrix equation", true);
    102104
  • trunk/psLib/test/dataManip/tst_psMatrix04.c

    r1073 r1406  
    1313 *  @author  Ross Harman, MHPCC
    1414 *
    15  *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
    16  *  @date  $Date: 2004-06-23 23:00:17 $
     15 *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
     16 *  @date  $Date: 2004-08-06 22:34:06 $
    1717 *
    1818 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6767    if(outImage->type.dimen != PS_DIMEN_IMAGE) {
    6868        printf("Error: Resulting image is not PS_DIMEN_IMAGE\n");
    69     } else if(outImage != tempImage) {
    70         printf("Error: Return pointer not equal to output argument pointer\n");
    71     }
     69    } else
     70        if(outImage != tempImage) {
     71            printf("Error: Return pointer not equal to output argument pointer\n");
     72        }
    7273    printFooter(stdout, "psMatrix", "Invert matrix and calculate determinant", true);
    7374
  • trunk/psLib/test/dataManip/tst_psMatrix05.c

    r1347 r1406  
    1010*  @author  Ross Harman, MHPCC
    1111*
    12 *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
    13 *  @date  $Date: 2004-07-30 03:13:08 $
     12*  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
     13*  @date  $Date: 2004-08-06 22:34:06 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2222#define PRINT_MATRIX(IMAGE)                         \
    2323for(int i=0; i<IMAGE->numRows; i++) {           \
    24         for(int j=0; j<IMAGE->numCols; j++) {       \
    25                 printf("%f ", IMAGE->data.F64[i][j]);   \
    26             }                                          \
    27         printf("\n");                              \
    28     }
    29    
    30    
     24    for(int j=0; j<IMAGE->numCols; j++) {       \
     25        printf("%f ", IMAGE->data.F64[i][j]);   \
     26    }                                          \
     27    printf("\n");                              \
     28}
     29
     30
    3131int main( int argc,
    3232          char* argv[] )
     
    3535    psImage *inImage1 = NULL;
    3636    psImage *inImage2 = NULL;
    37    
    38    
     37
     38
    3939    // Test A - Create input and output images
    4040    printPositiveTestHeader( stdout, "psMatrix", "Create input and output images" );
     
    5454    PRINT_MATRIX( inImage2 );
    5555    printFooter( stdout, "psMatrix", "Create input and output images", true );
    56    
    57    
     56
     57
    5858    // Test B - Multiply images
    5959    printPositiveTestHeader( stdout, "psMatrix", "Multiply images" );
     
    6161    PRINT_MATRIX( outImage );
    6262    printFooter( stdout, "psMatrix", "Multiply images", true );
    63    
    64    
     63
     64
    6565    // Test C - Free input and output images
    6666    printPositiveTestHeader( stdout, "psMatrix", "Free input and output images" );
     
    7070    int nLeaks = psMemCheckLeaks( 0, NULL, stdout );
    7171    if ( nLeaks != 0 ) {
    72             printf( "ERROR: Found %d memory leaks\n", nLeaks );
    73         }
     72        printf( "ERROR: Found %d memory leaks\n", nLeaks );
     73    }
    7474    int nBad = psMemCheckCorruption( 0 );
    7575    if ( nBad ) {
    76             printf( "ERROR: Found %d bad memory blocks\n", nBad );
    77         }
     76        printf( "ERROR: Found %d bad memory blocks\n", nBad );
     77    }
    7878    printFooter( stdout, "psMatrix" , "Free input and output images", true );
    79    
     79
    8080    return 0;
    8181}
  • trunk/psLib/test/dataManip/tst_psMatrix06.c

    r1348 r1406  
    1010*  @author  Ross Harman, MHPCC
    1111*
    12 *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
    13 *  @date  $Date: 2004-07-30 03:48:15 $
     12*  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
     13*  @date  $Date: 2004-08-06 22:34:06 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2222#define PRINT_MATRIX(IMAGE)                         \
    2323for(int i=0; i<IMAGE->numRows; i++) {           \
    24         for(int j=0; j<IMAGE->numCols; j++) {       \
    25                 printf("%f ", IMAGE->data.F64[i][j]);   \
    26             }                                          \
    27         printf("\n");                              \
    28     }
    29    
    30    
     24    for(int j=0; j<IMAGE->numCols; j++) {       \
     25        printf("%f ", IMAGE->data.F64[i][j]);   \
     26    }                                          \
     27    printf("\n");                              \
     28}
     29
     30
    3131int main( int argc,
    3232          char* argv[] )
     
    3434    psImage * outImage = NULL;
    3535    psImage *inImage = NULL;
    36    
    37    
     36
     37
    3838    // Test A - Create input and output images
    3939    printPositiveTestHeader( stdout, "psMatrix", "Create input and output images" );
    4040    outImage = ( psImage* ) psImageAlloc( 4, 4, PS_TYPE_F64 );
    4141    inImage = ( psImage* ) psImageAlloc( 4, 4, PS_TYPE_F64 );
    42    
     42
    4343    inImage->data.F64[ 0 ][ 0 ] = 1. / 1.;
    4444    inImage->data.F64[ 0 ][ 1 ] = 1. / 2.;
    4545    inImage->data.F64[ 0 ][ 2 ] = 1. / 3.;
    4646    inImage->data.F64[ 0 ][ 3 ] = 1. / 4.;
    47    
     47
    4848    inImage->data.F64[ 1 ][ 0 ] = 1. / 2.;
    4949    inImage->data.F64[ 1 ][ 1 ] = 1. / 3.;
    5050    inImage->data.F64[ 1 ][ 2 ] = 1. / 4.;
    5151    inImage->data.F64[ 1 ][ 3 ] = 1. / 5.;
    52    
     52
    5353    inImage->data.F64[ 2 ][ 0 ] = 1. / 3.;
    5454    inImage->data.F64[ 2 ][ 1 ] = 1. / 4.;
    5555    inImage->data.F64[ 2 ][ 2 ] = 1. / 5.;
    5656    inImage->data.F64[ 2 ][ 3 ] = 1. / 6.;
    57    
     57
    5858    inImage->data.F64[ 3 ][ 0 ] = 1. / 4.;
    5959    inImage->data.F64[ 3 ][ 1 ] = 1. / 5.;
    6060    inImage->data.F64[ 3 ][ 2 ] = 1. / 6.;
    6161    inImage->data.F64[ 3 ][ 3 ] = 1. / 7.;
    62    
     62
    6363    PRINT_MATRIX( inImage );
    6464    printFooter( stdout, "psMatrix", "Create input and output images", true );
    65    
    66    
     65
     66
    6767    // Test B - Calculate Eigenvectors
    6868    printPositiveTestHeader( stdout, "psMatrix", "Calculate Eigenvectors" );
     
    7070    PRINT_MATRIX( outImage );
    7171    printFooter( stdout, "psMatrix", "Calculate Eigenvectors", true );
    72    
    73    
     72
     73
    7474    // Test C - Free input and output images
    7575    printPositiveTestHeader( stdout, "psMatrix", "Free input and output images" );
     
    7878    int nLeaks = psMemCheckLeaks( 0, NULL, stdout );
    7979    if ( nLeaks != 0 ) {
    80             printf( "ERROR: Found %d memory leaks\n", nLeaks );
    81         }
     80        printf( "ERROR: Found %d memory leaks\n", nLeaks );
     81    }
    8282    int nBad = psMemCheckCorruption( 0 );
    8383    if ( nBad ) {
    84             printf( "ERROR: Found %d bad memory blocks\n", nBad );
    85         }
     84        printf( "ERROR: Found %d bad memory blocks\n", nBad );
     85    }
    8686    printFooter( stdout, "psMatrix" , "Free input and output images", true );
    87    
     87
    8888    return 0;
    8989}
  • trunk/psLib/test/dataManip/tst_psMatrix07.c

    r1073 r1406  
    1616 *  @author  Ross Harman, MHPCC
    1717 *
    18  *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
    19  *  @date  $Date: 2004-06-23 23:00:17 $
     18 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
     19 *  @date  $Date: 2004-08-06 22:34:06 $
    2020 *
    2121 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8888    if(v1->type.dimen != PS_DIMEN_VECTOR) {
    8989        printf("Error: Resulting image is not PS_DIMEN_VECTOR\n");
    90     } else if(v1 != tempVector) {
    91         printf("Error: Return pointer not equal to output argument pointer\n");
    92     }
     90    } else
     91        if(v1 != tempVector) {
     92            printf("Error: Return pointer not equal to output argument pointer\n");
     93        }
    9394    printFooter(stdout, "psMatrix", "Convert matrix to PS_DIMEN_VECTOR vector", true);
    9495
     
    108109    if(v1->type.dimen != PS_DIMEN_TRANSV) {
    109110        printf("Error: Resulting image is not PS_DIMEN_TRANSV\n");
    110     } else if(v1 != tempVector) {
    111         printf("Error: Return pointer not equal to output argument pointer\n");
    112     }
     111    } else
     112        if(v1 != tempVector) {
     113            printf("Error: Return pointer not equal to output argument pointer\n");
     114        }
    113115    printFooter(stdout, "psMatrix", "Convert matrix to PS_DIMEN_TRANSV vector", true);
    114116
     
    128130    if(m2->type.dimen != PS_DIMEN_IMAGE) {
    129131        printf("Error: Resulting image is not PS_DIMEN_IMAGE\n");
    130     } else if(m2 != tempImage) {
    131         printf("Error: Return pointer not equal to output argument pointer\n");
    132     }
     132    } else
     133        if(m2 != tempImage) {
     134            printf("Error: Return pointer not equal to output argument pointer\n");
     135        }
    133136    printFooter(stdout, "psMatrix", "Convert PS_DIMEN_VECTOR vector to matrix", true);
    134137
     
    149152    if(m3->type.dimen != PS_DIMEN_IMAGE) {
    150153        printf("Error: Resulting image is not PS_DIMEN_IMAGE\n");
    151     } else if(m3 != tempImage) {
    152         printf("Error: Return pointer not equal to output argument pointer\n");
    153     }
     154    } else
     155        if(m3 != tempImage) {
     156            printf("Error: Return pointer not equal to output argument pointer\n");
     157        }
    154158    printFooter(stdout, "psMatrix", "Convert PS_DIMEN_TRANSV vector to matrix", true);
    155159
  • trunk/psLib/test/dataManip/tst_psMatrixVectorArithmetic01.c

    r1114 r1406  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-06-29 01:52:19 $
     12 *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-08-06 22:34:06 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  • trunk/psLib/test/dataManip/tst_psMatrixVectorArithmetic02.c

    r1365 r1406  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-08-02 19:43:23 $
     12 *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-08-06 22:34:06 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2525#define PRINT_SCALAR(SCALAR,TYPE)                                                                            \
    2626if(PS_IS_PSELEMTYPE_COMPLEX(SCALAR->type.type)) {                                                            \
    27         printf("%.2f%f+.2i ", creal(SCALAR->data.TYPE), cimag(SCALAR->data.TYPE));                                   \
    28     } else if(PS_IS_PSELEMTYPE_INT(SCALAR->type.type)) {                                                         \
    29         printf("%d", (int)SCALAR->data.TYPE);                                                                    \
    30     } else {                                                                                                     \
    31         printf("%.2f", (double)SCALAR->data.TYPE);                                                                 \
    32     }                                                                                                            \
     27    printf("%.2f%f+.2i ", creal(SCALAR->data.TYPE), cimag(SCALAR->data.TYPE));                                   \
     28} else if(PS_IS_PSELEMTYPE_INT(SCALAR->type.type)) {                                                         \
     29    printf("%d", (int)SCALAR->data.TYPE);                                                                    \
     30} else {                                                                                                     \
     31    printf("%.2f", (double)SCALAR->data.TYPE);                                                                 \
     32}                                                                                                            \
    3333printf("\n\n");
    3434
     
    3636#define PRINT_VECTOR(VECTOR,TYPE)                                                                            \
    3737for(int i=0; i<VECTOR->n; i++) {                                                                             \
    38         if(PS_IS_PSELEMTYPE_COMPLEX(VECTOR->type.type)) {                                                        \
    39                 printf("%.2f%+.2fi\n", creal(VECTOR->data.TYPE[i]), cimag(VECTOR->data.TYPE[i]));                        \
    40             } else if(PS_IS_PSELEMTYPE_INT(VECTOR->type.type)) {                                                     \
    41                 printf("%d\n", (int)VECTOR->data.TYPE[i]);                                                           \
    42             } else {                                                                                                 \
    43                 printf("%.2f\n", (double)VECTOR->data.TYPE[i]);                                                        \
    44             }                                                                                                        \
    45     }                                                                                                            \
     38    if(PS_IS_PSELEMTYPE_COMPLEX(VECTOR->type.type)) {                                                        \
     39        printf("%.2f%+.2fi\n", creal(VECTOR->data.TYPE[i]), cimag(VECTOR->data.TYPE[i]));                        \
     40    } else if(PS_IS_PSELEMTYPE_INT(VECTOR->type.type)) {                                                     \
     41        printf("%d\n", (int)VECTOR->data.TYPE[i]);                                                           \
     42    } else {                                                                                                 \
     43        printf("%.2f\n", (double)VECTOR->data.TYPE[i]);                                                        \
     44    }                                                                                                        \
     45}                                                                                                            \
    4646printf("\n");
    4747
     
    4949#define PRINT_MATRIX(IMAGE,TYPE)                                                                             \
    5050for(int i=IMAGE->numRows-1; i>-1; i--) {                                                                     \
    51         for(int j=0; j<IMAGE->numCols; j++) {                                                                    \
    52                 if(PS_IS_PSELEMTYPE_COMPLEX(IMAGE->type.type)) {                                                     \
    53                         printf("%.2f%+.2fi ", creal(IMAGE->data.TYPE[i][j]), cimag(IMAGE->data.TYPE[i][j]));                 \
    54                     } else if(PS_IS_PSELEMTYPE_INT(IMAGE->type.type)) {                                                  \
    55                         printf("%d ", (int)IMAGE->data.TYPE[i][j]);                                                      \
    56                     } else {                                                                                             \
    57                         printf("%.2f ", (double)IMAGE->data.TYPE[i][j]);                                                   \
    58                     }                                                                                                    \
    59             }                                                                                                        \
    60         printf("\n");                                                                                            \
    61     }                                                                                                            \
     51    for(int j=0; j<IMAGE->numCols; j++) {                                                                    \
     52        if(PS_IS_PSELEMTYPE_COMPLEX(IMAGE->type.type)) {                                                     \
     53            printf("%.2f%+.2fi ", creal(IMAGE->data.TYPE[i][j]), cimag(IMAGE->data.TYPE[i][j]));                 \
     54        } else if(PS_IS_PSELEMTYPE_INT(IMAGE->type.type)) {                                                  \
     55            printf("%d ", (int)IMAGE->data.TYPE[i][j]);                                                      \
     56        } else {                                                                                             \
     57            printf("%.2f ", (double)IMAGE->data.TYPE[i][j]);                                                   \
     58        }                                                                                                    \
     59    }                                                                                                        \
     60    printf("\n");                                                                                            \
     61}                                                                                                            \
    6262printf("\n");
    6363
     
    6666psVector *NAME = (psVector*)psVectorAlloc(SIZE, PS_TYPE_##TYPE);                                             \
    6767for(int i=0; i<SIZE; i++) {                                                                                  \
    68         NAME->data.TYPE[i] = VALUE;                                                                              \
    69     }                                                                                                            \
     68    NAME->data.TYPE[i] = VALUE;                                                                              \
     69}                                                                                                            \
    7070NAME->n = SIZE;
    7171
     
    7474psImage *NAME = (psImage*)psImageAlloc(NCOLS,NROWS,PS_TYPE_##TYPE);                                          \
    7575for(int i=0; i<NAME->numRows; i++) {                                                                         \
    76         for(int j=0; j<NAME->numCols; j++) {                                                                     \
    77                 NAME->data.TYPE[i][j] = VALUE;                                                                       \
    78             }                                                                                                        \
    79     }
    80    
    81    
     76    for(int j=0; j<NAME->numCols; j++) {                                                                     \
     77        NAME->data.TYPE[i][j] = VALUE;                                                                       \
     78    }                                                                                                        \
     79}
     80
     81
    8282#define CHECK_MEMORY                                                                                         \
    8383psMemCheckLeaks(0, NULL, stdout);                                                                            \
    8484int nBad = psMemCheckCorruption(0);                                                                          \
    8585if(nBad) {                                                                                                   \
    86         printf("ERROR: Found %d bad memory blocks\n", nBad);                                                     \
    87     }
    88    
    89    
     86    printf("ERROR: Found %d bad memory blocks\n", nBad);                                                     \
     87}
     88
     89
    9090int main( int argc, char* argv[] )
    9191{
     
    109109        printFooter(stdout, "psMatrixVectorArithmetic", "Test matrix psUnaryOp", true);                      \
    110110    }
    111    
     111
    112112    testBinaryOpM( abs, S32, -10, 0, 3, 2 );
    113113    testBinaryOpM( abs, F32, -10.0, 0.0, 3, 2 );
     
    178178    testBinaryOpM( datan, F64, 1.0, 0.0, 3, 2 );
    179179    testBinaryOpM( datan, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 2 );
    180    
    181    
     180
     181
    182182    // Test vector unary operations
    183183    #define testBinaryOpV(OP,TYPE,VALUE1,VALUE2,SIZE)                                                        \
     
    198198        printFooter(stdout, "psMatrixVectorArithmetic", "Test vector psUnaryOp", true);                      \
    199199    }
    200    
     200
    201201    testBinaryOpV( abs, S32, -10, 0, 3 );
    202202    testBinaryOpV( abs, F32, -10.0, 0.0, 3 );
     
    267267    testBinaryOpV( datan, F64, 1.0, 0.0, 3 );
    268268    testBinaryOpV( datan, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3 );
    269    
     269
    270270    return 0;
    271271}
  • trunk/psLib/test/dataManip/tst_psMatrixVectorArithmetic03.c

    r1150 r1406  
    1515 *  @author  Ross Harman, MHPCC
    1616 *
    17  *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
    18  *  @date  $Date: 2004-06-30 20:07:07 $
     17 *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
     18 *  @date  $Date: 2004-08-06 22:34:06 $
    1919 *
    2020 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  • trunk/psLib/test/dataManip/tst_psMinimize00.c

    r1177 r1406  
    4545        tmp = 1.0;
    4646        tmp = x;
    47     } else if (whichParamDeriv == 1) {
    48         tmp = x;
    49         tmp = x*x;
    50     } else if (whichParamDeriv == 2) {
    51         tmp = y;
    52         tmp = y*y;
    53     } else if (whichParamDeriv == 3) {
    54         tmp = x * x * y;
    55     }
     47    } else
     48        if (whichParamDeriv == 1) {
     49            tmp = x;
     50            tmp = x*x;
     51        } else
     52            if (whichParamDeriv == 2) {
     53                tmp = y;
     54                tmp = y*y;
     55            } else
     56                if (whichParamDeriv == 3) {
     57                    tmp = x * x * y;
     58                }
    5659
    5760    //    printf("--------- myFuncDeriv((%.1f %.1f) %.1f %.1f %.1f %.1f (%d)) is %.1f ---------\n",
  • trunk/psLib/test/dataManip/tst_psMinimize01.c

    r1177 r1406  
    4444    if (whichParamDeriv == 0) {
    4545        tmp = exp(-lambda * x);
    46     } else if (whichParamDeriv == 1) {
    47         tmp = -x * A * exp(-lambda * x);
    48     } else if (whichParamDeriv == 2) {
    49         tmp = 1.0;
    50     }
     46    } else
     47        if (whichParamDeriv == 1) {
     48            tmp = -x * A * exp(-lambda * x);
     49        } else
     50            if (whichParamDeriv == 2) {
     51                tmp = 1.0;
     52            }
    5153
    5254    //    printf("--------- myFuncDeriv((%.1f) %.1f %.1f %.1f, %d) is %.1f ---------\n",
  • trunk/psLib/test/dataManip/tst_psMinimize02.c

    r1185 r1406  
    4444    if (whichParamDeriv == 0) {
    4545        tmp = 20.0 * (x - P0);
    46     } else if (whichParamDeriv == 1) {
    47         tmp = 40.0 * (y - P1);
    48     }
     46    } else
     47        if (whichParamDeriv == 1) {
     48            tmp = 40.0 * (y - P1);
     49        }
    4950
    5051    //    printf("--------- myFuncDeriv((%.1f %.1f) %.1f %.1f (%d)) is %.1f ---------\n",
     
    8384        tmp = 1.0;
    8485        tmp = x;
    85     } else if (whichParamDeriv == 1) {
    86         tmp = x;
    87         tmp = x*x;
    88     } else if (whichParamDeriv == 2) {
    89         tmp = y;
    90         tmp = y*y;
    91     } else if (whichParamDeriv == 3) {
    92         tmp = x * x * y;
    93     }
     86    } else
     87        if (whichParamDeriv == 1) {
     88            tmp = x;
     89            tmp = x*x;
     90        } else
     91            if (whichParamDeriv == 2) {
     92                tmp = y;
     93                tmp = y*y;
     94            } else
     95                if (whichParamDeriv == 3) {
     96                    tmp = x * x * y;
     97                }
    9498
    9599    printf("--------- myFuncDeriv((%.1f %.1f) %.1f %.1f %.1f %.1f (%d)) is %.1f ---------\n",
  • trunk/psLib/test/dataManip/tst_psMinimize03.c

    r1185 r1406  
    4444    if (whichParamDeriv == 0) {
    4545        tmp = 20.0 * (x - P0);
    46     } else if (whichParamDeriv == 1) {
    47         tmp = 40.0 * (y - P1);
    48     }
     46    } else
     47        if (whichParamDeriv == 1) {
     48            tmp = 40.0 * (y - P1);
     49        }
    4950
    5051    //    printf("--------- myFuncDeriv((%.1f %.1f) %.1f %.1f (%d)) is %.1f ---------\n",
     
    8384        tmp = 1.0;
    8485        tmp = x;
    85     } else if (whichParamDeriv == 1) {
    86         tmp = x;
    87         tmp = x*x;
    88     } else if (whichParamDeriv == 2) {
    89         tmp = y;
    90         tmp = y*y;
    91     } else if (whichParamDeriv == 3) {
    92         tmp = x * x * y;
    93     }
     86    } else
     87        if (whichParamDeriv == 1) {
     88            tmp = x;
     89            tmp = x*x;
     90        } else
     91            if (whichParamDeriv == 2) {
     92                tmp = y;
     93                tmp = y*y;
     94            } else
     95                if (whichParamDeriv == 3) {
     96                    tmp = x * x * y;
     97                }
    9498
    9599    printf("--------- myFuncDeriv((%.1f %.1f) %.1f %.1f %.1f %.1f (%d)) is %.1f ---------\n",
  • trunk/psLib/test/dataManip/tst_psStats07.c

    r1365 r1406  
    4545    float realN50WithMask = ( float ) N / 4;
    4646    float realNfitWithMask = ( float ) N / 4;
    47    
    48    
     47
     48
    4949    /*************************************************************************/
    5050    /*  Allocate and initialize data structures                              */
     
    5555                            PS_STAT_ROBUST_STDEV |
    5656                            PS_STAT_ROBUST_QUARTILE );
    57                            
     57
    5858    maskVector = psVectorAlloc( N, PS_TYPE_U8 );
    5959    maskVector->n = N;
     
    6161    // Set the mask vector and calculate the expected maximum.
    6262    for ( i = 0;i < N;i++ ) {
    63             if ( i < ( N / 2 ) ) {
    64                     maskVector->data.U8[ i ] = 0;
    65                     count++;
    66                 } else {
    67                     maskVector->data.U8[ i ] = 1;
    68                 }
     63        if ( i < ( N / 2 ) ) {
     64            maskVector->data.U8[ i ] = 0;
     65            count++;
     66        } else {
     67            maskVector->data.U8[ i ] = 1;
    6968        }
     69    }
    7070    /*************************************************************************/
    7171    /*  Call psVectorStats() with no vector mask.                            */
     
    7474                             "psStats functions",
    7575                             "PS_STAT_ROBUST_STATS: robust mean: no vector mask" );
    76                              
     76
    7777    myStats = psVectorStats( myStats, myVector, NULL, 0 );
    78    
     78
    7979    printf( "The expected Mean was %.2f; the calculated Mean was %.2f\n",
    8080            realMeanNoMask, myStats->robustMean );
    81            
     81
    8282    if ( fabs( myStats->robustMean - realMeanNoMask ) < ( ERROR_TOLERANCE * realMeanNoMask ) ) {
    83             testStatus = true;
    84         } else {
    85             testStatus = false;
    86             globalTestStatus = false;
    87         }
     83        testStatus = true;
     84    } else {
     85        testStatus = false;
     86        globalTestStatus = false;
     87    }
    8888    printFooter( stdout,
    8989                 "psVector functions",
    9090                 "PS_STAT_ROBUST_STATS: robust mean: no vector mask",
    9191                 testStatus );
    92                  
    93                  
     92
     93
    9494    printPositiveTestHeader( stdout,
    9595                             "psStats functions",
    9696                             "PS_STAT_ROBUST_STATS: robust Median: no vector mask" );
    97                              
     97
    9898    printf( "The expected Median was %.2f; the calculated Median was %.2f\n",
    9999            realMedianNoMask, myStats->robustMedian );
    100100    if ( fabs( myStats->robustMedian - realMedianNoMask ) < ( ERROR_TOLERANCE * realMedianNoMask ) ) {
    101             testStatus = true;
    102         } else {
    103             testStatus = false;
    104             globalTestStatus = false;
    105         }
     101        testStatus = true;
     102    } else {
     103        testStatus = false;
     104        globalTestStatus = false;
     105    }
    106106    printFooter( stdout,
    107107                 "psVector functions",
    108108                 "PS_STAT_ROBUST_STATS: robust Median: no vector mask",
    109109                 testStatus );
    110                  
     110
    111111    printPositiveTestHeader( stdout,
    112112                             "psStats functions",
    113113                             "PS_STAT_ROBUST_STATS: robust Mode: no vector mask" );
    114                              
    115                              
     114
     115
    116116    printf( "The expected Mode was %.2f; the calculated Mode was %.2f\n",
    117117            realModeNoMask, myStats->robustMode );
    118118    if ( fabs( myStats->robustMode - realModeNoMask ) < ( ERROR_TOLERANCE * realModeNoMask ) ) {
    119             testStatus = true;
    120         } else {
    121             testStatus = false;
    122             globalTestStatus = false;
    123         }
     119        testStatus = true;
     120    } else {
     121        testStatus = false;
     122        globalTestStatus = false;
     123    }
    124124    printFooter( stdout,
    125125                 "psVector functions",
    126126                 "PS_STAT_ROBUST_STATS: robust Mode: no vector mask",
    127127                 testStatus );
    128                  
    129                  
    130                  
     128
     129
     130
    131131    printPositiveTestHeader( stdout,
    132132                             "psStats functions",
    133133                             "PS_STAT_ROBUST_STATS: robust Stdev: no vector mask" );
    134                              
     134
    135135    printf( "The expected Stdev was %.2f; the calculated Stdev was %.2f\n",
    136136            realStdevNoMask, myStats->robustStdev );
    137137    if ( fabs( myStats->robustStdev - realStdevNoMask ) < ( ERROR_TOLERANCE * realStdevNoMask ) ) {
    138             testStatus = true;
    139         } else {
    140             testStatus = false;
    141             globalTestStatus = false;
    142         }
     138        testStatus = true;
     139    } else {
     140        testStatus = false;
     141        globalTestStatus = false;
     142    }
    143143    printFooter( stdout,
    144144                 "psVector functions",
    145145                 "PS_STAT_ROBUST_STATS: robust Stdev: no vector mask",
    146146                 testStatus );
    147                  
    148                  
    149                  
     147
     148
     149
    150150    printPositiveTestHeader( stdout,
    151151                             "psStats functions",
    152152                             "PS_STAT_ROBUST_STATS: lower quartile: no vector mask" );
    153                              
     153
    154154    printf( "The expected LQ was %.2f; the calculated LQ was %.2f\n",
    155155            realLQNoMask, myStats->robustLQ );
    156            
     156
    157157    if ( fabs( myStats->robustLQ - realLQNoMask ) < ( ERROR_TOLERANCE * realLQNoMask ) ) {
    158             testStatus = true;
    159         } else {
    160             testStatus = false;
    161             globalTestStatus = false;
    162         }
     158        testStatus = true;
     159    } else {
     160        testStatus = false;
     161        globalTestStatus = false;
     162    }
    163163    printFooter( stdout,
    164164                 "psVector functions",
    165165                 "PS_STAT_ROBUST_STATS: lower quartile: no vector mask",
    166166                 testStatus );
    167                  
    168                  
    169                  
     167
     168
     169
    170170    printPositiveTestHeader( stdout,
    171171                             "psStats functions",
    172172                             "PS_STAT_ROBUST_STATS: upper quartile: no vector mask" );
    173                              
     173
    174174    printf( "The expected UQ was %.2f; the calculated UQ was %.2f\n",
    175175            realUQNoMask, myStats->robustUQ );
    176176    if ( fabs( myStats->robustUQ - realUQNoMask ) < ( ERROR_TOLERANCE * realUQNoMask ) ) {
    177             testStatus = true;
    178         } else {
    179             testStatus = false;
    180             globalTestStatus = false;
    181         }
     177        testStatus = true;
     178    } else {
     179        testStatus = false;
     180        globalTestStatus = false;
     181    }
    182182    printFooter( stdout,
    183183                 "psVector functions",
    184184                 "PS_STAT_ROBUST_STATS: lower quartile: no vector mask",
    185185                 testStatus );
    186                  
    187                  
    188                  
     186
     187
     188
    189189    printPositiveTestHeader( stdout,
    190190                             "psStats functions",
    191191                             "PS_STAT_ROBUST_STATS: robust N50: no vector mask" );
    192                              
     192
    193193    // XXX:
    194194    realN50NoMask = myStats->robustN50;
    195    
     195
    196196    printf( "The expected N50 was %.2f; the calculated N50 was %.2f\n",
    197197            realN50NoMask, myStats->robustN50 );
    198198    if ( fabs( myStats->robustN50 - realN50NoMask ) < ( ERROR_TOLERANCE * realN50NoMask ) ) {
    199             testStatus = true;
    200         } else {
    201             testStatus = false;
    202             globalTestStatus = false;
    203         }
     199        testStatus = true;
     200    } else {
     201        testStatus = false;
     202        globalTestStatus = false;
     203    }
    204204    printFooter( stdout,
    205205                 "psVector functions",
    206206                 "PS_STAT_ROBUST_STATS: robust N50: no vector mask",
    207207                 testStatus );
    208                  
    209                  
    210                  
     208
     209
     210
    211211    printPositiveTestHeader( stdout,
    212212                             "psStats functions",
    213213                             "PS_STAT_ROBUST_STATS: robust Nfit: no vector mask" );
    214                              
     214
    215215    // XXX:
    216216    realNfitNoMask = myStats->robustNfit;
    217    
     217
    218218    printf( "The expected Nfit was %.2f; the calculated Nfit was %.2f\n",
    219219            realNfitNoMask, myStats->robustNfit );
    220220    if ( fabs( myStats->robustNfit - realNfitNoMask ) < ( ERROR_TOLERANCE * realNfitNoMask ) ) {
    221             testStatus = true;
    222         } else {
    223             testStatus = false;
    224             globalTestStatus = false;
    225         }
     221        testStatus = true;
     222    } else {
     223        testStatus = false;
     224        globalTestStatus = false;
     225    }
    226226    printFooter( stdout,
    227227                 "psVector functions",
    228228                 "PS_STAT_ROBUST_STATS: robust Nfit: no vector mask",
    229229                 testStatus );
    230                  
    231                  
     230
     231
    232232    return ( 0 );
    233    
     233
    234234    /*************************************************************************/
    235235    /*  Call psVectorStats() with vector mask.                               */
     
    238238                             "psStats functions",
    239239                             "PS_STAT_ROBUST_STATS: robust mean: with vector mask" );
    240                              
     240
    241241    printf( "Calling psVectorStats() on a vector with elements masked.\n" );
    242242    myStats = psVectorStats( myStats, myVector, maskVector, 1 );
     
    245245            realMeanWithMask, myStats->robustMean );
    246246    if ( fabs( myStats->robustMean - realMeanWithMask ) < ( ERROR_TOLERANCE * realMeanWithMask ) ) {
    247             testStatus = true;
    248         } else {
    249             testStatus = false;
    250             globalTestStatus = false;
    251         }
     247        testStatus = true;
     248    } else {
     249        testStatus = false;
     250        globalTestStatus = false;
     251    }
    252252    printFooter( stdout,
    253253                 "psVector functions",
    254254                 "PS_STAT_ROBUST_STATS: robust mean: with vector mask",
    255255                 testStatus );
    256                  
    257                  
    258                  
     256
     257
     258
    259259    printPositiveTestHeader( stdout,
    260260                             "psStats functions",
    261261                             "PS_STAT_ROBUST_STATS: robust Median: with vector mask" );
    262                              
     262
    263263    printf( "The expected Median was %.2f; the calculated Median was %.2f\n",
    264264            realMedianWithMask, myStats->robustMedian );
    265265    if ( fabs( myStats->robustMedian - realMedianWithMask ) < ( ERROR_TOLERANCE * realMedianWithMask ) ) {
    266             testStatus = true;
    267         } else {
    268             testStatus = false;
    269             globalTestStatus = false;
    270         }
     266        testStatus = true;
     267    } else {
     268        testStatus = false;
     269        globalTestStatus = false;
     270    }
    271271    printFooter( stdout,
    272272                 "psVector functions",
    273273                 "PS_STAT_ROBUST_STATS: robust Median: with vector mask",
    274274                 testStatus );
    275                  
    276                  
    277                  
     275
     276
     277
    278278    printPositiveTestHeader( stdout,
    279279                             "psStats functions",
    280280                             "PS_STAT_ROBUST_STATS: robust Mode: with vector mask" );
    281                              
     281
    282282    printf( "The expected Mode was %.2f; the calculated Mode was %.2f\n",
    283283            realModeWithMask, myStats->robustMode );
    284284    if ( fabs( myStats->robustMode - realModeWithMask ) < ( ERROR_TOLERANCE * realModeWithMask ) ) {
    285             testStatus = true;
    286         } else {
    287             testStatus = false;
    288             globalTestStatus = false;
    289         }
     285        testStatus = true;
     286    } else {
     287        testStatus = false;
     288        globalTestStatus = false;
     289    }
    290290    printFooter( stdout,
    291291                 "psVector functions",
    292292                 "PS_STAT_ROBUST_STATS: robust Mode: with vector mask",
    293293                 testStatus );
    294                  
    295                  
    296                  
     294
     295
     296
    297297    printPositiveTestHeader( stdout,
    298298                             "psStats functions",
    299299                             "PS_STAT_ROBUST_STATS: robust Stdev: with vector mask" );
    300                              
     300
    301301    printf( "The expected Stdev was %.2f; the calculated Stdev was %.2f\n",
    302302            realStdevWithMask, myStats->robustStdev );
    303303    if ( fabs( myStats->robustStdev - realStdevWithMask ) < ( ERROR_TOLERANCE * realStdevWithMask ) ) {
    304             testStatus = true;
    305         } else {
    306             testStatus = false;
    307             globalTestStatus = false;
    308         }
     304        testStatus = true;
     305    } else {
     306        testStatus = false;
     307        globalTestStatus = false;
     308    }
    309309    printFooter( stdout,
    310310                 "psVector functions",
    311311                 "PS_STAT_ROBUST_STATS: robust Stdev: with vector mask",
    312312                 testStatus );
    313                  
    314                  
    315                  
     313
     314
     315
    316316    printPositiveTestHeader( stdout,
    317317                             "psStats functions",
    318318                             "PS_STAT_ROBUST_STATS: lower quartile: with vector mask" );
    319                              
     319
    320320    printf( "The expected LQ was %.2f; the calculated LQ was %.2f\n",
    321321            realLQWithMask, myStats->robustLQ );
    322322    if ( fabs( myStats->robustLQ - realLQWithMask ) < ( ERROR_TOLERANCE * realLQWithMask ) ) {
    323             testStatus = true;
    324         } else {
    325             testStatus = false;
    326             globalTestStatus = false;
    327         }
     323        testStatus = true;
     324    } else {
     325        testStatus = false;
     326        globalTestStatus = false;
     327    }
    328328    printFooter( stdout,
    329329                 "psVector functions",
    330330                 "PS_STAT_ROBUST_STATS: lower quartile: with vector mask",
    331331                 testStatus );
    332                  
    333                  
    334                  
     332
     333
     334
    335335    printPositiveTestHeader( stdout,
    336336                             "psStats functions",
    337337                             "PS_STAT_ROBUST_STATS: upper quartile: with vector mask" );
    338                              
     338
    339339    printf( "The expected UQ was %.2f; the calculated UQ was %.2f\n",
    340340            realUQWithMask, myStats->robustUQ );
    341341    if ( fabs( myStats->robustUQ - realUQWithMask ) < ( ERROR_TOLERANCE * realUQWithMask ) ) {
    342             testStatus = true;
    343         } else {
    344             testStatus = false;
    345             globalTestStatus = false;
    346         }
     342        testStatus = true;
     343    } else {
     344        testStatus = false;
     345        globalTestStatus = false;
     346    }
    347347    printFooter( stdout,
    348348                 "psVector functions",
    349349                 "PS_STAT_ROBUST_STATS: lower quartile: with vector mask",
    350350                 testStatus );
    351                  
    352                  
    353                  
     351
     352
     353
    354354    printPositiveTestHeader( stdout,
    355355                             "psStats functions",
    356356                             "PS_STAT_ROBUST_STATS: robust N50: with vector mask" );
    357                              
     357
    358358    printf( "The expected N50 was %.2f; the calculated N50 was %.2f\n",
    359359            realN50WithMask, myStats->robustN50 );
    360360    if ( fabs( myStats->robustN50 - realN50WithMask ) < ( ERROR_TOLERANCE * realN50WithMask ) ) {
    361             testStatus = true;
    362         } else {
    363             testStatus = false;
    364             globalTestStatus = false;
    365         }
     361        testStatus = true;
     362    } else {
     363        testStatus = false;
     364        globalTestStatus = false;
     365    }
    366366    printFooter( stdout,
    367367                 "psVector functions",
    368368                 "PS_STAT_ROBUST_STATS: robust N50: with vector mask",
    369369                 testStatus );
    370                  
    371                  
    372                  
     370
     371
     372
    373373    printPositiveTestHeader( stdout,
    374374                             "psStats functions",
    375375                             "PS_STAT_ROBUST_STATS: robust Nfit: with vector mask" );
    376                              
     376
    377377    printf( "The expected Nfit was %.2f; the calculated Nfit was %.2f\n",
    378378            realNfitWithMask, myStats->robustNfit );
    379379    if ( fabs( myStats->robustNfit - realNfitWithMask ) < ( ERROR_TOLERANCE * realNfitWithMask ) ) {
    380             testStatus = true;
    381         } else {
    382             testStatus = false;
    383             globalTestStatus = false;
    384         }
     380        testStatus = true;
     381    } else {
     382        testStatus = false;
     383        globalTestStatus = false;
     384    }
    385385    printFooter( stdout,
    386386                 "psVector functions",
    387387                 "PS_STAT_ROBUST_STATS: robust Nfit: with vector mask",
    388388                 testStatus );
    389                  
    390                  
    391                  
     389
     390
     391
    392392    /*************************************************************************/
    393393    /*  Deallocate data structures                                           */
     
    396396                             "psStats functions",
    397397                             "psStats(): deallocating memory" );
    398                              
     398
    399399    psFree( myStats );
    400400    psFree( myVector );
    401401    psFree( maskVector );
    402    
     402
    403403    psMemCheckCorruption( 1 );
    404404    memLeaks = psMemCheckLeaks( currentId, NULL, NULL );
    405405    if ( 0 != memLeaks ) {
    406             psAbort( __func__, "Memory Leaks! (%d leaks)", memLeaks );
    407         }
    408        
     406        psAbort( __func__, "Memory Leaks! (%d leaks)", memLeaks );
     407    }
     408
    409409    printFooter( stdout,
    410410                 "psVector functions",
    411411                 "psStats(): deallocating memory",
    412412                 testStatus );
    413                  
     413
    414414    return ( !globalTestStatus );
    415415}
  • trunk/psLib/test/dataManip/tst_psVectorFFT.c

    r1404 r1406  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2004-08-06 21:50:13 $
     8*  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2004-08-06 22:34:06 $
    1010*
    1111*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Note: See TracChangeset for help on using the changeset viewer.