IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 1, 2004, 12:42:57 PM (22 years ago)
Author:
desonia
Message:

renamed data.v to data.V in psImage struct to be same as psVector.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psMatrix.c

    r807 r824  
    2020 *  @author Ross Harman, MHPCC
    2121 *   
    22  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    23  *  @date $Date: 2004-05-28 20:52:41 $
     22 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     23 *  @date $Date: 2004-06-01 22:42:57 $
    2424 *
    2525 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6969
    7070/** Preprocessor macro to generate error a NULL image */
    71 #define PS_CHECK_NULL_VECTOR(NAME, RETURN)                                                                    \
    72 if (NAME == NULL || NAME->vec.v == NULL) {                                                                \
    73     psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME);                                \
    74     return RETURN;                                                                                        \
     71#define PS_CHECK_NULL_VECTOR(NAME, RETURN)                                                          \
     72if (NAME == NULL || NAME->vec.v == NULL) {                                                          \
     73    psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME);                          \
     74    return RETURN;                                                                                  \
    7575}
    7676
    7777/** Preprocessor macro to create vector based on another */
    78 #define PS_CHECK_ALLOC_VECTOR(NAME, SIZE, PS_TYPE)                                                            \
    79 if(NAME == NULL) {                                                                                        \
    80     NAME = psVectorAlloc(PS_TYPE, SIZE);                                                                  \
     78#define PS_CHECK_ALLOC_VECTOR(NAME, SIZE, PS_TYPE)                                                  \
     79if(NAME == NULL) {                                                                                  \
     80    NAME = psVectorAlloc(PS_TYPE, SIZE);                                                            \
    8181}
    8282
    8383/** Preprocessor macro to generate error for zero length vector */
    84 #define PS_CHECK_SIZE_VECTOR(NAME, RETURN)                                                                    \
    85 if (NAME->n < 1) {                                                                                        \
    86     psError(__func__,"Invalid operation: %s has zero n value.", #NAME);                                   \
    87     return RETURN;                                                                                        \
     84#define PS_CHECK_SIZE_VECTOR(NAME, RETURN)                                                          \
     85if (NAME->n < 1) {                                                                                  \
     86    psError(__func__,"Invalid operation: %s has zero n value.", #NAME);                             \
     87    return RETURN;                                                                                  \
    8888}
    8989
    9090/** Preprocessor macro to generate error a NULL image */
    91 #define PS_CHECK_NULL_IMAGE(NAME, RETURN)                                                                     \
    92 if (NAME == NULL || NAME->data.v == NULL) {                                                               \
    93     psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME);                                \
    94     return RETURN;                                                                                        \
     91#define PS_CHECK_NULL_IMAGE(NAME, RETURN)                                                           \
     92if (NAME == NULL || NAME->data.V == NULL) {                                                         \
     93    psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME);                          \
     94    return RETURN;                                                                                  \
    9595}
    9696
    9797/** Preprocessor macro to create image based on another */
    98 #define PS_CHECK_ALLOC_IMAGE(NAME, NCOLS, NROWS, PS_TYPE)                                                    \
    99 if(NAME == NULL) {                                                                                       \
    100     NAME = psImageAlloc(NCOLS, NROWS, PS_TYPE);                                                          \
     98#define PS_CHECK_ALLOC_IMAGE(NAME, NCOLS, NROWS, PS_TYPE)                                           \
     99if(NAME == NULL) {                                                                                  \
     100    NAME = psImageAlloc(NCOLS, NROWS, PS_TYPE);                                                     \
    101101}
    102102
    103103/** Preprocessor macro to generate error for zero length rows or columns */
    104 #define PS_CHECK_SIZE_IMAGE(NAME, RETURN)                                                                     \
    105 if (NAME->numCols < 1 || NAME->numRows < 1) {                                                             \
    106     psError(__func__,"Invalid operation: %s has zero rows or columns (%dx%d).", #NAME,                    \
    107             NAME->numCols, NAME->numRows);                                                                        \
    108     return RETURN;                                                                                        \
     104#define PS_CHECK_SIZE_IMAGE(NAME, RETURN)                                                           \
     105if (NAME->numCols < 1 || NAME->numRows < 1) {                                                       \
     106    psError(__func__,"Invalid operation: %s has zero rows or columns (%dx%d).", #NAME,                 \
     107            NAME->numCols, NAME->numRows);                                                                 \
     108    return RETURN;                                                                                     \
    109109}
    110110
    111111/** Preprocessor macro to generate error for image dimensionality not set to PS_DIMEN_IMAGE */
    112 #define PS_CHECK_DIMEN_AND_TYPE(NAME, PS_DIMEN, RETURN)                                                       \
    113 if (NAME->type.dimen != PS_DIMEN) {                                                                       \
    114     psError(__func__,"Invalid operation: %s incorrect dimensionality %d.", #NAME, PS_DIMEN);              \
    115     return RETURN;                                                                                        \
    116 } else if(NAME->type.type != PS_TYPE_F64) {                                                               \
    117     psError(__func__, "Invalid operation: %s not PS_TYPE_F64.", #NAME);                                   \
    118     return RETURN;                                                                                        \
     112#define PS_CHECK_DIMEN_AND_TYPE(NAME, PS_DIMEN, RETURN)                                             \
     113if (NAME->type.dimen != PS_DIMEN) {                                                                 \
     114    psError(__func__,"Invalid operation: %s incorrectdimensionality %d.", #NAME, PS_DIMEN);         \
     115    return RETURN;                                                                                  \
     116} else if(NAME->type.type != PS_TYPE_F64) {                                                         \
     117    psError(__func__, "Invalid operation: %s not PS_TYPE_F64.", #NAME);                             \
     118    return RETURN;                                                                                   \
    119119}
    120120
    121121/** Preprocessor macro to check that input is not equal to output */
    122 #define PS_CHECK_POINTERS(NAME1, NAME2, RETURN)                                                               \
    123 if (NAME1 == NAME2) {                                                                                     \
    124     psError(__func__,"Invalid operation: Pointer to %s is same as %s.", #NAME1, #NAME2);                  \
    125     return RETURN;                                                                                        \
     122#define PS_CHECK_POINTERS(NAME1, NAME2, RETURN)                                                     \
     123if (NAME1 == NAME2) {                                                                               \
     124    psError(__func__,"Invalid operation: Pointer to %s is same as %s.", #NAME1, #NAME2);            \
     125    return RETURN;                                                                                  \
    126126}
    127127
    128128/** Preprocessor macro to check that an image is square */
    129 #define PS_CHECK_SQUARE(NAME, RETURN)                                                                         \
    130 if (NAME->numCols != NAME->numRows) {                                                                     \
    131     psError(__func__,"Invalid operation: %s not square array.", #NAME);                                   \
    132     return RETURN;                                                                                        \
     129#define PS_CHECK_SQUARE(NAME, RETURN)                                                               \
     130if (NAME->numCols != NAME->numRows) {                                                               \
     131    psError(__func__,"Invalid operation: %s not square array.", #NAME);                             \
     132    return RETURN;                                                                                  \
    133133}
    134134
    135135/** Preprocessor macro to initalize a GSL matrix. */
    136 #define PS_GSL_MATRIX_INITIALIZE(LHS_NAME, RHS_NAME)                                                          \
    137 LHS_NAME.size1 = numRows;                                                                                 \
    138 LHS_NAME.size2 = numCols;                                                                                 \
    139 LHS_NAME.tda   = numCols;                                                                                 \
     136#define PS_GSL_MATRIX_INITIALIZE(LHS_NAME, RHS_NAME)                                                \
     137LHS_NAME.size1 = numRows;                                                                           \
     138LHS_NAME.size2 = numCols;                                                                           \
     139LHS_NAME.tda   = numCols;                                                                           \
    140140LHS_NAME.data  = RHS_NAME;
    141141
     
    174174    outPerm->n = numCols;
    175175    perm.data = outPerm->vec.v;
    176     PS_GSL_MATRIX_INITIALIZE(lu, outImage->data.v[0]);
     176    PS_GSL_MATRIX_INITIALIZE(lu, outImage->data.V[0]);
    177177
    178178    // Non-square matrices not allowed
     
    181181
    182182    // Copy psImage input data into GSL matrix data to keep input data pristine
    183     memcpy(lu.data, inImage->data.v[0], arraySize);
     183    memcpy(lu.data, inImage->data.V[0], arraySize);
    184184
    185185    // Calculate LU decomposition
     
    189189}
    190190
    191 psVector *psMatrixLUSolve(psVector *outVector, const psImage *inImage, const psVector *inVector, const psVector *inPerm)
     191psVector *psMatrixLUSolve(psVector *outVector, const psImage *inImage, const psVector *inVector, const
     192                          psVector *inPerm)
    192193{
    193194    int arraySize = 0;
     
    220221
    221222    // Initialize GSL data
    222     PS_GSL_MATRIX_INITIALIZE(lu, inImage->data.v[0]);
     223    PS_GSL_MATRIX_INITIALIZE(lu, inImage->data.V[0]);
    223224
    224225    outVector->n = numCols;
     
    270271
    271272    // Initialize GSL data
    272     PS_GSL_MATRIX_INITIALIZE(inv, outImage->data.v[0]);
     273    PS_GSL_MATRIX_INITIALIZE(inv, outImage->data.V[0]);
    273274
    274275    // Non-square matrices not allowed
     
    277278
    278279    // Copy psImage input data into GSL matrix data to keep input data pristine
    279     memcpy(lu->data, inImage->data.v[0], arraySize);
     280    memcpy(lu->data, inImage->data.V[0], arraySize);
    280281
    281282    // Invert data and calculate determinant
     
    319320
    320321    // Copy psImage input data into GSL matrix data to keep input data pristine
    321     memcpy(lu->data, inImage->data.v[0], arraySize);
     322    memcpy(lu->data, inImage->data.V[0], arraySize);
    322323
    323324    // Calculate determinant
     
    360361
    361362    // Initialize GSL data
    362     PS_GSL_MATRIX_INITIALIZE(m1, inImage1->data.v[0]);
    363     PS_GSL_MATRIX_INITIALIZE(m2, inImage2->data.v[0]);
    364     PS_GSL_MATRIX_INITIALIZE(m3, outImage->data.v[0]);
     363    PS_GSL_MATRIX_INITIALIZE(m1, inImage1->data.V[0]);
     364    PS_GSL_MATRIX_INITIALIZE(m2, inImage2->data.V[0]);
     365    PS_GSL_MATRIX_INITIALIZE(m3, outImage->data.V[0]);
    365366
    366367    // Non-square matrices not allowed
     
    396397
    397398    // Initialize GSL data
    398     PS_GSL_MATRIX_INITIALIZE(trans, outImage->data.v[0]);
     399    PS_GSL_MATRIX_INITIALIZE(trans, outImage->data.V[0]);
    399400
    400401    // Non-square matrices not allowed
     
    403404
    404405    // Copy psImage input data into psImage output data to keep input data pristine
    405     memcpy(outImage->data.v[0], inImage->data.v[0], arraySize);
     406    memcpy(outImage->data.V[0], inImage->data.V[0], arraySize);
    406407
    407408    // Transpose data
     
    434435
    435436    // Initialize GSL data
    436     PS_GSL_MATRIX_INITIALIZE(in, inImage->data.v[0]);
    437     PS_GSL_MATRIX_INITIALIZE(out, outImage->data.v[0]);
     437    PS_GSL_MATRIX_INITIALIZE(in, inImage->data.V[0]);
     438    PS_GSL_MATRIX_INITIALIZE(out, outImage->data.V[0]);
    438439
    439440    // Allocate GSL structs
     
    482483
    483484    colSize = PSELEMTYPE_SIZEOF(inImage->type.type)*inImage->numRows;
    484     memcpy(outVector->vec.v, inImage->data.v[0], colSize);
     485    memcpy(outVector->vec.v, inImage->data.V[0], colSize);
    485486
    486487    return outVector;
     
    509510
    510511    colSize = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numRows;
    511     memcpy(outImage->data.v[0], inVector->vec.v, colSize);
     512    memcpy(outImage->data.V[0], inVector->vec.v, colSize);
    512513
    513514    return outImage;
Note: See TracChangeset for help on using the changeset viewer.