IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2215


Ignore:
Timestamp:
Oct 27, 2004, 10:29:12 AM (22 years ago)
Author:
gusciora
Message:

I've been unifying the naming conventions for various macros that check
functions parameters for type, size, non-NULL ...

Location:
trunk/psLib/src
Files:
4 edited

Legend:

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

    r2214 r2215  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-10-27 20:20:11 $
     8 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-27 20:29:12 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2424 *****************************************************************************/
    2525
    26 
    27 
    28 /*****************************************************************************
    29  
    30  *****************************************************************************/
    31 #define CONVERT_VECTOR_F64_TO_F32(OLD, NEW_PTR32, NEW_STATIC32) \
     26#define PS_ONE 1.0
     27/*****************************************************************************
     28Macros which take a generic psLib type and determine if it is NULL, or has
     29the wrong type.
     30*****************************************************************************/
     31#define PS_PTR_CHECK_NULL(NAME, RVAL) \
     32if (NAME == NULL) { \
     33    psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \
     34    return(RVAL); \
     35}
     36
     37#define PS_PTR_CHECK_TYPE(NAME, TYPE, RVAL) \
     38if (NAME->type.type != TYPE) { \
     39    psError(__func__,"Unallowable operation: %s has incorrect type.", #NAME); \
     40    return(RVAL); \
     41}
     42
     43/*****************************************************************************
     44    PS_VECTOR macros:
     45 *****************************************************************************/
     46#define PS_VECTOR_CHECK_TYPE_F32_OR_F64(VEC, RVAL) \
     47if ((VEC->type.type != PS_TYPE_F32) && (VEC->type.type != PS_TYPE_F64)) { \
     48    psAbort(__func__, "Bad type for VEC (%d)", VEC->type.type); \
     49    return(RVAL); \
     50} \
     51
     52#define PS_VECTOR_CHECK_TYPE(NAME, TYPE, RVAL) \
     53if (NAME->type.type != TYPE) { \
     54    psError(__func__,"Unallowable operation: %s has incorrect type.", #NAME); \
     55    return(RVAL); \
     56}
     57
     58#define PS_VECTOR_CHECK_NULL(NAME, RVAL) \
     59if (NAME == NULL || NAME->data.V == NULL) { \
     60    psError(__func__,"Unallowable operation: %s or its data is NULL.", #NAME); \
     61    return(RVAL); \
     62} \
     63
     64#define PS_VECTOR_CHECK_EMPTY(NAME, RVAL) \
     65if (NAME->n < 1) { \
     66    psError(__func__,"Unallowable operation: %s has zero n value.", #NAME); \
     67    return(RVAL); \
     68} \
     69
     70#define PS_VECTOR_CHECK_SIZE_EQUAL(VEC1, VEC2, RVAL) \
     71if (VEC1->n != VEC2->n) { \
     72    psError(__func__,"Vector %s has size %d, Vector %s has size %d.", #VEC1, VEC1->n, #VEC2, VEC2->n); \
     73    return(RVAL); \
     74}
     75
     76#define PS_VECTOR_F64_TO_F32(X64, X32) \
     77psVector *X32 = psVectorAlloc(X64->n, PS_TYPE_F32); \
     78for (int i=0;i<X64->n;i++) { \
     79    X32->data.F32[i] = (float) X64->data.F64[i]; \
     80} \
     81
     82#define PS_VECTOR_F32_TO_F64(X32, X64) \
     83psVector *X64 = psVectorAlloc(X32->n, PS_TYPE_F64); \
     84for (int i=0;i<X32->n;i++) { \
     85    X64->data.F64[i] = (float) X32->data.F32[i]; \
     86} \
     87
     88#define PS_VECTOR_PRINT(NAME) \
     89for (int my_i=0;my_i<NAME->n;my_i++) { \
     90    printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \
     91} \
     92printf("\n"); \
     93
     94
     95#define PS_VECTOR_CONVERT_F64_TO_F32_STATIC(OLD, NEW_PTR32, NEW_STATIC32) \
    3296if (OLD->type.type == PS_TYPE_F32) { \
    3397    NEW_PTR32 = (psVector *) OLD; \
     
    42106} \
    43107
    44 #define CONVERT_VECTOR_F32_TO_F64(OLD, NEW_PTR64, NEW_STATIC64) \
     108#define PS_VECTOR_CONVERT_F32_TO_F64_STATIC(OLD, NEW_PTR64, NEW_STATIC64) \
    45109if (OLD->type.type == PS_TYPE_F64) { \
    46110    NEW_PTR64 = (psVector *) OLD; \
     
    55119} \
    56120
    57 #define GEN_PERSIST_YERR_VEC_F32(VEC, N) \
     121#define PS_VECTOR_GEN_YERR_STATIC_F32(VEC, N) \
    58122VEC = psVectorRecycle(VEC, N, PS_TYPE_F32); \
    59123p_psMemSetPersistent(VEC, true); \
     
    63127} \
    64128
    65 #define GEN_PERSIST_YERR_VEC_F64(VEC, N) \
     129#define PS_VECTOR_GEN_YERR_STATIC_F64(VEC, N) \
    66130VEC = psVectorRecycle(VEC, N, PS_TYPE_F64); \
    67131p_psMemSetPersistent(VEC, true); \
     
    71135} \
    72136
    73 #define GEN_PERSIST_X_INDEX_VEC_F32(VEC, N) \
     137#define PS_VECTOR_GEN_X_INDEX_STATIC_F32(VEC, N) \
    74138VEC = psVectorRecycle(VEC, N, PS_TYPE_F32); \
    75139p_psMemSetPersistent(VEC, true); \
     
    79143} \
    80144
    81 #define GEN_PERSIST_X_INDEX_VEC_F64(VEC, N) \
     145#define PS_VECTOR_GEN_X_INDEX_STATIC_F64(VEC, N) \
    82146VEC = psVectorRecycle(VEC, N, PS_TYPE_F64); \
    83147p_psMemSetPersistent(VEC, true); \
     
    87151} \
    88152
    89 #define GEN_STATIC_RECYCLED_VECTOR(NAME, SIZE, TYPE) \
     153#define PS_VECTOR_GEN_STATIC_RECYCLED(NAME, SIZE, TYPE) \
    90154static psVector *NAME = NULL; \
    91155NAME = psVectorRecycle(NAME, SIZE, TYPE); \
     
    95159
    96160/*****************************************************************************
    97 Macros which take a generic psLib type and determine if it is NULL, or has
    98 the wrong type.
    99 *****************************************************************************/
    100 #define PS_PTR_CHECK_NULL(NAME, RVAL) \
    101 if (NAME == NULL) { \
    102     psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \
    103     return(RVAL); \
    104 }
    105 
    106 #define PS_PTR_CHECK_TYPE(NAME, TYPE, RVAL) \
    107 if (NAME->type.type != TYPE) { \
    108     psError(__func__,"Unallowable operation: %s has incorrect type.", #NAME); \
    109     return(RVAL); \
    110 }
    111 
    112 
    113 /*****************************************************************************
    114 Macros which take a psVector type and determine if it is NULL, or has the
    115 wrong type.
    116  *****************************************************************************/
    117 #define PS_VECTOR_CHECK_TYPE_F32_OR_F64(VEC, RVAL) \
    118 if ((VEC->type.type != PS_TYPE_F32) && (VEC->type.type != PS_TYPE_F64)) { \
    119     psAbort(__func__, "Bad type for VEC (%d)", VEC->type.type); \
    120     return(RVAL); \
    121 } \
    122 
    123 #define PS_VECTOR_CHECK_TYPE(NAME, TYPE, RVAL) \
    124 if (NAME->type.type != TYPE) { \
    125     psError(__func__,"Unallowable operation: %s has incorrect type.", #NAME); \
    126     return(RVAL); \
    127 }
    128 
    129 #define PS_VECTOR_CHECK_NULL(NAME, RVAL) \
    130 if (NAME == NULL || NAME->data.V == NULL) { \
    131     psError(__func__,"Unallowable operation: %s or its data is NULL.", #NAME); \
    132     return(RVAL); \
    133 } \
    134 
    135 #define PS_VECTOR_CHECK_EMPTY(NAME, RVAL) \
    136 if (NAME->n < 1) { \
    137     psError(__func__,"Unallowable operation: %s has zero n value.", #NAME); \
    138     return(RVAL); \
    139 } \
    140 
    141 #define PS_VECTOR_CHECK_SIZE_EQUAL(VEC1, VEC2, RVAL) \
    142 if (VEC1->n != VEC2->n) { \
    143     psError(__func__,"Vector %s has size %d, Vector %s has size %d.", #VEC1, VEC1->n, #VEC2, VEC2->n); \
    144     return(RVAL); \
    145 }
    146 
    147 #define PS_VECTOR_F64_TO_F32(X64, X32) \
    148 psVector *X32 = psVectorAlloc(X64->n, PS_TYPE_F32); \
    149 for (int i=0;i<X64->n;i++) { \
    150     X32->data.F32[i] = (float) X64->data.F64[i]; \
    151 } \
    152 
    153 #define PS_VECTOR_F32_TO_F64(X32, X64) \
    154 psVector *X64 = psVectorAlloc(X32->n, PS_TYPE_F64); \
    155 for (int i=0;i<X32->n;i++) { \
    156     X64->data.F64[i] = (float) X32->data.F32[i]; \
    157 } \
    158 
    159 #define PS_VECTOR_PRINT(NAME) \
    160 for (int my_i=0;my_i<NAME->n;my_i++) { \
    161     printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \
    162 } \
    163 printf("\n"); \
    164 
    165 
    166 /*****************************************************************************
    167  
     161    PS_POLY macros:
    168162*****************************************************************************/
    169163#define PS_POLY_CHECK_NULL(NAME, NULL) \
     
    174168
    175169/*****************************************************************************
    176  
     170    PS_IMAGE macros:
    177171*****************************************************************************/
    178172#define PS_IMAGE_CHECK_NULL(NAME, RVAL) \
     
    195189}
    196190/*****************************************************************************
    197  
     191    PS_READOUT macros:
    198192 *****************************************************************************/
    199193/** Preprocessor macro to generate error on a NULL image */
     
    204198}
    205199
    206 
    207 
    208 
    209 
    210 /*****************************************************************************
    211  
     200/*****************************************************************************
     201    Misc. macros:
    212202 *****************************************************************************/
    213203#define PS_MAX(A, B) \
  • trunk/psLib/src/dataManip/psMinimize.c

    r2214 r2215  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.68 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-27 20:20:11 $
     11 *  @version $Revision: 1.69 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 20:29:12 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    255255    PS_PTR_CHECK_NULL(y, NULL);
    256256    PS_VECTOR_CHECK_TYPE_F32_OR_F64(y, NULL);
    257     CONVERT_VECTOR_F64_TO_F32(y, y32, y32Static);
     257    PS_VECTOR_CONVERT_F64_TO_F32_STATIC(y, y32, y32Static);
    258258
    259259    // If yErr==NULL, set all errors equal.
    260260    if (yErr == NULL) {
    261         GEN_PERSIST_YERR_VEC_F32(yErr32Static, y->n);
     261        PS_VECTOR_GEN_YERR_STATIC_F32(yErr32Static, y->n);
    262262        yErr32 = yErr32Static;
    263263    } else {
    264264        PS_VECTOR_CHECK_TYPE_F32_OR_F64(yErr, NULL);
    265         CONVERT_VECTOR_F64_TO_F32(yErr, yErr32, yErr32Static);
     265        PS_VECTOR_CONVERT_F64_TO_F32_STATIC(yErr, yErr32, yErr32Static);
    266266    }
    267267
    268268    // If x==NULL, create an x32 vector with x values set to (0:n).
    269269    if (x == NULL) {
    270         GEN_PERSIST_X_INDEX_VEC_F32(x32Static, y->n);
     270        PS_VECTOR_GEN_X_INDEX_STATIC_F32(x32Static, y->n);
    271271        x32 = x32Static;
    272272    } else {
    273273        PS_VECTOR_CHECK_TYPE_F32_OR_F64(x, NULL);
    274         CONVERT_VECTOR_F64_TO_F32(x, x32, x32Static);
     274        PS_VECTOR_CONVERT_F64_TO_F32_STATIC(x, x32, x32Static);
    275275    }
    276276    PS_VECTOR_CHECK_SIZE_EQUAL(x32, y32, NULL);
     
    668668    double fac;
    669669    double sum;
    670     GEN_STATIC_RECYCLED_VECTOR(f, n, PS_TYPE_F64);
     670    PS_VECTOR_GEN_STATIC_RECYCLED(f, n, PS_TYPE_F64);
    671671    psScalar *fScalar;
    672672    psScalar tmpScalar;
     
    866866
    867867    PS_VECTOR_CHECK_TYPE_F32_OR_F64(y, NULL);
    868     CONVERT_VECTOR_F32_TO_F64(y, y64, y64Static);
     868    PS_VECTOR_CONVERT_F32_TO_F64_STATIC(y, y64, y64Static);
    869869
    870870    // If yErr==NULL, set all errors equal.
    871871    if (yErr == NULL) {
    872         GEN_PERSIST_YERR_VEC_F64(yErr64Static, y->n);
     872        PS_VECTOR_GEN_YERR_STATIC_F64(yErr64Static, y->n);
    873873        yErr64 = yErr64Static;
    874874    } else {
    875875        PS_VECTOR_CHECK_TYPE_F32_OR_F64(yErr, NULL);
    876         CONVERT_VECTOR_F32_TO_F64(yErr, yErr64, yErr64Static);
     876        PS_VECTOR_CONVERT_F32_TO_F64_STATIC(yErr, yErr64, yErr64Static);
    877877    }
    878878
    879879    // If x==NULL, create an x64 vector with x values set to (0:n).
    880880    if (x == NULL) {
    881         GEN_PERSIST_X_INDEX_VEC_F64(x64Static, y->n);
     881        PS_VECTOR_GEN_X_INDEX_STATIC_F64(x64Static, y->n);
    882882        if (myPoly->type == PS_POLYNOMIAL_CHEB) {
    883883            p_psNormalizeVector(x64Static);
     
    886886    } else {
    887887        PS_VECTOR_CHECK_TYPE_F32_OR_F64(x, NULL);
    888         CONVERT_VECTOR_F32_TO_F64(x, x64, x64Static);
     888        PS_VECTOR_CONVERT_F32_TO_F64_STATIC(x, x64, x64Static);
    889889    }
    890890    PS_VECTOR_CHECK_SIZE_EQUAL(x64, y64, NULL);
  • trunk/psLib/src/math/psConstants.h

    r2214 r2215  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-10-27 20:20:11 $
     8 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-27 20:29:12 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2424 *****************************************************************************/
    2525
    26 
    27 
    28 /*****************************************************************************
    29  
    30  *****************************************************************************/
    31 #define CONVERT_VECTOR_F64_TO_F32(OLD, NEW_PTR32, NEW_STATIC32) \
     26#define PS_ONE 1.0
     27/*****************************************************************************
     28Macros which take a generic psLib type and determine if it is NULL, or has
     29the wrong type.
     30*****************************************************************************/
     31#define PS_PTR_CHECK_NULL(NAME, RVAL) \
     32if (NAME == NULL) { \
     33    psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \
     34    return(RVAL); \
     35}
     36
     37#define PS_PTR_CHECK_TYPE(NAME, TYPE, RVAL) \
     38if (NAME->type.type != TYPE) { \
     39    psError(__func__,"Unallowable operation: %s has incorrect type.", #NAME); \
     40    return(RVAL); \
     41}
     42
     43/*****************************************************************************
     44    PS_VECTOR macros:
     45 *****************************************************************************/
     46#define PS_VECTOR_CHECK_TYPE_F32_OR_F64(VEC, RVAL) \
     47if ((VEC->type.type != PS_TYPE_F32) && (VEC->type.type != PS_TYPE_F64)) { \
     48    psAbort(__func__, "Bad type for VEC (%d)", VEC->type.type); \
     49    return(RVAL); \
     50} \
     51
     52#define PS_VECTOR_CHECK_TYPE(NAME, TYPE, RVAL) \
     53if (NAME->type.type != TYPE) { \
     54    psError(__func__,"Unallowable operation: %s has incorrect type.", #NAME); \
     55    return(RVAL); \
     56}
     57
     58#define PS_VECTOR_CHECK_NULL(NAME, RVAL) \
     59if (NAME == NULL || NAME->data.V == NULL) { \
     60    psError(__func__,"Unallowable operation: %s or its data is NULL.", #NAME); \
     61    return(RVAL); \
     62} \
     63
     64#define PS_VECTOR_CHECK_EMPTY(NAME, RVAL) \
     65if (NAME->n < 1) { \
     66    psError(__func__,"Unallowable operation: %s has zero n value.", #NAME); \
     67    return(RVAL); \
     68} \
     69
     70#define PS_VECTOR_CHECK_SIZE_EQUAL(VEC1, VEC2, RVAL) \
     71if (VEC1->n != VEC2->n) { \
     72    psError(__func__,"Vector %s has size %d, Vector %s has size %d.", #VEC1, VEC1->n, #VEC2, VEC2->n); \
     73    return(RVAL); \
     74}
     75
     76#define PS_VECTOR_F64_TO_F32(X64, X32) \
     77psVector *X32 = psVectorAlloc(X64->n, PS_TYPE_F32); \
     78for (int i=0;i<X64->n;i++) { \
     79    X32->data.F32[i] = (float) X64->data.F64[i]; \
     80} \
     81
     82#define PS_VECTOR_F32_TO_F64(X32, X64) \
     83psVector *X64 = psVectorAlloc(X32->n, PS_TYPE_F64); \
     84for (int i=0;i<X32->n;i++) { \
     85    X64->data.F64[i] = (float) X32->data.F32[i]; \
     86} \
     87
     88#define PS_VECTOR_PRINT(NAME) \
     89for (int my_i=0;my_i<NAME->n;my_i++) { \
     90    printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \
     91} \
     92printf("\n"); \
     93
     94
     95#define PS_VECTOR_CONVERT_F64_TO_F32_STATIC(OLD, NEW_PTR32, NEW_STATIC32) \
    3296if (OLD->type.type == PS_TYPE_F32) { \
    3397    NEW_PTR32 = (psVector *) OLD; \
     
    42106} \
    43107
    44 #define CONVERT_VECTOR_F32_TO_F64(OLD, NEW_PTR64, NEW_STATIC64) \
     108#define PS_VECTOR_CONVERT_F32_TO_F64_STATIC(OLD, NEW_PTR64, NEW_STATIC64) \
    45109if (OLD->type.type == PS_TYPE_F64) { \
    46110    NEW_PTR64 = (psVector *) OLD; \
     
    55119} \
    56120
    57 #define GEN_PERSIST_YERR_VEC_F32(VEC, N) \
     121#define PS_VECTOR_GEN_YERR_STATIC_F32(VEC, N) \
    58122VEC = psVectorRecycle(VEC, N, PS_TYPE_F32); \
    59123p_psMemSetPersistent(VEC, true); \
     
    63127} \
    64128
    65 #define GEN_PERSIST_YERR_VEC_F64(VEC, N) \
     129#define PS_VECTOR_GEN_YERR_STATIC_F64(VEC, N) \
    66130VEC = psVectorRecycle(VEC, N, PS_TYPE_F64); \
    67131p_psMemSetPersistent(VEC, true); \
     
    71135} \
    72136
    73 #define GEN_PERSIST_X_INDEX_VEC_F32(VEC, N) \
     137#define PS_VECTOR_GEN_X_INDEX_STATIC_F32(VEC, N) \
    74138VEC = psVectorRecycle(VEC, N, PS_TYPE_F32); \
    75139p_psMemSetPersistent(VEC, true); \
     
    79143} \
    80144
    81 #define GEN_PERSIST_X_INDEX_VEC_F64(VEC, N) \
     145#define PS_VECTOR_GEN_X_INDEX_STATIC_F64(VEC, N) \
    82146VEC = psVectorRecycle(VEC, N, PS_TYPE_F64); \
    83147p_psMemSetPersistent(VEC, true); \
     
    87151} \
    88152
    89 #define GEN_STATIC_RECYCLED_VECTOR(NAME, SIZE, TYPE) \
     153#define PS_VECTOR_GEN_STATIC_RECYCLED(NAME, SIZE, TYPE) \
    90154static psVector *NAME = NULL; \
    91155NAME = psVectorRecycle(NAME, SIZE, TYPE); \
     
    95159
    96160/*****************************************************************************
    97 Macros which take a generic psLib type and determine if it is NULL, or has
    98 the wrong type.
    99 *****************************************************************************/
    100 #define PS_PTR_CHECK_NULL(NAME, RVAL) \
    101 if (NAME == NULL) { \
    102     psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \
    103     return(RVAL); \
    104 }
    105 
    106 #define PS_PTR_CHECK_TYPE(NAME, TYPE, RVAL) \
    107 if (NAME->type.type != TYPE) { \
    108     psError(__func__,"Unallowable operation: %s has incorrect type.", #NAME); \
    109     return(RVAL); \
    110 }
    111 
    112 
    113 /*****************************************************************************
    114 Macros which take a psVector type and determine if it is NULL, or has the
    115 wrong type.
    116  *****************************************************************************/
    117 #define PS_VECTOR_CHECK_TYPE_F32_OR_F64(VEC, RVAL) \
    118 if ((VEC->type.type != PS_TYPE_F32) && (VEC->type.type != PS_TYPE_F64)) { \
    119     psAbort(__func__, "Bad type for VEC (%d)", VEC->type.type); \
    120     return(RVAL); \
    121 } \
    122 
    123 #define PS_VECTOR_CHECK_TYPE(NAME, TYPE, RVAL) \
    124 if (NAME->type.type != TYPE) { \
    125     psError(__func__,"Unallowable operation: %s has incorrect type.", #NAME); \
    126     return(RVAL); \
    127 }
    128 
    129 #define PS_VECTOR_CHECK_NULL(NAME, RVAL) \
    130 if (NAME == NULL || NAME->data.V == NULL) { \
    131     psError(__func__,"Unallowable operation: %s or its data is NULL.", #NAME); \
    132     return(RVAL); \
    133 } \
    134 
    135 #define PS_VECTOR_CHECK_EMPTY(NAME, RVAL) \
    136 if (NAME->n < 1) { \
    137     psError(__func__,"Unallowable operation: %s has zero n value.", #NAME); \
    138     return(RVAL); \
    139 } \
    140 
    141 #define PS_VECTOR_CHECK_SIZE_EQUAL(VEC1, VEC2, RVAL) \
    142 if (VEC1->n != VEC2->n) { \
    143     psError(__func__,"Vector %s has size %d, Vector %s has size %d.", #VEC1, VEC1->n, #VEC2, VEC2->n); \
    144     return(RVAL); \
    145 }
    146 
    147 #define PS_VECTOR_F64_TO_F32(X64, X32) \
    148 psVector *X32 = psVectorAlloc(X64->n, PS_TYPE_F32); \
    149 for (int i=0;i<X64->n;i++) { \
    150     X32->data.F32[i] = (float) X64->data.F64[i]; \
    151 } \
    152 
    153 #define PS_VECTOR_F32_TO_F64(X32, X64) \
    154 psVector *X64 = psVectorAlloc(X32->n, PS_TYPE_F64); \
    155 for (int i=0;i<X32->n;i++) { \
    156     X64->data.F64[i] = (float) X32->data.F32[i]; \
    157 } \
    158 
    159 #define PS_VECTOR_PRINT(NAME) \
    160 for (int my_i=0;my_i<NAME->n;my_i++) { \
    161     printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \
    162 } \
    163 printf("\n"); \
    164 
    165 
    166 /*****************************************************************************
    167  
     161    PS_POLY macros:
    168162*****************************************************************************/
    169163#define PS_POLY_CHECK_NULL(NAME, NULL) \
     
    174168
    175169/*****************************************************************************
    176  
     170    PS_IMAGE macros:
    177171*****************************************************************************/
    178172#define PS_IMAGE_CHECK_NULL(NAME, RVAL) \
     
    195189}
    196190/*****************************************************************************
    197  
     191    PS_READOUT macros:
    198192 *****************************************************************************/
    199193/** Preprocessor macro to generate error on a NULL image */
     
    204198}
    205199
    206 
    207 
    208 
    209 
    210 /*****************************************************************************
    211  
     200/*****************************************************************************
     201    Misc. macros:
    212202 *****************************************************************************/
    213203#define PS_MAX(A, B) \
  • trunk/psLib/src/math/psMinimize.c

    r2214 r2215  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.68 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-27 20:20:11 $
     11 *  @version $Revision: 1.69 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 20:29:12 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    255255    PS_PTR_CHECK_NULL(y, NULL);
    256256    PS_VECTOR_CHECK_TYPE_F32_OR_F64(y, NULL);
    257     CONVERT_VECTOR_F64_TO_F32(y, y32, y32Static);
     257    PS_VECTOR_CONVERT_F64_TO_F32_STATIC(y, y32, y32Static);
    258258
    259259    // If yErr==NULL, set all errors equal.
    260260    if (yErr == NULL) {
    261         GEN_PERSIST_YERR_VEC_F32(yErr32Static, y->n);
     261        PS_VECTOR_GEN_YERR_STATIC_F32(yErr32Static, y->n);
    262262        yErr32 = yErr32Static;
    263263    } else {
    264264        PS_VECTOR_CHECK_TYPE_F32_OR_F64(yErr, NULL);
    265         CONVERT_VECTOR_F64_TO_F32(yErr, yErr32, yErr32Static);
     265        PS_VECTOR_CONVERT_F64_TO_F32_STATIC(yErr, yErr32, yErr32Static);
    266266    }
    267267
    268268    // If x==NULL, create an x32 vector with x values set to (0:n).
    269269    if (x == NULL) {
    270         GEN_PERSIST_X_INDEX_VEC_F32(x32Static, y->n);
     270        PS_VECTOR_GEN_X_INDEX_STATIC_F32(x32Static, y->n);
    271271        x32 = x32Static;
    272272    } else {
    273273        PS_VECTOR_CHECK_TYPE_F32_OR_F64(x, NULL);
    274         CONVERT_VECTOR_F64_TO_F32(x, x32, x32Static);
     274        PS_VECTOR_CONVERT_F64_TO_F32_STATIC(x, x32, x32Static);
    275275    }
    276276    PS_VECTOR_CHECK_SIZE_EQUAL(x32, y32, NULL);
     
    668668    double fac;
    669669    double sum;
    670     GEN_STATIC_RECYCLED_VECTOR(f, n, PS_TYPE_F64);
     670    PS_VECTOR_GEN_STATIC_RECYCLED(f, n, PS_TYPE_F64);
    671671    psScalar *fScalar;
    672672    psScalar tmpScalar;
     
    866866
    867867    PS_VECTOR_CHECK_TYPE_F32_OR_F64(y, NULL);
    868     CONVERT_VECTOR_F32_TO_F64(y, y64, y64Static);
     868    PS_VECTOR_CONVERT_F32_TO_F64_STATIC(y, y64, y64Static);
    869869
    870870    // If yErr==NULL, set all errors equal.
    871871    if (yErr == NULL) {
    872         GEN_PERSIST_YERR_VEC_F64(yErr64Static, y->n);
     872        PS_VECTOR_GEN_YERR_STATIC_F64(yErr64Static, y->n);
    873873        yErr64 = yErr64Static;
    874874    } else {
    875875        PS_VECTOR_CHECK_TYPE_F32_OR_F64(yErr, NULL);
    876         CONVERT_VECTOR_F32_TO_F64(yErr, yErr64, yErr64Static);
     876        PS_VECTOR_CONVERT_F32_TO_F64_STATIC(yErr, yErr64, yErr64Static);
    877877    }
    878878
    879879    // If x==NULL, create an x64 vector with x values set to (0:n).
    880880    if (x == NULL) {
    881         GEN_PERSIST_X_INDEX_VEC_F64(x64Static, y->n);
     881        PS_VECTOR_GEN_X_INDEX_STATIC_F64(x64Static, y->n);
    882882        if (myPoly->type == PS_POLYNOMIAL_CHEB) {
    883883            p_psNormalizeVector(x64Static);
     
    886886    } else {
    887887        PS_VECTOR_CHECK_TYPE_F32_OR_F64(x, NULL);
    888         CONVERT_VECTOR_F32_TO_F64(x, x64, x64Static);
     888        PS_VECTOR_CONVERT_F32_TO_F64_STATIC(x, x64, x64Static);
    889889    }
    890890    PS_VECTOR_CHECK_SIZE_EQUAL(x64, y64, NULL);
Note: See TracChangeset for help on using the changeset viewer.