IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1088


Ignore:
Timestamp:
Jun 24, 2004, 4:00:41 PM (22 years ago)
Author:
harman
Message:

Name change of binary ops macros

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataManip/psMatrixVectorArithmetic.c

    r1085 r1088  
    2929 *  @author Ross Harman, MHPCC
    3030 *
    31  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    32  *  @date $Date: 2004-06-25 00:31:12 $
     31 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     32 *  @date $Date: 2004-06-25 02:00:41 $
    3333 *
    3434 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    323323
    324324// Preprocessor macro function to create arithmetic function based on input type
    325 #define LEVEL1(DIM1,DIM2,OUT,IN1,OP,IN2)                                                                     \
     325#define BINARY_TYPE(DIM1,DIM2,OUT,IN1,OP,IN2)                                                                \
    326326switch (IN1->type) {                                                                                         \
    327327case PS_TYPE_S8:                                                                                             \
     
    366366
    367367// Preprocessor macro function to create arithmetic function operation name
    368 #define LEVEL2(DIM1,DIM2,OUT,IN1,OP,IN2)                                                                     \
     368#define BINARY_OP(DIM1,DIM2,OUT,IN1,OP,IN2)                                                                  \
    369369if(!strncmp(OP, "+", 1)) {                                                                                   \
    370     LEVEL1(DIM1,DIM2,OUT,IN1,*i1 + *i2,IN2);                                                                 \
     370    BINARY_TYPE(DIM1,DIM2,OUT,IN1,*i1 + *i2,IN2);                                                            \
    371371} else if(!strncmp(OP, "-", 1)) {                                                                            \
    372     LEVEL1(DIM1,DIM2,OUT,IN1,*i1 - *i2,IN2);                                                                 \
     372    BINARY_TYPE(DIM1,DIM2,OUT,IN1,*i1 - *i2,IN2);                                                            \
    373373} else if(!strncmp(OP, "*", 1)) {                                                                            \
    374     LEVEL1(DIM1,DIM2,OUT,IN1,*i1 * *i2,IN2);                                                                 \
     374    BINARY_TYPE(DIM1,DIM2,OUT,IN1,*i1 * *i2,IN2);                                                            \
    375375} else if(!strncmp(OP, "/", 1)) {                                                                            \
    376     LEVEL1(DIM1,DIM2,OUT,IN1,*i1 / *i2,IN2);                                                                 \
     376    BINARY_TYPE(DIM1,DIM2,OUT,IN1,*i1 / *i2,IN2);                                                            \
    377377} else if(!strncmp(OP, "^", 1)) {                                                                            \
    378378    if(PS_IS_PSELEMTYPE_COMPLEX(IN1->type)) {                                                                \
    379         LEVEL1(DIM1,DIM2,OUT,IN1,cpow(*i1,*i2),IN2);                                                         \
    380     } else {                                                                                                 \
    381         LEVEL1(DIM1,DIM2,OUT,IN1,pow(*i1,*i2),IN2);                                                          \
     379        BINARY_TYPE(DIM1,DIM2,OUT,IN1,cpow(*i1,*i2),IN2);                                                    \
     380    } else {                                                                                                 \
     381        BINARY_TYPE(DIM1,DIM2,OUT,IN1,pow(*i1,*i2),IN2);                                                     \
    382382    }                                                                                                        \
    383383} else if(!strncmp(OP, "min", 3)) {                                                                          \
    384     LEVEL1(DIM1,DIM2,OUT,IN1,MIN(*i1,*i2),IN2);                                                              \
     384    BINARY_TYPE(DIM1,DIM2,OUT,IN1,MIN(*i1,*i2),IN2);                                                         \
    385385} else if(!strncmp(OP, "max", 3)) {                                                                          \
    386     LEVEL1(DIM1,DIM2,OUT,IN1,MAX(*i1,*i2),IN2);                                                              \
     386    BINARY_TYPE(DIM1,DIM2,OUT,IN1,MAX(*i1,*i2),IN2);                                                         \
    387387} else {                                                                                                     \
    388388    psError(__func__, ": Line %d - Invalid operator: %s", __LINE__, #OP);                                    \
     
    445445    if(dim1 == PS_DIMEN_SCALAR) {
    446446        if(dim2 == PS_DIMEN_SCALAR) {
    447             LEVEL2(SCALAR,SCALAR,out,psType1,op,psType2);               // scalar op scalar
     447            BINARY_OP(SCALAR,SCALAR,out,psType1,op,psType2);               // scalar op scalar
    448448        } else if(dim2==PS_DIMEN_VECTOR || dim2==PS_DIMEN_TRANSV) {
    449             LEVEL2(SCALAR,VECTOR,out,psType1,op,psType2);               // scalar op vector
     449            BINARY_OP(SCALAR,VECTOR,out,psType1,op,psType2);               // scalar op vector
    450450        } else if(dim2 == PS_DIMEN_IMAGE) {
    451             LEVEL2(SCALAR,IMAGE,out,psType1,op,psType2);                // scalar op image
     451            BINARY_OP(SCALAR,IMAGE,out,psType1,op,psType2);                // scalar op image
    452452        } else {
    453453            psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
     
    455455    } else if(dim1==PS_DIMEN_VECTOR || dim1==PS_DIMEN_TRANSV) {
    456456        if(dim2 == PS_DIMEN_SCALAR) {
    457             LEVEL2(VECTOR,SCALAR,out,psType1,op,psType2);               // vector op scalar
     457            BINARY_OP(VECTOR,SCALAR,out,psType1,op,psType2);               // vector op scalar
    458458        } else if(dim2==PS_DIMEN_VECTOR || dim2==PS_DIMEN_TRANSV) {
    459             LEVEL2(VECTOR,VECTOR,out,psType1,op,psType2);               // vector op vector
     459            BINARY_OP(VECTOR,VECTOR,out,psType1,op,psType2);               // vector op vector
    460460        } else if(dim2 == PS_DIMEN_IMAGE) {
    461             LEVEL2(VECTOR,IMAGE,out,psType1,op,psType2);                // vector op image
     461            BINARY_OP(VECTOR,IMAGE,out,psType1,op,psType2);                // vector op image
    462462        } else {
    463463            psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
     
    465465    } else if(dim1 == PS_DIMEN_IMAGE) {
    466466        if(dim2 == PS_DIMEN_SCALAR) {
    467             LEVEL2(IMAGE,SCALAR,out,psType1,op,psType2);                // image op scalar
     467            BINARY_OP(IMAGE,SCALAR,out,psType1,op,psType2);                // image op scalar
    468468        } else if(dim2==PS_DIMEN_VECTOR || dim2==PS_DIMEN_TRANSV) {
    469             LEVEL2(IMAGE,VECTOR,out,psType1,op,psType2);                // image op vector
     469            BINARY_OP(IMAGE,VECTOR,out,psType1,op,psType2);                // image op vector
    470470        } else if(dim2 == PS_DIMEN_IMAGE) {
    471             LEVEL2(IMAGE,IMAGE,out,psType1,op,psType2);                 // image op image
     471            BINARY_OP(IMAGE,IMAGE,out,psType1,op,psType2);                 // image op image
    472472        } else {
    473473            psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
     
    594594    }                                                                                                        \
    595595} else if(!strncmp(OP, "exp", 3)) {                                                                          \
    596     if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                  \
     596    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    597597        UNARY_TYPE(DIM,OUT,IN,exp(*i1));                                                                     \
    598598    } else {                                                                                                 \
     
    600600    }                                                                                                        \
    601601} else if(!strncmp(OP, "ln", 2)) {                                                                           \
    602     if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                  \
     602    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    603603        UNARY_TYPE(DIM,OUT,IN,log(*i1));                                                                     \
    604604    } else {                                                                                                 \
     
    606606    }                                                                                                        \
    607607} else if(!strncmp(OP, "ten", 3)) {                                                                          \
    608     if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                  \
     608    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    609609        UNARY_TYPE(DIM,OUT,IN,exp10(*i1));                                                                   \
    610610    } else {                                                                                                 \
     
    612612    }                                                                                                        \
    613613} else if(!strncmp(OP, "log", 3)) {                                                                          \
    614     if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                  \
     614    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    615615        UNARY_TYPE(DIM,OUT,IN,log10(*i1));                                                                   \
    616616    } else {                                                                                                 \
     
    618618    }                                                                                                        \
    619619} else if(!strncmp(OP, "sin", 3)) {                                                                          \
    620     if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                  \
     620    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    621621        UNARY_TYPE(DIM,OUT,IN,sin(*i1));                                                                     \
    622622    } else {                                                                                                 \
     
    624624    }                                                                                                        \
    625625} else if(!strncmp(OP, "dsin", 4)) {                                                                         \
    626     if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                  \
     626    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    627627        UNARY_TYPE(DIM,OUT,IN,sin(*i1*D2R));                                                                 \
    628628    } else {                                                                                                 \
     
    630630    }                                                                                                        \
    631631} else if(!strncmp(OP, "cos", 3)) {                                                                          \
    632     if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                  \
     632    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    633633        UNARY_TYPE(DIM,OUT,IN,cos(*i1));                                                                     \
    634634    } else {                                                                                                 \
     
    636636    }                                                                                                        \
    637637} else if(!strncmp(OP, "dcos", 4)) {                                                                         \
    638     if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                  \
     638    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    639639        UNARY_TYPE(DIM,OUT,IN,cos(*i1*D2R));                                                                 \
    640640    } else {                                                                                                 \
     
    642642    }                                                                                                        \
    643643} else if(!strncmp(OP, "tan", 3)) {                                                                          \
    644     if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                  \
     644    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    645645        UNARY_TYPE(DIM,OUT,IN,tan(*i1));                                                                     \
    646646    } else {                                                                                                 \
     
    648648    }                                                                                                        \
    649649} else if(!strncmp(OP, "dtan", 4)) {                                                                         \
    650     if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                  \
     650    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    651651        UNARY_TYPE(DIM,OUT,IN,tan(*i1*D2R));                                                                 \
    652652    } else {                                                                                                 \
     
    654654    }                                                                                                        \
    655655} else if(!strncmp(OP, "asin", 4)) {                                                                         \
    656     if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                  \
     656    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    657657        UNARY_TYPE(DIM,OUT,IN,asin(*i1));                                                                    \
    658658    } else {                                                                                                 \
     
    660660    }                                                                                                        \
    661661} else if(!strncmp(OP, "dasin", 5)) {                                                                        \
    662     if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                  \
     662    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    663663        UNARY_TYPE(DIM,OUT,IN,R2D*asin(*i1));                                                                \
    664664    } else {                                                                                                 \
     
    666666    }                                                                                                        \
    667667} else if(!strncmp(OP, "acos", 4)) {                                                                         \
    668     if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                  \
     668    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    669669        UNARY_TYPE(DIM,OUT,IN,acos(*i1));                                                                    \
    670670    } else {                                                                                                 \
     
    672672    }                                                                                                        \
    673673} else if(!strncmp(OP, "dacos", 5)) {                                                                        \
    674     if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                  \
     674    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    675675        UNARY_TYPE(DIM,OUT,IN,R2D*acos(*i1));                                                                \
    676676    } else {                                                                                                 \
     
    678678    }                                                                                                        \
    679679} else if(!strncmp(OP, "atan", 4)) {                                                                         \
    680     if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                  \
     680    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    681681        UNARY_TYPE(DIM,OUT,IN,atan(*i1));                                                                    \
    682682    } else {                                                                                                 \
     
    684684    }                                                                                                        \
    685685} else if(!strncmp(OP, "datan", 5)) {                                                                        \
    686     if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                  \
     686    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    687687        UNARY_TYPE(DIM,OUT,IN,R2D*atan(*i1));                                                                \
    688688    } else {                                                                                                 \
Note: See TracChangeset for help on using the changeset viewer.