IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 3, 2004, 3:05:00 PM (22 years ago)
Author:
desonia
Message:

changed the psError signature to match SDRS. Also made misc. cleanups as
I was combing the files.

File:
1 edited

Legend:

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

    r2204 r2273  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2004-10-27 00:57:33 $
     8*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2004-11-04 01:05:00 $
    1010*
    1111*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8585    vec2 = psVectorFFT( NULL, vec, PS_FFT_FORWARD );
    8686    if ( vec2->type.type != PS_TYPE_C32 ) {
    87         psError( __func__, "FFT didn't produce complex values?" );
     87        psError(PS_ERR_UNKNOWN,true, "FFT didn't produce complex values?" );
    8888        return 1;
    8989    }
     
    9494        if ( n == 1 || n == 99 ) {
    9595            if ( fabsf( cabsf( vec2->data.C32[ n ] ) - 50.0f ) > 0.1f ) {
    96                 psError( __func__, "FFT didn't work for vector (n=%d)", n );
     96                psError(PS_ERR_UNKNOWN,true, "FFT didn't work for vector (n=%d)", n );
    9797                return 2;
    9898            }
    9999        } else {
    100100            if ( fabsf( cabsf( vec2->data.C32[ n ] ) ) > 0.1f ) {
    101                 psError( __func__, "FFT didn't work for vector (n=%d)", n );
     101                psError(PS_ERR_UNKNOWN,true, "FFT didn't work for vector (n=%d)", n );
    102102                return 3;
    103103            }
     
    108108    vec3 = psVectorFFT( NULL, vec2, PS_FFT_REVERSE );
    109109    if ( vec3->type.type != PS_TYPE_C32 ) {
    110         psError( __func__, "FFT didn't produce complex values?" );
     110        psError(PS_ERR_UNKNOWN,true, "FFT didn't produce complex values?" );
    111111        return 4;
    112112    }
     
    115115        psF32 vecVal = crealf( vec3->data.C32[ n ] ) / 100;
    116116        if ( fabsf( vecVal - val ) > 0.1f ) {
    117             psError( __func__, "Reverse FFT didn't give me the original vector back (n=%d) (%.2f vs %.2f)",
    118                      n, vecVal, val );
     117            psError(PS_ERR_UNKNOWN,true, "Reverse FFT didn't give me the original vector back (n=%d) (%.2f vs %.2f)",
     118                    n, vecVal, val );
    119119            return 5;
    120120        }
     
    150150    vec2 = psVectorReal( vec2, vec );
    151151    if ( vec2 == NULL ) {
    152         psError( __func__, "psVectorReal returned a NULL?" );
     152        psError(PS_ERR_UNKNOWN,true, "psVectorReal returned a NULL?" );
    153153        return 1;
    154154    }
    155155    if ( vec2->type.type != PS_TYPE_F32 ) {
    156         psError( __func__, "psVectorReal returned a wrong type (%d)?",
    157                  vec2->type.type );
     156        psError(PS_ERR_UNKNOWN,true, "psVectorReal returned a wrong type (%d)?",
     157                vec2->type.type );
    158158        return 2;
    159159    }
     
    161161    vec3 = psVectorImaginary( vec3, vec );
    162162    if ( vec3 == NULL ) {
    163         psError( __func__, "psVectorImaginary returned a NULL?" );
     163        psError(PS_ERR_UNKNOWN,true, "psVectorImaginary returned a NULL?" );
    164164        return 3;
    165165    }
    166166    if ( vec3->type.type != PS_TYPE_F32 ) {
    167         psError( __func__, "psVectorImaginary returned a wrong type (%d)?",
    168                  vec3->type.type );
     167        psError(PS_ERR_UNKNOWN,true, "psVectorImaginary returned a wrong type (%d)?",
     168                vec3->type.type );
    169169        return 4;
    170170    }
     
    175175        psF32 i = ( n * 2 );
    176176        if ( fabsf( vec2->data.F32[ n ] - r ) > FLT_EPSILON ) {
    177             psError( __func__, "psVectorReal didn't return the real portion at n=%d",
    178                      n );
     177            psError(PS_ERR_UNKNOWN,true, "psVectorReal didn't return the real portion at n=%d",
     178                    n );
    179179            return 5;
    180180        }
    181181        if ( fabsf( vec3->data.F32[ n ] - i ) > FLT_EPSILON ) {
    182             psError( __func__, "psVectorImaginary didn't return the real portion at n=%d",
    183                      n );
     182            psError(PS_ERR_UNKNOWN,true, "psVectorImaginary didn't return the real portion at n=%d",
     183                    n );
    184184            return 6;
    185185        }
     
    230230    // 3. verify that the result is a psC32
    231231    if ( vec3->type.type != PS_TYPE_C32 ) {
    232         psError( __func__, "Vector Type from psVectorComplex is not complex? (%d)",
    233                  vec3->type.type );
     232        psError(PS_ERR_UNKNOWN,true, "Vector Type from psVectorComplex is not complex? (%d)",
     233                vec3->type.type );
    234234        return 1;
    235235    }
     
    240240        if ( fabsf( crealf( vec3->data.C32[ n ] ) - n ) > FLT_EPSILON ||
    241241                fabsf( cimagf( vec3->data.C32[ n ] ) - ( n * 2 ) ) > FLT_EPSILON ) {
    242             psError( __func__, "psVectorComplex result is invalid (n=%d, %.2f+%.2fi)",
    243                      n, crealf( vec3->data.C32[ n ] ), cimagf( vec3->data.C32[ n ] ) );
     242            psError(PS_ERR_UNKNOWN,true, "psVectorComplex result is invalid (n=%d, %.2f+%.2fi)",
     243                    n, crealf( vec3->data.C32[ n ] ), cimagf( vec3->data.C32[ n ] ) );
    244244            return 2;
    245245        };
     
    251251
    252252    // 7. call psVectorComplex
    253     psLogMsg( __func__, PS_LOG_INFO, "Following should be an error (type mismatch)." );
     253    psLogMsg(__func__, PS_LOG_INFO, "Following should be an error (type mismatch)." );
    254254    vec3 = psVectorComplex( vec3, vec, vec2 );
    255255    // 8. verify that an appropriate error occurred. (this partially has to be done via inspection)
    256256    if ( vec3 != NULL ) {
    257         psError( __func__, "psVectorComplex returned a vector though input types mismatched." );
     257        psError(PS_ERR_UNKNOWN,true, "psVectorComplex returned a vector though input types mismatched." );
    258258        return 3;
    259259    }
     
    267267    // 11. verify thet an appropriate error occurred. (actually, it isn't an error...)
    268268    if ( vec3->n != 100 ) {
    269         psError( __func__, "psVectorComplex returned a larger vector than the input supported (%d).", vec3->n );
     269        psError(PS_ERR_UNKNOWN,true, "psVectorComplex returned a larger vector than the input supported (%d).", vec3->n );
    270270        return 4;
    271271    }
     
    302302    // 3. verify result is psC32
    303303    if ( vec2->type.type != PS_TYPE_C32 ) {
    304         psError( __func__, "the psVectorConjugate didn't return a C32 vector" );
     304        psError(PS_ERR_UNKNOWN,true, "the psVectorConjugate didn't return a C32 vector" );
    305305        return 1;
    306306    }
     
    310310        if ( fabsf( crealf( vec->data.C32[ n ] ) - crealf( vec2->data.C32[ n ] ) ) > FLT_EPSILON ||
    311311                fabsf( cimagf( vec->data.C32[ n ] ) + cimagf( vec2->data.C32[ n ] ) ) > FLT_EPSILON ) {
    312             psError( __func__, "psVectorComplex result is invalid (n=%d, %.2f+%.2fi)",
    313                      n, crealf( vec2->data.C32[ n ] ), cimagf( vec2->data.C32[ n ] ) );
     312            psError(PS_ERR_UNKNOWN,true, "psVectorComplex result is invalid (n=%d, %.2f+%.2fi)",
     313                    n, crealf( vec2->data.C32[ n ] ), cimagf( vec2->data.C32[ n ] ) );
    314314            return 2;
    315315        };
     
    347347    // 3. verify result is psF32
    348348    if ( vec2->type.type != PS_TYPE_F32 ) {
    349         psError( __func__, "the type was not PS_TYPE_F32." );
     349        psError(PS_ERR_UNKNOWN,true, "the type was not PS_TYPE_F32." );
    350350        return 1;
    351351    }
     
    360360    val = cabsf( vec->data.C32[ 0 ] ) * cabsf( vec->data.C32[ 0 ] ) / 100 / 100;
    361361    if ( fabsf( vec2->data.F32[ 0 ] - val ) > FLT_EPSILON ) {
    362         psError( __func__, "psVectorPowerSpectrum result is invalid (n=0, %.2f %.2f)",
    363                  vec2->data.F32[ 0 ], val );
     362        psError(PS_ERR_UNKNOWN,true, "psVectorPowerSpectrum result is invalid (n=0, %.2f %.2f)",
     363                vec2->data.F32[ 0 ], val );
    364364        return 2;
    365365    };
     
    370370
    371371        if ( fabsf( val - vec2->data.F32[ n ] ) > FLT_EPSILON ) {
    372             psError( __func__, "psVectorPowerSpectrum result is invalid (n=%d, %.2f %.2f)",
    373                      n, vec2->data.F32[ n ], val );
     372            psError(PS_ERR_UNKNOWN,true, "psVectorPowerSpectrum result is invalid (n=%d, %.2f %.2f)",
     373                    n, vec2->data.F32[ n ], val );
    374374            return 2;
    375375        };
     
    378378    val = cabsf( vec->data.C32[ 50 ] ) * cabsf( vec->data.C32[ 50 ] ) / 100 / 100;
    379379    if ( fabsf( vec2->data.F32[ 50 ] - val ) > FLT_EPSILON ) {
    380         psError( __func__, "psVectorPowerSpectrum result is invalid (n=50, %.2f %.2f)",
    381                  vec2->data.F32[ 0 ], val );
     380        psError(PS_ERR_UNKNOWN,true, "psVectorPowerSpectrum result is invalid (n=50, %.2f %.2f)",
     381                vec2->data.F32[ 0 ], val );
    382382        return 2;
    383383    };
Note: See TracChangeset for help on using the changeset viewer.