Changeset 1440 for trunk/psLib/src/dataManip/psMatrixVectorArithmetic.c
- Timestamp:
- Aug 9, 2004, 1:34:58 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psMatrixVectorArithmetic.c
r1407 r1440 30 30 * @author Ross Harman, MHPCC 31 31 * 32 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $33 * @date $Date: 2004-08-0 7 00:06:06$32 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 33 * @date $Date: 2004-08-09 23:34:57 $ 34 34 * 35 35 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 114 114 ps##TYPE *i1 = NULL; \ 115 115 ps##TYPE *i2 = NULL; \ 116 o = &((psScalar* )OUT)->data.TYPE; \117 i1 = &((psScalar* )IN1)->data.TYPE; \118 i2 = &((psScalar* )IN2)->data.TYPE; \116 o = &((psScalar* )OUT)->data.TYPE; \ 117 i1 = &((psScalar* )IN1)->data.TYPE; \ 118 i2 = &((psScalar* )IN2)->data.TYPE; \ 119 119 *o = OP; \ 120 120 } … … 127 127 ps##TYPE *i1 = NULL; \ 128 128 ps##TYPE *i2 = NULL; \ 129 npt = ((psVector* )IN1)->n; \130 o = ((psVector* )OUT)->data.TYPE; \131 i1 = &((psScalar* )IN1)->data.TYPE; \132 i2 = ((psVector* )IN2)->data.TYPE; \129 npt = ((psVector* )IN1)->n; \ 130 o = ((psVector* )OUT)->data.TYPE; \ 131 i1 = &((psScalar* )IN1)->data.TYPE; \ 132 i2 = ((psVector* )IN2)->data.TYPE; \ 133 133 for (i=0; i < npt; i++, o++, i2++) { \ 134 134 *o = OP; \ … … 145 145 ps##TYPE *i1 = NULL; \ 146 146 ps##TYPE *i2 = NULL; \ 147 numRows = ((psImage* )IN1)->numRows; \148 numCols = ((psImage* )IN1)->numCols; \147 numRows = ((psImage* )IN1)->numRows; \ 148 numCols = ((psImage* )IN1)->numCols; \ 149 149 for(j = 0; j < numCols; j++) { \ 150 o = ((psImage* )OUT)->data.TYPE[j]; \151 i1 = &((psScalar* )IN1)->data.TYPE; \152 i2 = ((psImage* )IN2)->data.TYPE[j]; \150 o = ((psImage* )OUT)->data.TYPE[j]; \ 151 i1 = &((psScalar* )IN1)->data.TYPE; \ 152 i2 = ((psImage* )IN2)->data.TYPE[j]; \ 153 153 for(i = 0; i < numRows; i++, o++, i2++) { \ 154 154 *o = OP; \ … … 165 165 ps##TYPE *i1 = NULL; \ 166 166 ps##TYPE *i2 = NULL; \ 167 n1 = ((psVector* )IN1)->n; \168 o = ((psVector* )OUT)->data.TYPE; \169 i1 = ((psVector* )IN1)->data.TYPE; \170 i2 = &((psScalar* )IN2)->data.TYPE; \167 n1 = ((psVector* )IN1)->n; \ 168 o = ((psVector* )OUT)->data.TYPE; \ 169 i1 = ((psVector* )IN1)->data.TYPE; \ 170 i2 = &((psScalar* )IN2)->data.TYPE; \ 171 171 for (i=0; i < n1; i++, o++, i1++) { \ 172 172 *o = OP; \ … … 182 182 ps##TYPE *i1 = NULL; \ 183 183 ps##TYPE *i2 = NULL; \ 184 n1 = ((psVector* )IN1)->n; \185 n2 = ((psVector* )IN2)->n; \184 n1 = ((psVector* )IN1)->n; \ 185 n2 = ((psVector* )IN2)->n; \ 186 186 if(n1 != n2) { \ 187 187 psError(__func__, ": Inconsistent element count: %d vs %d", n1, n2); \ 188 188 return OUT; \ 189 189 } \ 190 o = ((psVector* )OUT)->data.TYPE; \191 i1 = ((psVector* )IN1)->data.TYPE; \192 i2 = ((psVector* )IN2)->data.TYPE; \190 o = ((psVector* )OUT)->data.TYPE; \ 191 i1 = ((psVector* )IN1)->data.TYPE; \ 192 i2 = ((psVector* )IN2)->data.TYPE; \ 193 193 for (i=0; i < n1; i++, o++, i1++, i2++) { \ 194 194 *o = OP; \ … … 207 207 ps##TYPE *i1 = NULL; \ 208 208 ps##TYPE *i2 = NULL; \ 209 n1 = ((psVector* )IN1)->n; \210 dim1 = ((psVector* )IN1)->type.dimen; \211 numRows2 = ((psImage* )IN2)->numRows; \212 numCols2 = ((psImage* )IN2)->numCols; \209 n1 = ((psVector* )IN1)->n; \ 210 dim1 = ((psVector* )IN1)->type.dimen; \ 211 numRows2 = ((psImage* )IN2)->numRows; \ 212 numCols2 = ((psImage* )IN2)->numCols; \ 213 213 \ 214 214 if(dim1 == PS_DIMEN_VECTOR) { /* Regular vectors */ \ … … 218 218 } \ 219 219 \ 220 i1 = ((psVector* )IN1)->data.TYPE; \220 i1 = ((psVector* )IN1)->data.TYPE; \ 221 221 for(j = 0; j < numRows2; j++, i1++) { \ 222 o = ((psImage* )OUT)->data.TYPE[j]; \223 i2 = ((psImage* )IN2)->data.TYPE[j]; \222 o = ((psImage* )OUT)->data.TYPE[j]; \ 223 i2 = ((psImage* )IN2)->data.TYPE[j]; \ 224 224 for(i = 0; i < numCols2; i++, o++, i2++) { \ 225 225 *o = OP; \ … … 233 233 \ 234 234 for(j = 0; j < numRows2; j++) { \ 235 o = ((psImage* )OUT)->data.TYPE[j]; \236 i1 = ((psVector* )IN1)->data.TYPE; \237 i2 = ((psImage* )IN2)->data.TYPE[j]; \235 o = ((psImage* )OUT)->data.TYPE[j]; \ 236 i1 = ((psVector* )IN1)->data.TYPE; \ 237 i2 = ((psImage* )IN2)->data.TYPE[j]; \ 238 238 for(i = 0; i < numCols2; i++, o++, i1++, i2++) { \ 239 239 *o = OP; \ … … 253 253 ps##TYPE *i1 = NULL; \ 254 254 ps##TYPE *i2 = NULL; \ 255 numRows = ((psImage* )IN1)->numRows; \256 numCols = ((psImage* )IN1)->numCols; \255 numRows = ((psImage* )IN1)->numRows; \ 256 numCols = ((psImage* )IN1)->numCols; \ 257 257 for(j = 0; j < numRows; j++) { \ 258 o = ((psImage* )OUT)->data.TYPE[j]; \259 i1 = ((psImage* )IN1)->data.TYPE[j]; \260 i2 = &((psScalar* )IN2)->data.TYPE; \258 o = ((psImage* )OUT)->data.TYPE[j]; \ 259 i1 = ((psImage* )IN1)->data.TYPE[j]; \ 260 i2 = &((psScalar* )IN2)->data.TYPE; \ 261 261 for(i = 0; i < numCols; i++, o++, i1++) { \ 262 262 *o = OP; \ … … 276 276 ps##TYPE *i1 = NULL; \ 277 277 ps##TYPE *i2 = NULL; \ 278 n2 = ((psVector* )IN2)->n; \279 dim2 = ((psVector* )IN2)->type.dimen; \280 numRows1 = ((psImage* )IN1)->numRows; \281 numCols1 = ((psImage* )IN1)->numCols; \278 n2 = ((psVector* )IN2)->n; \ 279 dim2 = ((psVector* )IN2)->type.dimen; \ 280 numRows1 = ((psImage* )IN1)->numRows; \ 281 numCols1 = ((psImage* )IN1)->numCols; \ 282 282 \ 283 283 if(dim2 == PS_DIMEN_VECTOR) { /* Regular vectors */ \ … … 287 287 } \ 288 288 \ 289 i2 = ((psVector* )IN2)->data.TYPE; \289 i2 = ((psVector* )IN2)->data.TYPE; \ 290 290 for(j = 0; j < numRows1; j++, i1++) { \ 291 o = ((psImage* )OUT)->data.TYPE[j]; \292 i1 = ((psImage* )IN1)->data.TYPE[j]; \291 o = ((psImage* )OUT)->data.TYPE[j]; \ 292 i1 = ((psImage* )IN1)->data.TYPE[j]; \ 293 293 for(i = 0; i < numCols1; i++, o++, i1++) { \ 294 294 *o = OP; \ … … 302 302 \ 303 303 for(j = 0; j < numRows1; j++) { \ 304 o = ((psImage* )OUT)->data.TYPE[j]; \305 i1 = ((psVector* )IN2)->data.TYPE; \306 i2 = ((psImage* )IN1)->data.TYPE[j]; \304 o = ((psImage* )OUT)->data.TYPE[j]; \ 305 i1 = ((psVector* )IN2)->data.TYPE; \ 306 i2 = ((psImage* )IN1)->data.TYPE[j]; \ 307 307 for(i = 0; i < numCols1; i++, o++, i2++, i1++) { \ 308 308 *o = OP; \ … … 323 323 ps##TYPE *i1 = NULL; \ 324 324 ps##TYPE *i2 = NULL; \ 325 numRows1 = ((psImage* )IN1)->numRows; \326 numCols1 = ((psImage* )IN1)->numCols; \327 numRows2 = ((psImage* )IN2)->numRows; \328 numCols2 = ((psImage* )IN2)->numCols; \325 numRows1 = ((psImage* )IN1)->numRows; \ 326 numCols1 = ((psImage* )IN1)->numCols; \ 327 numRows2 = ((psImage* )IN2)->numRows; \ 328 numCols2 = ((psImage* )IN2)->numCols; \ 329 329 if(numRows1!=numRows2 || numCols1!=numCols2) { \ 330 330 psError(__func__, ": Inconsistent element count: numRows: %d vs %d numCols: %d vs %d", numRows1, \ … … 333 333 } \ 334 334 for(j = 0; j < numRows1; j++) { \ 335 o = ((psImage* )OUT)->data.TYPE[j]; \336 i1 = ((psImage* )IN1)->data.TYPE[j]; \337 i2 = ((psImage* )IN2)->data.TYPE[j]; \335 o = ((psImage* )OUT)->data.TYPE[j]; \ 336 i1 = ((psImage* )IN1)->data.TYPE[j]; \ 337 i2 = ((psImage* )IN2)->data.TYPE[j]; \ 338 338 for(i = 0; i < numCols1; i++, o++, i1++, i2++) { \ 339 339 *o = OP; \ … … 409 409 psElemType elType2 = 0; 410 410 psElemType elTypeOut = 0; 411 psType *psType1 = NULL;412 psType *psType2 = NULL;413 psType *psTypeOut = NULL;414 415 psTypeOut = (psType *) out;411 psType* psType1 = NULL; 412 psType* psType2 = NULL; 413 psType* psTypeOut = NULL; 414 415 psTypeOut = (psType* ) out; 416 416 if (psTypeOut == NULL) { 417 417 psError(__func__, ": Line %d - Null out argument", __LINE__); … … 419 419 } 420 420 421 psType1 = (psType *) in1;421 psType1 = (psType* ) in1; 422 422 if (psType1 == NULL) { 423 423 psError(__func__, ": Line %d - Null in1 argument", __LINE__); … … 425 425 } 426 426 427 psType2 = (psType *) in2;427 psType2 = (psType* ) in2; 428 428 if (psType2 == NULL) { 429 429 psError(__func__, ": Line %d - Null in2 argument", __LINE__); … … 456 456 457 457 if (dim1 == PS_DIMEN_VECTOR) { 458 if (((psVector *) in1)->n == 0) {458 if (((psVector* ) in1)->n == 0) { 459 459 psError(__func__, ": Line %d - Vector contains zero elements"); 460 460 } 461 461 } else if (dim1 == PS_DIMEN_IMAGE) { 462 if (((psImage *) in1)->numCols == 0 || ((psImage *) in1)->numRows == 0) {462 if (((psImage* ) in1)->numCols == 0 || ((psImage* ) in1)->numRows == 0) { 463 463 psError(__func__, ": Line %d - Image contains zero length row or cols"); 464 464 } … … 466 466 467 467 if (dim2 == PS_DIMEN_VECTOR) { 468 if (((psVector *) in2)->n == 0) {468 if (((psVector* ) in2)->n == 0) { 469 469 psError(__func__, ": Line %d - Vector contains zero elements"); 470 470 } 471 471 } else if (dim2 == PS_DIMEN_IMAGE) { 472 if (((psImage *) in2)->numCols == 0 || ((psImage *) in2)->numRows == 0) {472 if (((psImage* ) in2)->numCols == 0 || ((psImage* ) in2)->numRows == 0) { 473 473 psError(__func__, ": Line %d - Image contains zero length row or cols"); 474 474 } … … 517 517 ps##TYPE *o = NULL; \ 518 518 ps##TYPE *i1 = NULL; \ 519 o = &((psScalar* )OUT)->data.TYPE; \520 i1 = &((psScalar* )IN)->data.TYPE; \519 o = &((psScalar* )OUT)->data.TYPE; \ 520 i1 = &((psScalar* )IN)->data.TYPE; \ 521 521 *o = OP; \ 522 522 } … … 530 530 ps##TYPE *o = NULL; \ 531 531 ps##TYPE *i1 = NULL; \ 532 nIn = ((psVector* )IN)->n; \533 nOut = ((psVector* )OUT)->n; \532 nIn = ((psVector* )IN)->n; \ 533 nOut = ((psVector* )OUT)->n; \ 534 534 if(nIn != nOut) { \ 535 535 psError(__func__, ": Inconsistent element count: %d vs %d", nIn, nOut); \ 536 536 return OUT; \ 537 537 } \ 538 o = ((psVector* )OUT)->data.TYPE; \539 i1 = ((psVector* )IN)->data.TYPE; \538 o = ((psVector* )OUT)->data.TYPE; \ 539 i1 = ((psVector* )IN)->data.TYPE; \ 540 540 for(i = 0; i < nIn; i++, o++, i1++) { \ 541 541 *o = OP; \ … … 554 554 ps##TYPE *o = NULL; \ 555 555 ps##TYPE *i1 = NULL; \ 556 numRowsIn = ((psImage* )IN)->numRows; \557 numColsIn = ((psImage* )IN)->numCols; \558 numRowsOut = ((psImage* )OUT)->numRows; \559 numColsOut = ((psImage* )OUT)->numCols; \556 numRowsIn = ((psImage* )IN)->numRows; \ 557 numColsIn = ((psImage* )IN)->numCols; \ 558 numRowsOut = ((psImage* )OUT)->numRows; \ 559 numColsOut = ((psImage* )OUT)->numCols; \ 560 560 if(numRowsIn!=numRowsOut || numColsIn!=numColsOut) { \ 561 561 psError(__func__, ": Inconsistent element count: numRows: %d vs %d numCols: %d vs %d", numRowsIn, \ … … 564 564 } \ 565 565 for(j = 0; j < numRowsIn; j++) { \ 566 o = ((psImage* )OUT)->data.TYPE[j]; \567 i1 = ((psImage* )IN)->data.TYPE[j]; \566 o = ((psImage* )OUT)->data.TYPE[j]; \ 567 i1 = ((psImage* )IN)->data.TYPE[j]; \ 568 568 for(i = 0; i < numColsIn; i++, o++, i1++) { \ 569 569 *o = OP; \ … … 713 713 psElemType elTypeIn = 0; 714 714 psElemType elTypeOut = 0; 715 psType *psTypeIn = NULL;716 psType *psTypeOut = NULL;717 718 psTypeOut = (psType *) out;715 psType* psTypeIn = NULL; 716 psType* psTypeOut = NULL; 717 718 psTypeOut = (psType* ) out; 719 719 if (psTypeOut == NULL) { 720 720 psError(__func__, ": Line %d - Null out argument", __LINE__); … … 722 722 } 723 723 724 psTypeIn = (psType *) in;724 psTypeIn = (psType* ) in; 725 725 if (psTypeIn == NULL) { 726 726 psError(__func__, ": Line %d - Null in argument", __LINE__); … … 757 757 758 758 if (dimIn == PS_DIMEN_VECTOR) { 759 if (((psVector *) in)->n == 0) {759 if (((psVector* ) in)->n == 0) { 760 760 psError(__func__, ": Line %d - Vector contains zero elements"); 761 761 } 762 762 } else if (dimIn == PS_DIMEN_IMAGE) { 763 if (((psImage *) in)->numCols == 0 || ((psImage *) in)->numRows == 0) {763 if (((psImage* ) in)->numCols == 0 || ((psImage* ) in)->numRows == 0) { 764 764 psError(__func__, ": Line %d - Image contains zero length row or cols"); 765 765 } … … 767 767 768 768 if (dimOut == PS_DIMEN_VECTOR) { 769 if (((psVector *) out)->n == 0) {769 if (((psVector* ) out)->n == 0) { 770 770 psError(__func__, ": Line %d - Vector contains zero elements"); 771 771 } 772 772 } else if (dimOut == PS_DIMEN_IMAGE) { 773 if (((psImage *) out)->numCols == 0 || ((psImage *) out)->numRows == 0) {773 if (((psImage* ) out)->numCols == 0 || ((psImage* ) out)->numRows == 0) { 774 774 psError(__func__, ": Line %d - Image contains zero length row or cols"); 775 775 }
Note:
See TracChangeset
for help on using the changeset viewer.
