Changeset 2273 for trunk/psLib/test/dataManip/tst_psVectorFFT.c
- Timestamp:
- Nov 3, 2004, 3:05:00 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/dataManip/tst_psVectorFFT.c (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/dataManip/tst_psVectorFFT.c
r2204 r2273 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-1 0-27 00:57:33$8 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-11-04 01:05:00 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 85 85 vec2 = psVectorFFT( NULL, vec, PS_FFT_FORWARD ); 86 86 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?" ); 88 88 return 1; 89 89 } … … 94 94 if ( n == 1 || n == 99 ) { 95 95 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 ); 97 97 return 2; 98 98 } 99 99 } else { 100 100 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 ); 102 102 return 3; 103 103 } … … 108 108 vec3 = psVectorFFT( NULL, vec2, PS_FFT_REVERSE ); 109 109 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?" ); 111 111 return 4; 112 112 } … … 115 115 psF32 vecVal = crealf( vec3->data.C32[ n ] ) / 100; 116 116 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 ); 119 119 return 5; 120 120 } … … 150 150 vec2 = psVectorReal( vec2, vec ); 151 151 if ( vec2 == NULL ) { 152 psError( __func__, "psVectorReal returned a NULL?" );152 psError(PS_ERR_UNKNOWN,true, "psVectorReal returned a NULL?" ); 153 153 return 1; 154 154 } 155 155 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 ); 158 158 return 2; 159 159 } … … 161 161 vec3 = psVectorImaginary( vec3, vec ); 162 162 if ( vec3 == NULL ) { 163 psError( __func__, "psVectorImaginary returned a NULL?" );163 psError(PS_ERR_UNKNOWN,true, "psVectorImaginary returned a NULL?" ); 164 164 return 3; 165 165 } 166 166 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 ); 169 169 return 4; 170 170 } … … 175 175 psF32 i = ( n * 2 ); 176 176 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 ); 179 179 return 5; 180 180 } 181 181 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 ); 184 184 return 6; 185 185 } … … 230 230 // 3. verify that the result is a psC32 231 231 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 ); 234 234 return 1; 235 235 } … … 240 240 if ( fabsf( crealf( vec3->data.C32[ n ] ) - n ) > FLT_EPSILON || 241 241 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 ] ) ); 244 244 return 2; 245 245 }; … … 251 251 252 252 // 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)." ); 254 254 vec3 = psVectorComplex( vec3, vec, vec2 ); 255 255 // 8. verify that an appropriate error occurred. (this partially has to be done via inspection) 256 256 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." ); 258 258 return 3; 259 259 } … … 267 267 // 11. verify thet an appropriate error occurred. (actually, it isn't an error...) 268 268 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 ); 270 270 return 4; 271 271 } … … 302 302 // 3. verify result is psC32 303 303 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" ); 305 305 return 1; 306 306 } … … 310 310 if ( fabsf( crealf( vec->data.C32[ n ] ) - crealf( vec2->data.C32[ n ] ) ) > FLT_EPSILON || 311 311 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 ] ) ); 314 314 return 2; 315 315 }; … … 347 347 // 3. verify result is psF32 348 348 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." ); 350 350 return 1; 351 351 } … … 360 360 val = cabsf( vec->data.C32[ 0 ] ) * cabsf( vec->data.C32[ 0 ] ) / 100 / 100; 361 361 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 ); 364 364 return 2; 365 365 }; … … 370 370 371 371 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 ); 374 374 return 2; 375 375 }; … … 378 378 val = cabsf( vec->data.C32[ 50 ] ) * cabsf( vec->data.C32[ 50 ] ) / 100 / 100; 379 379 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 ); 382 382 return 2; 383 383 };
Note:
See TracChangeset
for help on using the changeset viewer.
