Changeset 7192 for trunk/psLib/src/math/psBinaryOp.c
- Timestamp:
- May 23, 2006, 5:10:14 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psBinaryOp.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psBinaryOp.c
r7189 r7192 30 30 * @author Robert DeSonia, MHPCC 31 31 * 32 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $33 * @date $Date: 2006-05-2 3 23:43:18$32 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 33 * @date $Date: 2006-05-24 03:10:14 $ 34 34 * 35 35 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 56 56 *****************************************************************************/ 57 57 58 // Conversion for degrees to radians59 #define D2R 0.01745329252111111 /* PI/180 */60 61 // Conversion for radians to degrees62 #define R2D 57.29577950924861 /* 180.0/PI */63 64 58 // Binary SCALAR_XXXX operations 65 #define SCALAR_SCALAR(OUT,IN1,OP,IN2,TYPE) \ 66 { \ 67 ps##TYPE *o = NULL; \ 68 ps##TYPE *i1 = NULL; \ 69 ps##TYPE *i2 = NULL; \ 70 o = &((psScalar* )OUT)->data.TYPE; \ 71 i1 = &((psScalar* )IN1)->data.TYPE; \ 72 i2 = &((psScalar* )IN2)->data.TYPE; \ 73 *o = OP; \ 74 } 75 76 #define SCALAR_VECTOR(OUT,IN1,OP,IN2,TYPE) \ 77 { \ 78 psS32 i = 0; \ 79 psS32 npt = 0; \ 80 ps##TYPE *o = NULL; \ 81 ps##TYPE *i1 = NULL; \ 82 ps##TYPE *i2 = NULL; \ 83 npt = ((psVector* )IN2)->n; \ 84 o = ((psVector* )OUT)->data.TYPE; \ 85 i1 = &((psScalar* )IN1)->data.TYPE; \ 86 i2 = ((psVector* )IN2)->data.TYPE; \ 87 for (i=0; i < npt; i++, o++, i2++) { \ 88 *o = OP; \ 89 } \ 90 } 91 92 #define SCALAR_IMAGE(OUT,IN1,OP,IN2,TYPE) \ 93 { \ 94 psS32 i = 0; \ 95 psS32 j = 0; \ 96 psS32 numRows = 0; \ 97 psS32 numCols = 0; \ 98 ps##TYPE *o = NULL; \ 99 ps##TYPE *i1 = NULL; \ 100 ps##TYPE *i2 = NULL; \ 101 numRows = ((psImage* )IN2)->numRows; \ 102 numCols = ((psImage* )IN2)->numCols; \ 103 for(j = 0; j < numCols; j++) { \ 104 o = ((psImage* )OUT)->data.TYPE[j]; \ 105 i1 = &((psScalar* )IN1)->data.TYPE; \ 106 i2 = ((psImage* )IN2)->data.TYPE[j]; \ 107 for(i = 0; i < numRows; i++, o++, i2++) { \ 108 *o = OP; \ 109 } \ 110 } \ 59 #define SCALAR_SCALAR(OUT,IN1,OP,IN2,TYPE) \ 60 { \ 61 ps##TYPE *o = &((psScalar*)OUT)->data.TYPE; \ 62 ps##TYPE *i1 = &((psScalar*)IN1)->data.TYPE; \ 63 ps##TYPE *i2 = &((psScalar*)IN2)->data.TYPE; \ 64 *o = OP; \ 65 } 66 67 #define SCALAR_VECTOR(OUT,IN1,OP,IN2,TYPE) \ 68 { \ 69 long npt = ((psVector*)IN2)->n; \ 70 ps##TYPE *o = ((psVector*)OUT)->data.TYPE; \ 71 ps##TYPE *i1 = &((psScalar*)IN1)->data.TYPE; \ 72 ps##TYPE *i2 = ((psVector*)IN2)->data.TYPE; \ 73 for (long i = 0; i < npt; i++, o++, i2++) { \ 74 *o = OP; \ 75 } \ 76 } 77 78 #define SCALAR_IMAGE(OUT,IN1,OP,IN2,TYPE) \ 79 { \ 80 long numRows = ((psImage*)IN2)->numRows; \ 81 long numCols = ((psImage*)IN2)->numCols; \ 82 for (long j = 0; j < numCols; j++) { \ 83 ps##TYPE *o = ((psImage*)OUT)->data.TYPE[j]; \ 84 ps##TYPE *i1 = &((psScalar*)IN1)->data.TYPE; \ 85 ps##TYPE *i2 = ((psImage*)IN2)->data.TYPE[j]; \ 86 for (long i = 0; i < numRows; i++, o++, i2++) { \ 87 *o = OP; \ 88 } \ 89 } \ 111 90 } 112 91 113 92 // Binary VECTOR_XXXX operations 114 #define VECTOR_SCALAR(OUT,IN1,OP,IN2,TYPE) \ 115 { \ 116 psS32 i = 0; \ 117 psS32 n1 = 0; \ 118 ps##TYPE *o = NULL; \ 119 ps##TYPE *i1 = NULL; \ 120 ps##TYPE *i2 = NULL; \ 121 n1 = ((psVector* )IN1)->n; \ 122 o = ((psVector* )OUT)->data.TYPE; \ 123 i1 = ((psVector* )IN1)->data.TYPE; \ 124 i2 = &((psScalar* )IN2)->data.TYPE; \ 125 for (i=0; i < n1; i++, o++, i1++) { \ 126 *o = OP; \ 127 } \ 128 } 129 130 #define VECTOR_VECTOR(OUT,IN1,OP,IN2,TYPE) \ 131 { \ 132 psS32 i = 0; \ 133 psS32 n1 = 0; \ 134 psS32 n2 = 0; \ 135 ps##TYPE *o = NULL; \ 136 ps##TYPE *i1 = NULL; \ 137 ps##TYPE *i2 = NULL; \ 138 n1 = ((psVector* )IN1)->n; \ 139 n2 = ((psVector* )IN2)->n; \ 140 if(n1 != n2) { \ 141 psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ 142 PS_ERRORTEXT_psMatrix_COUNT_DIFFERS, \ 143 n1, n2); \ 144 if (OUT != IN1 && OUT != IN2) { \ 145 psFree(OUT); \ 146 } \ 147 return NULL; \ 148 } \ 149 o = ((psVector* )OUT)->data.TYPE; \ 150 i1 = ((psVector* )IN1)->data.TYPE; \ 151 i2 = ((psVector* )IN2)->data.TYPE; \ 152 for (i=0; i < n1; i++, o++, i1++, i2++) { \ 153 *o = OP; \ 154 } \ 155 } 156 157 #define VECTOR_IMAGE(OUT,IN1,OP,IN2,TYPE) \ 158 { \ 159 psS32 i = 0; \ 160 psS32 j = 0; \ 161 psS32 n1 = 0; \ 162 psS32 numRows2 = 0; \ 163 psS32 numCols2 = 0; \ 164 psDimen dim1 = 0; \ 165 ps##TYPE *o = NULL; \ 166 ps##TYPE *i1 = NULL; \ 167 ps##TYPE *i2 = NULL; \ 168 n1 = ((psVector* )IN1)->n; \ 169 dim1 = ((psVector* )IN1)->type.dimen; \ 170 numRows2 = ((psImage* )IN2)->numRows; \ 171 numCols2 = ((psImage* )IN2)->numCols; \ 93 #define VECTOR_SCALAR(OUT,IN1,OP,IN2,TYPE) \ 94 { \ 95 long n1 = ((psVector*)IN1)->n; \ 96 ps##TYPE *o = ((psVector*)OUT)->data.TYPE; \ 97 ps##TYPE *i1 = ((psVector*)IN1)->data.TYPE; \ 98 ps##TYPE *i2 = &((psScalar*)IN2)->data.TYPE; \ 99 for (long i = 0; i < n1; i++, o++, i1++) { \ 100 *o = OP; \ 101 } \ 102 } 103 104 #define VECTOR_VECTOR(OUT,IN1,OP,IN2,TYPE) \ 105 { \ 106 long n1 = ((psVector*)IN1)->n; \ 107 long n2 = ((psVector*)IN2)->n; \ 108 if (n1 != n2) { \ 109 psError(PS_ERR_BAD_PARAMETER_SIZE, true, PS_ERRORTEXT_psMatrix_COUNT_DIFFERS, n1, n2); \ 110 if (OUT != IN1 && OUT != IN2) { \ 111 psFree(OUT); \ 112 } \ 113 return NULL; \ 114 } \ 115 ps##TYPE *o = ((psVector*)OUT)->data.TYPE; \ 116 ps##TYPE *i1 = ((psVector*)IN1)->data.TYPE; \ 117 ps##TYPE *i2 = ((psVector*)IN2)->data.TYPE; \ 118 for (long i = 0; i < n1; i++, o++, i1++, i2++) { \ 119 *o = OP; \ 120 } \ 121 } 122 123 #define VECTOR_IMAGE(OUT,IN1,OP,IN2,TYPE) \ 124 { \ 125 long n1 = ((psVector*)IN1)->n; \ 126 long numRows2 = ((psImage*)IN2)->numRows; \ 127 long numCols2 = ((psImage*)IN2)->numCols; \ 172 128 \ 173 if(dim1 == PS_DIMEN_VECTOR) { /* Regular vectors */ \ 174 if(n1!=numRows2) { \ 175 psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ 176 PS_ERRORTEXT_psMatrix_COUNT_DIFFERS, \ 177 n1, numRows2); \ 178 if (OUT != IN1 && OUT != IN2) { \ 179 psFree(OUT); \ 180 } \ 181 return NULL; \ 182 } \ 129 if (((psVector*)IN1)->type.dimen == PS_DIMEN_VECTOR) { /* Regular vectors */ \ 130 if (n1 != numRows2) { \ 131 psError(PS_ERR_BAD_PARAMETER_SIZE, true, PS_ERRORTEXT_psMatrix_COUNT_DIFFERS, n1, numRows2); \ 132 if (OUT != IN1 && OUT != IN2) { \ 133 psFree(OUT); \ 134 } \ 135 return NULL; \ 136 } \ 183 137 \ 184 i1 = ((psVector* )IN1)->data.TYPE; \ 185 for(j = 0; j < numRows2; j++, i1++) { \ 186 o = ((psImage* )OUT)->data.TYPE[j]; \ 187 i2 = ((psImage* )IN2)->data.TYPE[j]; \ 188 for(i = 0; i < numCols2; i++, o++, i2++) { \ 189 *o = OP; \ 190 } \ 191 } \ 192 } else { /* Transposed vectors */ \ 193 if(n1!=numCols2) { \ 194 psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ 195 PS_ERRORTEXT_psMatrix_COUNT_DIFFERS, \ 196 n1, numCols2); \ 197 if (OUT != IN1 && OUT != IN2) { \ 198 psFree(OUT); \ 199 } \ 200 return NULL; \ 201 } \ 138 ps##TYPE *i1 = ((psVector*)IN1)->data.TYPE; \ 139 for (long j = 0; j < numRows2; j++, i1++) { \ 140 ps##TYPE *o = ((psImage*)OUT)->data.TYPE[j]; \ 141 ps##TYPE *i2 = ((psImage*)IN2)->data.TYPE[j]; \ 142 for (long i = 0; i < numCols2; i++, o++, i2++) { \ 143 *o = OP; \ 144 } \ 145 } \ 146 } else { /* Transposed vectors */ \ 147 if (n1 != numCols2) { \ 148 psError(PS_ERR_BAD_PARAMETER_SIZE, true, PS_ERRORTEXT_psMatrix_COUNT_DIFFERS, n1, numCols2); \ 149 if (OUT != IN1 && OUT != IN2) { \ 150 psFree(OUT); \ 151 } \ 152 return NULL; \ 153 } \ 202 154 \ 203 for (j = 0; j < numRows2; j++) {\204 o = ((psImage* )OUT)->data.TYPE[j];\205 i1 = ((psVector* )IN1)->data.TYPE;\206 i2 = ((psImage* )IN2)->data.TYPE[j];\207 for (i = 0; i < numCols2; i++, o++, i1++, i2++) {\208 *o = OP; \209 } \210 } \211 } \155 for (long j = 0; j < numRows2; j++) { \ 156 ps##TYPE *o = ((psImage*)OUT)->data.TYPE[j]; \ 157 ps##TYPE *i1 = ((psVector*)IN1)->data.TYPE; \ 158 ps##TYPE *i2 = ((psImage*)IN2)->data.TYPE[j]; \ 159 for (long i = 0; i < numCols2; i++, o++, i1++, i2++) { \ 160 *o = OP; \ 161 } \ 162 } \ 163 } \ 212 164 } 213 165 214 166 // Binary IMAGE_XXXX operations 215 #define IMAGE_SCALAR(OUT,IN1,OP,IN2,TYPE) \ 216 { \ 217 psS32 i = 0; \ 218 psS32 j = 0; \ 219 psS32 numRows = 0; \ 220 psS32 numCols = 0; \ 221 ps##TYPE *o = NULL; \ 222 ps##TYPE *i1 = NULL; \ 223 ps##TYPE *i2 = NULL; \ 224 numRows = ((psImage* )IN1)->numRows; \ 225 numCols = ((psImage* )IN1)->numCols; \ 226 for(j = 0; j < numRows; j++) { \ 227 o = ((psImage* )OUT)->data.TYPE[j]; \ 228 i1 = ((psImage* )IN1)->data.TYPE[j]; \ 229 i2 = &((psScalar* )IN2)->data.TYPE; \ 230 for(i = 0; i < numCols; i++, o++, i1++) { \ 231 *o = OP; \ 232 } \ 233 } \ 234 } 235 236 #define IMAGE_VECTOR(OUT,IN1,OP,IN2,TYPE) \ 237 { \ 238 psS32 i = 0; \ 239 psS32 j = 0; \ 240 psS32 n2 = 0; \ 241 psS32 numRows1 = 0; \ 242 psS32 numCols1 = 0; \ 243 psDimen dim2 = 0; \ 244 ps##TYPE *o = NULL; \ 245 ps##TYPE *i1 = NULL; \ 246 ps##TYPE *i2 = NULL; \ 247 n2 = ((psVector* )IN2)->n; \ 248 dim2 = ((psVector* )IN2)->type.dimen; \ 249 numRows1 = ((psImage* )IN1)->numRows; \ 250 numCols1 = ((psImage* )IN1)->numCols; \ 167 #define IMAGE_SCALAR(OUT,IN1,OP,IN2,TYPE) \ 168 { \ 169 long numRows = ((psImage*)IN1)->numRows; \ 170 long numCols = ((psImage*)IN1)->numCols; \ 171 for (long j = 0; j < numRows; j++) { \ 172 ps##TYPE *o = ((psImage*)OUT)->data.TYPE[j]; \ 173 ps##TYPE *i1 = ((psImage*)IN1)->data.TYPE[j]; \ 174 ps##TYPE *i2 = &((psScalar*)IN2)->data.TYPE; \ 175 for (long i = 0; i < numCols; i++, o++, i1++) { \ 176 *o = OP; \ 177 } \ 178 } \ 179 } 180 181 #define IMAGE_VECTOR(OUT,IN1,OP,IN2,TYPE) \ 182 { \ 183 long n2 = ((psVector*)IN2)->n; \ 184 long numRows1 = ((psImage*)IN1)->numRows; \ 185 long numCols1 = ((psImage*)IN1)->numCols; \ 251 186 \ 252 if(dim2 == PS_DIMEN_VECTOR) { /* Regular vectors */ \ 253 if(n2!=numRows1) { \ 254 psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ 255 PS_ERRORTEXT_psMatrix_COUNT_DIFFERS, \ 256 n2, numRows1); \ 257 if (OUT != IN1 && OUT != IN2) { \ 258 psFree(OUT); \ 259 } \ 260 return NULL; \ 261 } \ 187 if (((psVector*)IN2)->type.dimen == PS_DIMEN_VECTOR) { /* Regular vectors */ \ 188 if (n2 != numRows1) { \ 189 psError(PS_ERR_BAD_PARAMETER_SIZE, true, PS_ERRORTEXT_psMatrix_COUNT_DIFFERS, n2, numRows1); \ 190 if (OUT != IN1 && OUT != IN2) { \ 191 psFree(OUT); \ 192 } \ 193 return NULL; \ 194 } \ 262 195 \ 263 i2 = ((psVector* )IN2)->data.TYPE; \ 264 for(j = 0; j < numRows1; j++, i1++) { \ 265 o = ((psImage* )OUT)->data.TYPE[j]; \ 266 i1 = ((psImage* )IN1)->data.TYPE[j]; \ 267 for(i = 0; i < numCols1; i++, o++, i1++) { \ 268 *o = OP; \ 269 } \ 270 } \ 271 } else { /* Transposed vectors */ \ 272 if(n2!=numCols1) { \ 273 psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ 274 PS_ERRORTEXT_psMatrix_COUNT_DIFFERS, \ 275 n2, numCols1); \ 276 if (OUT != IN1) { \ 277 psFree(OUT); \ 278 } \ 279 return NULL; \ 280 } \ 196 ps##TYPE *i2 = ((psVector* )IN2)->data.TYPE; \ 197 for (long j = 0; j < numRows1; j++, i2++) { \ 198 ps##TYPE *o = ((psImage*)OUT)->data.TYPE[j]; \ 199 ps##TYPE *i1 = ((psImage*)IN1)->data.TYPE[j]; \ 200 for (long i = 0; i < numCols1; i++, o++, i1++) { \ 201 *o = OP; \ 202 } \ 203 } \ 204 } else { /* Transposed vectors */ \ 205 if (n2 != numCols1) { \ 206 psError(PS_ERR_BAD_PARAMETER_SIZE, true, PS_ERRORTEXT_psMatrix_COUNT_DIFFERS, n2, numCols1); \ 207 if (OUT != IN1) { \ 208 psFree(OUT); \ 209 } \ 210 return NULL; \ 211 } \ 281 212 \ 282 for(j = 0; j < numRows1; j++) { \ 283 o = ((psImage* )OUT)->data.TYPE[j]; \ 284 i1 = ((psVector* )IN2)->data.TYPE; \ 285 i2 = ((psImage* )IN1)->data.TYPE[j]; \ 286 for(i = 0; i < numCols1; i++, o++, i2++, i1++) { \ 287 *o = OP; \ 288 } \ 289 } \ 290 } \ 291 } 292 293 #define IMAGE_IMAGE(OUT,IN1,OP,IN2,TYPE) \ 294 { \ 295 psS32 i = 0; \ 296 psS32 j = 0; \ 297 psS32 numRows1 = 0; \ 298 psS32 numCols1 = 0; \ 299 psS32 numRows2 = 0; \ 300 psS32 numCols2 = 0; \ 301 ps##TYPE *o = NULL; \ 302 ps##TYPE *i1 = NULL; \ 303 ps##TYPE *i2 = NULL; \ 304 numRows1 = ((psImage* )IN1)->numRows; \ 305 numCols1 = ((psImage* )IN1)->numCols; \ 306 numRows2 = ((psImage* )IN2)->numRows; \ 307 numCols2 = ((psImage* )IN2)->numCols; \ 308 if(numRows1!=numRows2 || numCols1!=numCols2) { \ 309 psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ 310 PS_ERRORTEXT_psMatrix_IMAGE_SIZE_DIFFERS, \ 311 numCols1, numRows1, numCols2, numRows2); \ 312 if (OUT != IN1 && OUT != IN2) { \ 313 psFree(OUT); \ 314 } \ 315 return NULL; \ 316 } \ 317 for(j = 0; j < numRows1; j++) { \ 318 o = ((psImage* )OUT)->data.TYPE[j]; \ 319 i1 = ((psImage* )IN1)->data.TYPE[j]; \ 320 i2 = ((psImage* )IN2)->data.TYPE[j]; \ 321 for(i = 0; i < numCols1; i++, o++, i1++, i2++) { \ 322 *o = OP; \ 323 } \ 324 } \ 325 } 326 327 328 // Preprocessor macro function to create arithmetic function based on input type for integers only 213 for (long j = 0; j < numRows1; j++) { \ 214 ps##TYPE *o = ((psImage*)OUT)->data.TYPE[j]; \ 215 ps##TYPE *i1 = ((psVector*)IN2)->data.TYPE; \ 216 ps##TYPE *i2 = ((psImage*)IN1)->data.TYPE[j]; \ 217 for (long i = 0; i < numCols1; i++, o++, i2++, i1++) { \ 218 *o = OP; \ 219 } \ 220 } \ 221 } \ 222 } 223 224 #define IMAGE_IMAGE(OUT,IN1,OP,IN2,TYPE) \ 225 { \ 226 long numRows1 = ((psImage*)IN1)->numRows; \ 227 long numCols1 = ((psImage*)IN1)->numCols; \ 228 long numRows2 = ((psImage*)IN2)->numRows; \ 229 long numCols2 = ((psImage*)IN2)->numCols; \ 230 if (numRows1 != numRows2 || numCols1 != numCols2) { \ 231 psError(PS_ERR_BAD_PARAMETER_SIZE, true, PS_ERRORTEXT_psMatrix_IMAGE_SIZE_DIFFERS, \ 232 numCols1, numRows1, numCols2, numRows2); \ 233 if (OUT != IN1 && OUT != IN2) { \ 234 psFree(OUT); \ 235 } \ 236 return NULL; \ 237 } \ 238 for (long j = 0; j < numRows1; j++) { \ 239 ps##TYPE *o = ((psImage*)OUT)->data.TYPE[j]; \ 240 ps##TYPE *i1 = ((psImage*)IN1)->data.TYPE[j]; \ 241 ps##TYPE *i2 = ((psImage*)IN2)->data.TYPE[j]; \ 242 for (long i = 0; i < numCols1; i++, o++, i1++, i2++) { \ 243 *o = OP; \ 244 } \ 245 } \ 246 } 247 248 249 // Preprocessor macro function to create arithmetic function based on input type --- for integers only 329 250 #define BINARY_TYPE_INTEGER(DIM1,DIM2,OUT,IN1,OP,IN2) \ 330 251 switch (IN1->type) { \ … … 418 339 // Preprocessor macro function to create arithmetic function operation name 419 340 #define BINARY_OP(DIM1,DIM2,OUT,IN1,OP,IN2) \ 420 if(!strncmp(OP, "=", 1)) { \ 421 BINARY_TYPE(DIM1,DIM2,OUT,IN1,*i2,IN2); \ 422 } else if(!strncmp(OP, "+", 1)) { \ 341 if (!strncmp(OP, "+", 1)) { \ 423 342 BINARY_TYPE(DIM1,DIM2,OUT,IN1,*i1 + *i2,IN2); \ 424 } else if (!strncmp(OP, "-", 1)) {\343 } else if (!strncmp(OP, "-", 1)) { \ 425 344 BINARY_TYPE(DIM1,DIM2,OUT,IN1,*i1 - *i2,IN2); \ 426 } else if (!strncmp(OP, "*", 1)) {\345 } else if (!strncmp(OP, "*", 1)) { \ 427 346 BINARY_TYPE(DIM1,DIM2,OUT,IN1,*i1 * *i2,IN2); \ 428 } else if (!strncmp(OP, "/", 1)) {\347 } else if (!strncmp(OP, "/", 1)) { \ 429 348 BINARY_TYPE(DIM1,DIM2,OUT,IN1,*i1 / *i2,IN2); \ 430 } else if (!strncmp(OP, "&", 1)) {\349 } else if (!strncmp(OP, "&", 1)) { \ 431 350 if (PS_IS_PSELEMTYPE_INT(IN1->type) && PS_IS_PSELEMTYPE_INT(IN2->type)) { \ 432 351 BINARY_TYPE_INTEGER(DIM1,DIM2,OUT,IN1,(*i1) & (*i2),IN2); \ … … 436 355 return NULL; \ 437 356 } \ 438 } else if (!strncmp(OP, "|", 1)) {\357 } else if (!strncmp(OP, "|", 1)) { \ 439 358 if (PS_IS_PSELEMTYPE_INT(IN1->type) && PS_IS_PSELEMTYPE_INT(IN2->type)) { \ 440 359 BINARY_TYPE_INTEGER(DIM1,DIM2,OUT,IN1,(*i1) | (*i2),IN2); \ … … 444 363 return NULL; \ 445 364 } \ 446 } else if (!strncmp(OP, "^", 1)) {\447 if (PS_IS_PSELEMTYPE_COMPLEX(IN1->type)) {\365 } else if (!strncmp(OP, "^", 1)) { \ 366 if (PS_IS_PSELEMTYPE_COMPLEX(IN1->type)) { \ 448 367 BINARY_TYPE(DIM1,DIM2,OUT,IN1,cpow(*i1,*i2),IN2); \ 449 368 } else { \ 450 369 BINARY_TYPE(DIM1,DIM2,OUT,IN1,pow(*i1,*i2),IN2); \ 451 370 } \ 452 } else if (!strncmp(OP, "min", 3)) {\453 if (PS_IS_PSELEMTYPE_COMPLEX(IN1->type)) {\371 } else if (!strncmp(OP, "min", 3)) { \ 372 if (PS_IS_PSELEMTYPE_COMPLEX(IN1->type)) { \ 454 373 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 455 374 PS_ERRORTEXT_psMatrix_MIN_COMPLEX_SUPPORT); \ … … 461 380 BINARY_TYPE(DIM1,DIM2,OUT,IN1,fmin(*i1,*i2),IN2); \ 462 381 } \ 463 } else if (!strncmp(OP, "max", 3)) {\464 if (PS_IS_PSELEMTYPE_COMPLEX(IN1->type)) {\382 } else if (!strncmp(OP, "max", 3)) { \ 383 if (PS_IS_PSELEMTYPE_COMPLEX(IN1->type)) { \ 465 384 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 466 385 PS_ERRORTEXT_psMatrix_MAX_COMPLEX_SUPPORT); \ … … 630 549 // Automtically free psScalar types, since they are usually allocated in the argument list when this 631 550 // function is called, provided that the input is not the output. 632 if (psType1->dimen==PS_DIMEN_SCALAR && in1!=out) {551 if (psType1->dimen==PS_DIMEN_SCALAR && in1!=out) { 633 552 psFree(in1); 634 553 } 635 554 636 if (psType2->dimen==PS_DIMEN_SCALAR && in2!=out) {555 if (psType2->dimen==PS_DIMEN_SCALAR && in2!=out) { 637 556 psFree(in2); 638 557 }
Note:
See TracChangeset
for help on using the changeset viewer.
