IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3313


Ignore:
Timestamp:
Feb 23, 2005, 2:19:51 PM (21 years ago)
Author:
desonia
Message:

changed psMatrix tests so that functions return NULL on error.

Location:
trunk/psLib
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataManip/psConstants.h

    r3264 r3313  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-02-17 19:26:23 $
     8 *  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-02-24 00:19:51 $
    1010 *
    1111 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    198198} \
    199199
    200 #define PS_VECTOR_CHECK_EMPTY(NAME, RVAL) \
     200#define PS_VECTOR_CHECK_EMPTY(NAME, RVAL) PS_VECTOR_CHECK_EMPTY_GENERAL(NAME, return RVAL)
     201#define PS_VECTOR_CHECK_EMPTY_GENERAL(NAME, CLEANUP) \
    201202if (NAME->n < 1) { \
    202203    psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
    203204            "Unallowable operation: psVector %s has no elements.", \
    204205            #NAME); \
    205     return(RVAL); \
     206    CLEANUP; \
    206207} \
    207208
  • trunk/psLib/src/dataManip/psMatrix.c

    r3290 r3313  
    2121 *  @author Robert DeSonia, MHPCC
    2222 *
    23  *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
    24  *  @date $Date: 2005-02-19 00:30:07 $
     23 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
     24 *  @date $Date: 2005-02-24 00:19:51 $
    2525 *
    2626 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5050
    5151/** Preprocessor macro to generate error for image dimensionality not set to PS_DIMEN_IMAGE */
    52 #define PS_CHECK_DIMEN_AND_TYPE(NAME, PS_DIMEN, RETURN)                                             \
     52#define PS_CHECK_DIMEN_AND_TYPE(NAME, PS_DIMEN, CLEANUP)                                             \
    5353if (NAME->type.dimen != PS_DIMEN) {                                                                 \
    5454    psError(PS_ERR_BAD_PARAMETER_TYPE, true,                                                        \
    5555            "Invalid operation. %s has incorrect dimensionality %d.", #NAME, PS_DIMEN);             \
    56     return RETURN;                                                                                  \
     56    CLEANUP;                                                                                  \
    5757} else if(NAME->type.type!=PS_TYPE_F64 && NAME->type.type!=PS_TYPE_F32) {                           \
    5858    psError(PS_ERR_BAD_PARAMETER_TYPE, true,                                                        \
    5959            "Invalid operation. %s not PS_TYPE_F64.", #NAME);                                       \
    60     return RETURN;                                                                                  \
     60    CLEANUP;                                                                                  \
    6161}
    6262
    6363/** Preprocessor macro to check that input is not equal to output */
    64 #define PS_CHECK_POINTERS(NAME1, NAME2, RETURN)                                                     \
     64#define PS_CHECK_POINTERS(NAME1, NAME2, CLEANUP)                                                     \
    6565if (NAME1 == NAME2) {                                                                               \
    6666    psError(PS_ERR_BAD_PARAMETER_VALUE, true,                                                       \
    6767            "Invalid operation: Pointer to %s is same as %s.", #NAME1, #NAME2);                     \
    68     return RETURN;                                                                                  \
     68    CLEANUP;                                                                                  \
    6969}
    7070
    7171/** Preprocessor macro to check that an image is square */
    72 #define PS_CHECK_SQUARE(NAME, RETURN)                                                               \
     72#define PS_CHECK_SQUARE(NAME, CLEANUP)                                                               \
    7373if (NAME->numCols != NAME->numRows) {                                                               \
    7474    psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid operation: %s not square array.", #NAME);     \
    75     return RETURN;                                                                                  \
     75    CLEANUP;                                                                                  \
    7676}
    7777
     
    189189    // Error checks
    190190    PS_IMAGE_CHECK_NULL_GENERAL(inImage, psMatrixLUD_EXIT);
    191     PS_CHECK_POINTERS(inImage, outImage, outImage);
    192     PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, outImage);
     191    PS_CHECK_POINTERS(inImage, outImage, psMatrixLUD_EXIT);
     192    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, psMatrixLUD_EXIT);
    193193    PS_PTR_CHECK_NULL_GENERAL(outPerm, psMatrixLUD_EXIT);
    194194
    195195    outImage = psImageRecycle(outImage, inImage->numCols, inImage->numRows, inImage->type.type);
    196196
    197     PS_CHECK_SQUARE(inImage, outImage);
    198     PS_CHECK_SQUARE(outImage, outImage);
     197    PS_CHECK_SQUARE(inImage, psMatrixLUD_EXIT);
     198    PS_CHECK_SQUARE(outImage, psMatrixLUD_EXIT);
    199199
    200200    // Initialize data
     
    244244    gsl_vector *x = NULL;
    245245
    246     // Error checks
    247     PS_CHECK_POINTERS(outVector, inVector, outVector);
    248     PS_CHECK_POINTERS(inVector, inPerm, outVector);
    249     PS_CHECK_POINTERS(outVector, inPerm, outVector);
    250     PS_IMAGE_CHECK_NULL(inImage, outVector);
    251     PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, outVector);
    252     PS_IMAGE_CHECK_EMPTY(inImage, outVector);
    253     PS_VECTOR_CHECK_NULL(outVector, outVector);
    254     PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_VECTOR, outVector);
    255     PS_VECTOR_CHECK_NULL(inVector, outVector);
    256     PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_VECTOR, outVector);
    257     PS_VECTOR_CHECK_NULL(inPerm, outVector);
    258     psVectorRecycle(outVector, inImage->numRows, inImage->type.type);
     246    #define LUSOLVE_CLEANUP {psFree(outVector); return NULL;}
     247
     248    // Error checks
     249    PS_IMAGE_CHECK_NULL_GENERAL(inImage, LUSOLVE_CLEANUP);
     250    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, LUSOLVE_CLEANUP);
     251    PS_IMAGE_CHECK_EMPTY_GENERAL(inImage, LUSOLVE_CLEANUP);
     252    PS_VECTOR_CHECK_NULL_GENERAL(inVector, LUSOLVE_CLEANUP);
     253    PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_VECTOR, LUSOLVE_CLEANUP);
     254    PS_VECTOR_CHECK_NULL_GENERAL(inPerm, LUSOLVE_CLEANUP);
     255
     256    outVector = psVectorRecycle(outVector, inImage->numRows, inImage->type.type);
     257
     258    PS_CHECK_POINTERS(outVector, inVector, LUSOLVE_CLEANUP);
     259    PS_CHECK_POINTERS(inVector, inPerm, LUSOLVE_CLEANUP);
     260    PS_CHECK_POINTERS(outVector, inPerm, LUSOLVE_CLEANUP);
    259261
    260262    // Initialize data
     
    296298    gsl_permutation *perm = NULL;
    297299
    298     // Error checks
    299     PS_PTR_CHECK_NULL(det, outImage);
    300     PS_CHECK_POINTERS(inImage, outImage, outImage);
    301     PS_IMAGE_CHECK_NULL(inImage, outImage);
    302     PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, outImage);
    303     PS_IMAGE_CHECK_EMPTY(inImage, outImage);
     300    #define INVERT_CLEANUP { psFree(outImage); return NULL; }
     301    // Error checks
     302    PS_PTR_CHECK_NULL_GENERAL(det, INVERT_CLEANUP);
     303    PS_IMAGE_CHECK_NULL_GENERAL(inImage, INVERT_CLEANUP);
     304    PS_CHECK_POINTERS(inImage, outImage, INVERT_CLEANUP);
     305    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, INVERT_CLEANUP);
     306    PS_IMAGE_CHECK_EMPTY_GENERAL(inImage, INVERT_CLEANUP);
     307
    304308    outImage = psImageRecycle(outImage, inImage->numCols, inImage->numRows, inImage->type.type);
    305     PS_CHECK_SQUARE(inImage, outImage);
    306     PS_CHECK_SQUARE(outImage, outImage);
     309
     310    PS_CHECK_SQUARE(inImage, INVERT_CLEANUP);
     311    PS_CHECK_SQUARE(outImage, INVERT_CLEANUP);
    307312
    308313    // Initialize data
     
    341346    gsl_permutation *perm = NULL;
    342347
    343     // Error checks
    344     PS_IMAGE_CHECK_NULL(inImage, NULL);
    345     PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, NULL);
    346     PS_IMAGE_CHECK_EMPTY(inImage, NULL);
    347     PS_CHECK_SQUARE(inImage, 0);
     348    #define DETERMINANT_EXIT { return NULL; }
     349    // Error checks
     350    PS_IMAGE_CHECK_NULL_GENERAL(inImage, DETERMINANT_EXIT);
     351    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, DETERMINANT_EXIT);
     352    PS_IMAGE_CHECK_EMPTY_GENERAL(inImage, DETERMINANT_EXIT);
     353    PS_CHECK_SQUARE(inImage, DETERMINANT_EXIT);
    348354
    349355    // Initialize data
     
    376382    gsl_matrix *m3 = NULL;
    377383
    378     // Error checks
    379     PS_CHECK_POINTERS(inImage1, outImage, outImage);
    380     PS_CHECK_POINTERS(inImage1, inImage2, outImage);
    381     PS_IMAGE_CHECK_NULL(inImage1, outImage);
    382     PS_CHECK_DIMEN_AND_TYPE(inImage1, PS_DIMEN_IMAGE, outImage);
    383     PS_IMAGE_CHECK_EMPTY(inImage1, outImage);
    384     PS_IMAGE_CHECK_NULL(inImage2, outImage);
    385     PS_CHECK_DIMEN_AND_TYPE(inImage2, PS_DIMEN_IMAGE, outImage);
    386     PS_IMAGE_CHECK_EMPTY(inImage2, outImage);
    387     PS_CHECK_DIMEN_AND_TYPE(inImage1, PS_DIMEN_IMAGE, outImage);
     384    #define MULTIPLY_CLEANUP { psFree(outImage); return NULL; }
     385
     386    // Error checks
     387    PS_IMAGE_CHECK_NULL_GENERAL(inImage1, MULTIPLY_CLEANUP);
     388    PS_IMAGE_CHECK_NULL_GENERAL(inImage2, MULTIPLY_CLEANUP);
     389    PS_IMAGE_CHECK_EMPTY_GENERAL(inImage1, MULTIPLY_CLEANUP);
     390    PS_IMAGE_CHECK_EMPTY_GENERAL(inImage2, MULTIPLY_CLEANUP);
     391    PS_CHECK_DIMEN_AND_TYPE(inImage1, PS_DIMEN_IMAGE, MULTIPLY_CLEANUP);
     392    PS_CHECK_DIMEN_AND_TYPE(inImage2, PS_DIMEN_IMAGE, MULTIPLY_CLEANUP);
     393    PS_CHECK_POINTERS(inImage1, outImage, MULTIPLY_CLEANUP);
     394    PS_CHECK_POINTERS(inImage1, inImage2, MULTIPLY_CLEANUP);
    388395
    389396    outImage = psImageRecycle(outImage, inImage2->numCols, inImage2->numRows, inImage2->type.type);
    390397
    391     PS_CHECK_SQUARE(inImage1, outImage);
    392     PS_CHECK_SQUARE(inImage2, outImage);
    393     PS_CHECK_SQUARE(outImage, outImage);
     398    PS_CHECK_SQUARE(inImage1, MULTIPLY_CLEANUP);
     399    PS_CHECK_SQUARE(inImage2, MULTIPLY_CLEANUP);
     400    PS_CHECK_SQUARE(outImage, MULTIPLY_CLEANUP);
    394401
    395402    // Initialize data
     
    428435    psS32 numColsOut = 0;
    429436
    430 
    431     // Error checks
    432     PS_CHECK_POINTERS(inImage, outImage, outImage);
    433     PS_IMAGE_CHECK_NULL(inImage, outImage);
    434     PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, outImage);
    435     PS_IMAGE_CHECK_EMPTY(inImage, outImage);
     437    #define TRANSPOSE_CLEANUP { psFree(outImage); return NULL; }
     438    // Error checks
     439    PS_IMAGE_CHECK_NULL_GENERAL(inImage, TRANSPOSE_CLEANUP);
     440    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, TRANSPOSE_CLEANUP);
     441    PS_IMAGE_CHECK_EMPTY_GENERAL(inImage, TRANSPOSE_CLEANUP);
     442    PS_CHECK_POINTERS(inImage, outImage, TRANSPOSE_CLEANUP);
     443
    436444    outImage = psImageRecycle(outImage, inImage->numCols, inImage->numRows, inImage->type.type);
    437445
     
    472480    gsl_matrix *in = NULL;
    473481
    474 
    475     // Error checks
    476     PS_CHECK_POINTERS(inImage, outImage, outImage);
    477     PS_IMAGE_CHECK_NULL(inImage, outImage);
    478     PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, outImage);
    479     PS_IMAGE_CHECK_EMPTY(inImage, outImage);
     482    #define EIGENVECTORS_CLEANUP { psFree(outImage); return NULL; }
     483    // Error checks
     484    PS_IMAGE_CHECK_NULL_GENERAL(inImage, EIGENVECTORS_CLEANUP);
     485    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, EIGENVECTORS_CLEANUP);
     486    PS_IMAGE_CHECK_EMPTY_GENERAL(inImage, EIGENVECTORS_CLEANUP);
     487    PS_CHECK_POINTERS(inImage, outImage, EIGENVECTORS_CLEANUP);
    480488
    481489    outImage = psImageRecycle(outImage, inImage->numCols, inImage->numRows, inImage->type.type);
     
    494502
    495503    // Non-square matrices not allowed
    496     PS_CHECK_SQUARE(inImage, outImage);
    497     PS_CHECK_SQUARE(outImage, outImage);
     504    PS_CHECK_SQUARE(inImage, EIGENVECTORS_CLEANUP);
     505    PS_CHECK_SQUARE(outImage, EIGENVECTORS_CLEANUP);
    498506
    499507    // Calculate Eigenvalues and Eigenvectors...Eigenvalues not currently used
     
    520528    // Error checks
    521529    PS_IMAGE_CHECK_NULL_GENERAL(inImage, psMatrixToVector_EXIT);
    522     PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, outVector);
     530    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, psMatrixToVector_EXIT);
    523531    PS_IMAGE_CHECK_EMPTY_GENERAL(inImage, psMatrixToVector_EXIT);
    524532
    525533    if (inImage->numRows == 1) {
    526534        // Create transposed row vector
    527         psVectorRecycle(outVector, inImage->numCols, inImage->type.type);
     535        outVector = psVectorRecycle(outVector, inImage->numCols, inImage->type.type);
    528536        outVector->type.dimen = PS_DIMEN_TRANSV;
    529537    } else if (inImage->numCols == 1) {
    530538        // Create non-transposed column vector
    531         psVectorRecycle(outVector, inImage->numRows, inImage->type.type);
     539        outVector = psVectorRecycle(outVector, inImage->numRows, inImage->type.type);
    532540    } else {
    533541        psError(PS_ERR_BAD_PARAMETER_SIZE, true,
     
    537545    }
    538546
    539     PS_VECTOR_CHECK_NULL(outVector, outVector);
    540 
    541547    // More checks
    542548    if (outVector->type.dimen == PS_DIMEN_VECTOR) {
    543         PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_VECTOR, outVector);
     549        PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_VECTOR, psMatrixToVector_EXIT);
    544550
    545551        if (outVector->n == 0) {
     
    557563
    558564    } else if (outVector->type.dimen == PS_DIMEN_TRANSV) {
    559         PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_TRANSV, outVector);
     565        PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_TRANSV, psMatrixToVector_EXIT);
    560566
    561567        if (outVector->n == 0) {
     
    582588    psS32 size = 0;
    583589
    584     // Error checks
    585     PS_VECTOR_CHECK_NULL(inVector, outImage);
     590    #define VECTORTOMATRIX_CLEANUP {psFree(outImage); return NULL; }
     591    // Error checks
     592    PS_VECTOR_CHECK_NULL_GENERAL(inVector, VECTORTOMATRIX_CLEANUP);
    586593
    587594    if (inVector->type.dimen == PS_DIMEN_VECTOR) {
    588         PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_VECTOR, outImage);
    589         PS_VECTOR_CHECK_EMPTY(inVector, outImage);
     595        PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_VECTOR, VECTORTOMATRIX_CLEANUP);
     596        PS_VECTOR_CHECK_EMPTY_GENERAL(inVector, VECTORTOMATRIX_CLEANUP);
     597
    590598        outImage = psImageRecycle(outImage, 1, inVector->n, inVector->type.type);
     599
    591600        // More checks for PS_DIMEN_VECTOR
    592601        if (outImage->numCols > 1) {
     
    605614
    606615    } else if (inVector->type.dimen == PS_DIMEN_TRANSV) {
    607         PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_TRANSV, outImage);
    608         PS_VECTOR_CHECK_EMPTY(inVector, outImage);
     616        PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_TRANSV, VECTORTOMATRIX_CLEANUP);
     617        PS_VECTOR_CHECK_EMPTY_GENERAL(inVector, VECTORTOMATRIX_CLEANUP);
    609618        outImage = psImageRecycle(outImage, inVector->n, 1, inVector->type.type);
    610619        // More checks for PS_DIMEN_TRANSV
     
    624633    }
    625634
    626     PS_IMAGE_CHECK_NULL(outImage, outImage);
    627     PS_CHECK_DIMEN_AND_TYPE(outImage, PS_DIMEN_IMAGE, outImage);
     635    PS_IMAGE_CHECK_NULL_GENERAL(outImage, VECTORTOMATRIX_CLEANUP);
     636    PS_CHECK_DIMEN_AND_TYPE(outImage, PS_DIMEN_IMAGE, VECTORTOMATRIX_CLEANUP);
    628637
    629638    memcpy(outImage->data.V[0], inVector->data.V, size);
  • trunk/psLib/src/image/psImageExtraction.c

    r3309 r3313  
    99 *  @author Robert DeSonia, MHPCC
    1010 *
    11  *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-02-23 21:32:40 $
     11 *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-02-24 00:19:51 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    556556    psF32* cutRowsData = NULL;
    557557    if (cutCols != NULL) {
    558         (void)psVectorRecycle(cutCols, nSamples, PS_TYPE_F32);
     558        cutCols = psVectorRecycle(cutCols, nSamples, PS_TYPE_F32);
    559559        cutColsData = cutCols->data.F32;
    560560    }
    561561    if (cutRows != NULL) {
    562         (void)psVectorRecycle(cutRows, nSamples, PS_TYPE_F32);
     562        cutRows = psVectorRecycle(cutRows, nSamples, PS_TYPE_F32);
    563563        cutRowsData = cutRows->data.F32;
    564564    }
  • trunk/psLib/src/math/psConstants.h

    r3264 r3313  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-02-17 19:26:23 $
     8 *  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-02-24 00:19:51 $
    1010 *
    1111 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    198198} \
    199199
    200 #define PS_VECTOR_CHECK_EMPTY(NAME, RVAL) \
     200#define PS_VECTOR_CHECK_EMPTY(NAME, RVAL) PS_VECTOR_CHECK_EMPTY_GENERAL(NAME, return RVAL)
     201#define PS_VECTOR_CHECK_EMPTY_GENERAL(NAME, CLEANUP) \
    201202if (NAME->n < 1) { \
    202203    psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
    203204            "Unallowable operation: psVector %s has no elements.", \
    204205            #NAME); \
    205     return(RVAL); \
     206    CLEANUP; \
    206207} \
    207208
  • trunk/psLib/src/math/psMatrix.c

    r3290 r3313  
    2121 *  @author Robert DeSonia, MHPCC
    2222 *
    23  *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
    24  *  @date $Date: 2005-02-19 00:30:07 $
     23 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
     24 *  @date $Date: 2005-02-24 00:19:51 $
    2525 *
    2626 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5050
    5151/** Preprocessor macro to generate error for image dimensionality not set to PS_DIMEN_IMAGE */
    52 #define PS_CHECK_DIMEN_AND_TYPE(NAME, PS_DIMEN, RETURN)                                             \
     52#define PS_CHECK_DIMEN_AND_TYPE(NAME, PS_DIMEN, CLEANUP)                                             \
    5353if (NAME->type.dimen != PS_DIMEN) {                                                                 \
    5454    psError(PS_ERR_BAD_PARAMETER_TYPE, true,                                                        \
    5555            "Invalid operation. %s has incorrect dimensionality %d.", #NAME, PS_DIMEN);             \
    56     return RETURN;                                                                                  \
     56    CLEANUP;                                                                                  \
    5757} else if(NAME->type.type!=PS_TYPE_F64 && NAME->type.type!=PS_TYPE_F32) {                           \
    5858    psError(PS_ERR_BAD_PARAMETER_TYPE, true,                                                        \
    5959            "Invalid operation. %s not PS_TYPE_F64.", #NAME);                                       \
    60     return RETURN;                                                                                  \
     60    CLEANUP;                                                                                  \
    6161}
    6262
    6363/** Preprocessor macro to check that input is not equal to output */
    64 #define PS_CHECK_POINTERS(NAME1, NAME2, RETURN)                                                     \
     64#define PS_CHECK_POINTERS(NAME1, NAME2, CLEANUP)                                                     \
    6565if (NAME1 == NAME2) {                                                                               \
    6666    psError(PS_ERR_BAD_PARAMETER_VALUE, true,                                                       \
    6767            "Invalid operation: Pointer to %s is same as %s.", #NAME1, #NAME2);                     \
    68     return RETURN;                                                                                  \
     68    CLEANUP;                                                                                  \
    6969}
    7070
    7171/** Preprocessor macro to check that an image is square */
    72 #define PS_CHECK_SQUARE(NAME, RETURN)                                                               \
     72#define PS_CHECK_SQUARE(NAME, CLEANUP)                                                               \
    7373if (NAME->numCols != NAME->numRows) {                                                               \
    7474    psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid operation: %s not square array.", #NAME);     \
    75     return RETURN;                                                                                  \
     75    CLEANUP;                                                                                  \
    7676}
    7777
     
    189189    // Error checks
    190190    PS_IMAGE_CHECK_NULL_GENERAL(inImage, psMatrixLUD_EXIT);
    191     PS_CHECK_POINTERS(inImage, outImage, outImage);
    192     PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, outImage);
     191    PS_CHECK_POINTERS(inImage, outImage, psMatrixLUD_EXIT);
     192    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, psMatrixLUD_EXIT);
    193193    PS_PTR_CHECK_NULL_GENERAL(outPerm, psMatrixLUD_EXIT);
    194194
    195195    outImage = psImageRecycle(outImage, inImage->numCols, inImage->numRows, inImage->type.type);
    196196
    197     PS_CHECK_SQUARE(inImage, outImage);
    198     PS_CHECK_SQUARE(outImage, outImage);
     197    PS_CHECK_SQUARE(inImage, psMatrixLUD_EXIT);
     198    PS_CHECK_SQUARE(outImage, psMatrixLUD_EXIT);
    199199
    200200    // Initialize data
     
    244244    gsl_vector *x = NULL;
    245245
    246     // Error checks
    247     PS_CHECK_POINTERS(outVector, inVector, outVector);
    248     PS_CHECK_POINTERS(inVector, inPerm, outVector);
    249     PS_CHECK_POINTERS(outVector, inPerm, outVector);
    250     PS_IMAGE_CHECK_NULL(inImage, outVector);
    251     PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, outVector);
    252     PS_IMAGE_CHECK_EMPTY(inImage, outVector);
    253     PS_VECTOR_CHECK_NULL(outVector, outVector);
    254     PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_VECTOR, outVector);
    255     PS_VECTOR_CHECK_NULL(inVector, outVector);
    256     PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_VECTOR, outVector);
    257     PS_VECTOR_CHECK_NULL(inPerm, outVector);
    258     psVectorRecycle(outVector, inImage->numRows, inImage->type.type);
     246    #define LUSOLVE_CLEANUP {psFree(outVector); return NULL;}
     247
     248    // Error checks
     249    PS_IMAGE_CHECK_NULL_GENERAL(inImage, LUSOLVE_CLEANUP);
     250    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, LUSOLVE_CLEANUP);
     251    PS_IMAGE_CHECK_EMPTY_GENERAL(inImage, LUSOLVE_CLEANUP);
     252    PS_VECTOR_CHECK_NULL_GENERAL(inVector, LUSOLVE_CLEANUP);
     253    PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_VECTOR, LUSOLVE_CLEANUP);
     254    PS_VECTOR_CHECK_NULL_GENERAL(inPerm, LUSOLVE_CLEANUP);
     255
     256    outVector = psVectorRecycle(outVector, inImage->numRows, inImage->type.type);
     257
     258    PS_CHECK_POINTERS(outVector, inVector, LUSOLVE_CLEANUP);
     259    PS_CHECK_POINTERS(inVector, inPerm, LUSOLVE_CLEANUP);
     260    PS_CHECK_POINTERS(outVector, inPerm, LUSOLVE_CLEANUP);
    259261
    260262    // Initialize data
     
    296298    gsl_permutation *perm = NULL;
    297299
    298     // Error checks
    299     PS_PTR_CHECK_NULL(det, outImage);
    300     PS_CHECK_POINTERS(inImage, outImage, outImage);
    301     PS_IMAGE_CHECK_NULL(inImage, outImage);
    302     PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, outImage);
    303     PS_IMAGE_CHECK_EMPTY(inImage, outImage);
     300    #define INVERT_CLEANUP { psFree(outImage); return NULL; }
     301    // Error checks
     302    PS_PTR_CHECK_NULL_GENERAL(det, INVERT_CLEANUP);
     303    PS_IMAGE_CHECK_NULL_GENERAL(inImage, INVERT_CLEANUP);
     304    PS_CHECK_POINTERS(inImage, outImage, INVERT_CLEANUP);
     305    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, INVERT_CLEANUP);
     306    PS_IMAGE_CHECK_EMPTY_GENERAL(inImage, INVERT_CLEANUP);
     307
    304308    outImage = psImageRecycle(outImage, inImage->numCols, inImage->numRows, inImage->type.type);
    305     PS_CHECK_SQUARE(inImage, outImage);
    306     PS_CHECK_SQUARE(outImage, outImage);
     309
     310    PS_CHECK_SQUARE(inImage, INVERT_CLEANUP);
     311    PS_CHECK_SQUARE(outImage, INVERT_CLEANUP);
    307312
    308313    // Initialize data
     
    341346    gsl_permutation *perm = NULL;
    342347
    343     // Error checks
    344     PS_IMAGE_CHECK_NULL(inImage, NULL);
    345     PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, NULL);
    346     PS_IMAGE_CHECK_EMPTY(inImage, NULL);
    347     PS_CHECK_SQUARE(inImage, 0);
     348    #define DETERMINANT_EXIT { return NULL; }
     349    // Error checks
     350    PS_IMAGE_CHECK_NULL_GENERAL(inImage, DETERMINANT_EXIT);
     351    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, DETERMINANT_EXIT);
     352    PS_IMAGE_CHECK_EMPTY_GENERAL(inImage, DETERMINANT_EXIT);
     353    PS_CHECK_SQUARE(inImage, DETERMINANT_EXIT);
    348354
    349355    // Initialize data
     
    376382    gsl_matrix *m3 = NULL;
    377383
    378     // Error checks
    379     PS_CHECK_POINTERS(inImage1, outImage, outImage);
    380     PS_CHECK_POINTERS(inImage1, inImage2, outImage);
    381     PS_IMAGE_CHECK_NULL(inImage1, outImage);
    382     PS_CHECK_DIMEN_AND_TYPE(inImage1, PS_DIMEN_IMAGE, outImage);
    383     PS_IMAGE_CHECK_EMPTY(inImage1, outImage);
    384     PS_IMAGE_CHECK_NULL(inImage2, outImage);
    385     PS_CHECK_DIMEN_AND_TYPE(inImage2, PS_DIMEN_IMAGE, outImage);
    386     PS_IMAGE_CHECK_EMPTY(inImage2, outImage);
    387     PS_CHECK_DIMEN_AND_TYPE(inImage1, PS_DIMEN_IMAGE, outImage);
     384    #define MULTIPLY_CLEANUP { psFree(outImage); return NULL; }
     385
     386    // Error checks
     387    PS_IMAGE_CHECK_NULL_GENERAL(inImage1, MULTIPLY_CLEANUP);
     388    PS_IMAGE_CHECK_NULL_GENERAL(inImage2, MULTIPLY_CLEANUP);
     389    PS_IMAGE_CHECK_EMPTY_GENERAL(inImage1, MULTIPLY_CLEANUP);
     390    PS_IMAGE_CHECK_EMPTY_GENERAL(inImage2, MULTIPLY_CLEANUP);
     391    PS_CHECK_DIMEN_AND_TYPE(inImage1, PS_DIMEN_IMAGE, MULTIPLY_CLEANUP);
     392    PS_CHECK_DIMEN_AND_TYPE(inImage2, PS_DIMEN_IMAGE, MULTIPLY_CLEANUP);
     393    PS_CHECK_POINTERS(inImage1, outImage, MULTIPLY_CLEANUP);
     394    PS_CHECK_POINTERS(inImage1, inImage2, MULTIPLY_CLEANUP);
    388395
    389396    outImage = psImageRecycle(outImage, inImage2->numCols, inImage2->numRows, inImage2->type.type);
    390397
    391     PS_CHECK_SQUARE(inImage1, outImage);
    392     PS_CHECK_SQUARE(inImage2, outImage);
    393     PS_CHECK_SQUARE(outImage, outImage);
     398    PS_CHECK_SQUARE(inImage1, MULTIPLY_CLEANUP);
     399    PS_CHECK_SQUARE(inImage2, MULTIPLY_CLEANUP);
     400    PS_CHECK_SQUARE(outImage, MULTIPLY_CLEANUP);
    394401
    395402    // Initialize data
     
    428435    psS32 numColsOut = 0;
    429436
    430 
    431     // Error checks
    432     PS_CHECK_POINTERS(inImage, outImage, outImage);
    433     PS_IMAGE_CHECK_NULL(inImage, outImage);
    434     PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, outImage);
    435     PS_IMAGE_CHECK_EMPTY(inImage, outImage);
     437    #define TRANSPOSE_CLEANUP { psFree(outImage); return NULL; }
     438    // Error checks
     439    PS_IMAGE_CHECK_NULL_GENERAL(inImage, TRANSPOSE_CLEANUP);
     440    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, TRANSPOSE_CLEANUP);
     441    PS_IMAGE_CHECK_EMPTY_GENERAL(inImage, TRANSPOSE_CLEANUP);
     442    PS_CHECK_POINTERS(inImage, outImage, TRANSPOSE_CLEANUP);
     443
    436444    outImage = psImageRecycle(outImage, inImage->numCols, inImage->numRows, inImage->type.type);
    437445
     
    472480    gsl_matrix *in = NULL;
    473481
    474 
    475     // Error checks
    476     PS_CHECK_POINTERS(inImage, outImage, outImage);
    477     PS_IMAGE_CHECK_NULL(inImage, outImage);
    478     PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, outImage);
    479     PS_IMAGE_CHECK_EMPTY(inImage, outImage);
     482    #define EIGENVECTORS_CLEANUP { psFree(outImage); return NULL; }
     483    // Error checks
     484    PS_IMAGE_CHECK_NULL_GENERAL(inImage, EIGENVECTORS_CLEANUP);
     485    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, EIGENVECTORS_CLEANUP);
     486    PS_IMAGE_CHECK_EMPTY_GENERAL(inImage, EIGENVECTORS_CLEANUP);
     487    PS_CHECK_POINTERS(inImage, outImage, EIGENVECTORS_CLEANUP);
    480488
    481489    outImage = psImageRecycle(outImage, inImage->numCols, inImage->numRows, inImage->type.type);
     
    494502
    495503    // Non-square matrices not allowed
    496     PS_CHECK_SQUARE(inImage, outImage);
    497     PS_CHECK_SQUARE(outImage, outImage);
     504    PS_CHECK_SQUARE(inImage, EIGENVECTORS_CLEANUP);
     505    PS_CHECK_SQUARE(outImage, EIGENVECTORS_CLEANUP);
    498506
    499507    // Calculate Eigenvalues and Eigenvectors...Eigenvalues not currently used
     
    520528    // Error checks
    521529    PS_IMAGE_CHECK_NULL_GENERAL(inImage, psMatrixToVector_EXIT);
    522     PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, outVector);
     530    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, psMatrixToVector_EXIT);
    523531    PS_IMAGE_CHECK_EMPTY_GENERAL(inImage, psMatrixToVector_EXIT);
    524532
    525533    if (inImage->numRows == 1) {
    526534        // Create transposed row vector
    527         psVectorRecycle(outVector, inImage->numCols, inImage->type.type);
     535        outVector = psVectorRecycle(outVector, inImage->numCols, inImage->type.type);
    528536        outVector->type.dimen = PS_DIMEN_TRANSV;
    529537    } else if (inImage->numCols == 1) {
    530538        // Create non-transposed column vector
    531         psVectorRecycle(outVector, inImage->numRows, inImage->type.type);
     539        outVector = psVectorRecycle(outVector, inImage->numRows, inImage->type.type);
    532540    } else {
    533541        psError(PS_ERR_BAD_PARAMETER_SIZE, true,
     
    537545    }
    538546
    539     PS_VECTOR_CHECK_NULL(outVector, outVector);
    540 
    541547    // More checks
    542548    if (outVector->type.dimen == PS_DIMEN_VECTOR) {
    543         PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_VECTOR, outVector);
     549        PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_VECTOR, psMatrixToVector_EXIT);
    544550
    545551        if (outVector->n == 0) {
     
    557563
    558564    } else if (outVector->type.dimen == PS_DIMEN_TRANSV) {
    559         PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_TRANSV, outVector);
     565        PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_TRANSV, psMatrixToVector_EXIT);
    560566
    561567        if (outVector->n == 0) {
     
    582588    psS32 size = 0;
    583589
    584     // Error checks
    585     PS_VECTOR_CHECK_NULL(inVector, outImage);
     590    #define VECTORTOMATRIX_CLEANUP {psFree(outImage); return NULL; }
     591    // Error checks
     592    PS_VECTOR_CHECK_NULL_GENERAL(inVector, VECTORTOMATRIX_CLEANUP);
    586593
    587594    if (inVector->type.dimen == PS_DIMEN_VECTOR) {
    588         PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_VECTOR, outImage);
    589         PS_VECTOR_CHECK_EMPTY(inVector, outImage);
     595        PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_VECTOR, VECTORTOMATRIX_CLEANUP);
     596        PS_VECTOR_CHECK_EMPTY_GENERAL(inVector, VECTORTOMATRIX_CLEANUP);
     597
    590598        outImage = psImageRecycle(outImage, 1, inVector->n, inVector->type.type);
     599
    591600        // More checks for PS_DIMEN_VECTOR
    592601        if (outImage->numCols > 1) {
     
    605614
    606615    } else if (inVector->type.dimen == PS_DIMEN_TRANSV) {
    607         PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_TRANSV, outImage);
    608         PS_VECTOR_CHECK_EMPTY(inVector, outImage);
     616        PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_TRANSV, VECTORTOMATRIX_CLEANUP);
     617        PS_VECTOR_CHECK_EMPTY_GENERAL(inVector, VECTORTOMATRIX_CLEANUP);
    609618        outImage = psImageRecycle(outImage, inVector->n, 1, inVector->type.type);
    610619        // More checks for PS_DIMEN_TRANSV
     
    624633    }
    625634
    626     PS_IMAGE_CHECK_NULL(outImage, outImage);
    627     PS_CHECK_DIMEN_AND_TYPE(outImage, PS_DIMEN_IMAGE, outImage);
     635    PS_IMAGE_CHECK_NULL_GENERAL(outImage, VECTORTOMATRIX_CLEANUP);
     636    PS_CHECK_DIMEN_AND_TYPE(outImage, PS_DIMEN_IMAGE, VECTORTOMATRIX_CLEANUP);
    628637
    629638    memcpy(outImage->data.V[0], inVector->data.V, size);
  • trunk/psLib/test/dataManip/tst_psMatrix02.c

    r3264 r3313  
    1212 *  @author  Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
    15  *  @date  $Date: 2005-02-17 19:26:25 $
     14 *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
     15 *  @date  $Date: 2005-02-24 00:19:51 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3232
    3333    // Test A - Input pointer same as output pointer
    34     printNegativeTestHeader(stdout,"psMatrix", "Input pointer same as output pointer",
    35                             "Invalid operation: Pointer to inImage is same as outImage.", 0);
    36     psMatrixTranspose(inImage, inImage);
     34    printPositiveTestHeader(stdout,"psMatrix", "Input pointer same as output pointer");
     35    psMemIncrRefCounter(inImage);
     36    if (psMatrixTranspose(inImage, inImage) != NULL) {
     37        psError(PS_ERR_UNKNOWN, true,
     38                "inImage = outImage didn't results in NULL return");
     39        return 1;
     40    }
     41    if (psMemGetRefCounter(inImage) != 1) {
     42        psError(PS_ERR_UNKNOWN, true,
     43                "the output image was not freed on an error.");
     44        return 2;
     45    }
    3746    printFooter(stdout, "psMatrix", "Input pointer same as output pointer", true);
    3847
    3948    // Test B - Null input psImage
    40     printNegativeTestHeader(stdout,"psMatrix", "Null input psImage",
    41                             "Invalid operation: inImage or its data is NULL.", 0);
    42     psMatrixTranspose(outImage, nullImage);
     49    printPositiveTestHeader(stdout,"psMatrix", "Null input psImage");
     50    psMemIncrRefCounter(outImage);
     51    if (psMatrixTranspose(outImage, nullImage) != NULL) {
     52        psError(PS_ERR_UNKNOWN, true,
     53                "inImage = outImage didn't results in NULL return");
     54        return 3;
     55    }
     56    if (psMemGetRefCounter(outImage) != 1) {
     57        psError(PS_ERR_UNKNOWN, true,
     58                "the output image was not freed on an error.");
     59        return 4;
     60    }
    4361    printFooter(stdout, "psMatrix", "Null input psImage", true);
    4462
    4563    // Test C - Incorrect type for input pointer
    46     printNegativeTestHeader(stdout,"psMatrix", "Incorrect type for input pointer",
    47                             "|Invalid operation: inImage not PS_TYPE_F64.", 0);
    48     psMatrixTranspose(outImage, badImage1);
     64    printPositiveTestHeader(stdout,"psMatrix", "Incorrect type for input pointer");
     65    psMemIncrRefCounter(outImage);
     66    if (psMatrixTranspose(outImage, badImage1) != NULL) {
     67        psError(PS_ERR_UNKNOWN, true,
     68                "inImage = outImage didn't results in NULL return");
     69        return 5;
     70    }
     71    if (psMemGetRefCounter(outImage) != 1) {
     72        psError(PS_ERR_UNKNOWN, true,
     73                "the output image was not freed on an error.");
     74        return 6;
     75    }
    4976    printFooter(stdout, "psMatrix", "Incorrect type for input pointer", true);
    5077
    5178    // Test D - Incorrect type for output pointer
    52     printNegativeTestHeader(stdout,"psMatrix", "Incorrect type for output pointer",
    53                             "Invalid operation: outImage not PS_TYPE_F64.", 0);
    54     psMatrixTranspose(badImage1, inImage);
     79    printPositiveTestHeader(stdout,"psMatrix", "Incorrect type for output pointer");
     80    badImage1 = psMatrixTranspose(badImage1, inImage);
     81    if (badImage1 == NULL) {
     82        psError(PS_ERR_UNKNOWN, true,
     83                "inImage = outImage didn't results in NULL return");
     84        return 7;
     85    }
     86    // check that the type was changed.
     87    if (badImage1->type.type != PS_TYPE_F64) {
     88        psError(PS_ERR_UNKNOWN, true,
     89                "the output image was not freed on an error.");
     90        return 8;
     91    }
    5592    printFooter(stdout, "psMatrix", "Incorrect type for output pointer", true);
    5693
    5794    // Test E - Matrix not square for output pointer
    58     printNegativeTestHeader(stdout,"psMatrix", "Matrix not square for output pointer",
    59                             "Invalid operation: outImage not square array.", 0);
     95    printPositiveTestHeader(stdout,"psMatrix", "Matrix not square for output pointer");
    6096    psMatrixTranspose(badImage2, inImage);
    6197    printFooter(stdout, "psMatrix", "Matrix not square for output pointer", true);
  • trunk/psLib/test/dataManip/tst_psMatrix03.c

    r3264 r3313  
    1414 *  @author  Ross Harman, MHPCC
    1515 *
    16  *  @version $Revision: 1.14 $  $Name: not supported by cvs2svn $
    17  *  @date  $Date: 2005-02-17 19:26:25 $
     16 *  @version $Revision: 1.15 $  $Name: not supported by cvs2svn $
     17 *  @date  $Date: 2005-02-24 00:19:51 $
    1818 *
    1919 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    148148    printFooter(stdout, "psMatrix", "Calculate LU matrix", true);
    149149
    150 
    151150    // Test C - Determine solution to matrix equation
    152151    printPositiveTestHeader(stdout, "psMatrix", "Determine solution to matrix equation");
     
    208207    psVector *vectorBadOut = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
    209208    psVector *permBad = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
     209    imageTest = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
    210210    psMatrixLUSolve(vectorBadOut, imageTest, vectorBad, permBad);
    211211    printFooter(stdout, "psMatrix", "Attempt to use null input vector argument", true);
     
    215215    printNegativeTestHeader(stdout,"psMatrix", "Attempt to use null LU image argument",
    216216                            "Invalid operation: inImage or its data is NULL.", 0);
     217    vectorBadOut = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
    217218    psMatrixLUSolve(vectorBadOut, NULL, vectorBad, permBad);
    218219    printFooter(stdout, "psMatrix", "Attempt to use null LU image argument", true);
    219220
     221    psFree(permBad);
     222    psFree(imageTest);
     223
     224    if( psMemCheckLeaks(0, NULL, stdout, false) ) {
     225        psError(PS_ERR_UNKNOWN,true,"Memory leaks detected");
     226        return 10;
     227    }
     228    nBad = psMemCheckCorruption(0);
     229    if(nBad) {
     230        printf("ERROR: Found %d bad memory blocks\n", nBad);
     231    }
     232
    220233    return 0;
    221234}
  • trunk/psLib/test/dataManip/tst_psMatrix07.c

    r3291 r3313  
    1616 *  @author  Ross Harman, MHPCC
    1717 *
    18  *  @version $Revision: 1.10 $  $Name: not supported by cvs2svn $
    19  *  @date  $Date: 2005-02-19 00:43:32 $
     18 *  @version $Revision: 1.11 $  $Name: not supported by cvs2svn $
     19 *  @date  $Date: 2005-02-24 00:19:51 $
    2020 *
    2121 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    245245                            "Invalid operation: inVector or its data is NULL.", 0);
    246246    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
    247     if(psVectorToMatrix(m2, NULL) != m2) {
     247    if(psVectorToMatrix(m2, NULL) != NULL) {
    248248        psError(PS_ERR_UNKNOWN,true,"Did not return output image");
    249249        return 12;
    250250    }
    251251    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
    252     if(psVectorToMatrix(m2_32, NULL) != m2_32) {
     252    if(psVectorToMatrix(m2_32, NULL) != NULL) {
    253253        psError(PS_ERR_UNKNOWN,true,"Did not return output image");
    254254        return 13;
     
    288288    psFree(m1);
    289289    psFree(v1);
    290     psFree(m2);
    291290    psFree(v2);
    292291    psFree(v3);
     
    295294    psFree(m1_32);
    296295    psFree(v1_32);
    297     psFree(m2_32);
    298296    psFree(v2_32);
    299297    psFree(v3_32);
  • trunk/psLib/test/dataManip/verified/tst_psMatrix02.stdout

    r2678 r3313  
    22*             TestFile: tst_psMatrix02.c                                           *
    33*            TestPoint: psMatrix{Input pointer same as output pointer}             *
    4 *             TestType: Negative                                                   *
    5 *    ExpectedErrorText: Invalid operation: Pointer to inImage is same as outImage. *
    6 *  ExpectedStatusValue: 0                                                          *
     4*             TestType: Positive                                                   *
    75\**********************************************************************************/
    86
     
    1311*             TestFile: tst_psMatrix02.c                                           *
    1412*            TestPoint: psMatrix{Null input psImage}                               *
    15 *             TestType: Negative                                                   *
    16 *    ExpectedErrorText: Invalid operation: inImage or its data is NULL.            *
    17 *  ExpectedStatusValue: 0                                                          *
     13*             TestType: Positive                                                   *
    1814\**********************************************************************************/
    1915
     
    2420*             TestFile: tst_psMatrix02.c                                           *
    2521*            TestPoint: psMatrix{Incorrect type for input pointer}                 *
    26 *             TestType: Negative                                                   *
    27 *    ExpectedErrorText: |Invalid operation: inImage not PS_TYPE_F64.               *
    28 *  ExpectedStatusValue: 0                                                          *
     22*             TestType: Positive                                                   *
    2923\**********************************************************************************/
    3024
     
    3529*             TestFile: tst_psMatrix02.c                                           *
    3630*            TestPoint: psMatrix{Incorrect type for output pointer}                *
    37 *             TestType: Negative                                                   *
    38 *    ExpectedErrorText: Invalid operation: outImage not PS_TYPE_F64.               *
    39 *  ExpectedStatusValue: 0                                                          *
     31*             TestType: Positive                                                   *
    4032\**********************************************************************************/
    4133
     
    4638*             TestFile: tst_psMatrix02.c                                           *
    4739*            TestPoint: psMatrix{Matrix not square for output pointer}             *
    48 *             TestType: Negative                                                   *
    49 *    ExpectedErrorText: Invalid operation: outImage not square array.              *
    50 *  ExpectedStatusValue: 0                                                          *
     40*             TestType: Positive                                                   *
    5141\**********************************************************************************/
    5242
Note: See TracChangeset for help on using the changeset viewer.