Changeset 1647
- Timestamp:
- Aug 27, 2004, 1:29:36 PM (22 years ago)
- Location:
- trunk/psLib
- Files:
-
- 2 edited
-
src/dataManip/psMatrixVectorArithmetic.c (modified) (7 diffs)
-
test/dataManip/tst_psMatrixVectorArithmetic01.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psMatrixVectorArithmetic.c
r1541 r1647 30 30 * @author Ross Harman, MHPCC 31 31 * 32 * @version $Revision: 1.2 5$ $Name: not supported by cvs2svn $33 * @date $Date: 2004-08- 14 01:31:43$32 * @version $Revision: 1.26 $ $Name: not supported by cvs2svn $ 33 * @date $Date: 2004-08-27 23:29:36 $ 34 34 * 35 35 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 509 509 } 510 510 511 // Automtically free psScalar types, since they are usually allocated in the argument list when this 512 // function is called, provided that the input is not the output. 513 if(psType1->dimen==PS_DIMEN_SCALAR && in1!=out) { 514 psFree(in1); 515 } 516 517 if(psType2->dimen==PS_DIMEN_SCALAR && in2!=out) { 518 psFree(in2); 519 } 520 511 521 return out; 512 522 } … … 517 527 ps##TYPE *o = NULL; \ 518 528 ps##TYPE *i1 = NULL; \ 519 o = &((psScalar* )OUT)->data.TYPE; \520 i1 = &((psScalar* )IN)->data.TYPE; \529 o = &((psScalar* )OUT)->data.TYPE; \ 530 i1 = &((psScalar* )IN)->data.TYPE; \ 521 531 *o = OP; \ 522 532 } … … 530 540 ps##TYPE *o = NULL; \ 531 541 ps##TYPE *i1 = NULL; \ 532 nIn = ((psVector* )IN)->n; \533 nOut = ((psVector* )OUT)->n; \542 nIn = ((psVector* )IN)->n; \ 543 nOut = ((psVector* )OUT)->n; \ 534 544 if(nIn != nOut) { \ 535 545 psError(__func__, ": Inconsistent element count: %d vs %d", nIn, nOut); \ 536 546 return OUT; \ 537 547 } \ 538 o = ((psVector* )OUT)->data.TYPE; \539 i1 = ((psVector* )IN)->data.TYPE; \548 o = ((psVector* )OUT)->data.TYPE; \ 549 i1 = ((psVector* )IN)->data.TYPE; \ 540 550 for(i = 0; i < nIn; i++, o++, i1++) { \ 541 551 *o = OP; \ … … 554 564 ps##TYPE *o = NULL; \ 555 565 ps##TYPE *i1 = NULL; \ 556 numRowsIn = ((psImage* )IN)->numRows; \557 numColsIn = ((psImage* )IN)->numCols; \558 numRowsOut = ((psImage* )OUT)->numRows; \559 numColsOut = ((psImage* )OUT)->numCols; \566 numRowsIn = ((psImage* )IN)->numRows; \ 567 numColsIn = ((psImage* )IN)->numCols; \ 568 numRowsOut = ((psImage* )OUT)->numRows; \ 569 numColsOut = ((psImage* )OUT)->numCols; \ 560 570 if(numRowsIn!=numRowsOut || numColsIn!=numColsOut) { \ 561 571 psError(__func__, ": Inconsistent element count: numRows: %d vs %d numCols: %d vs %d", numRowsIn, \ … … 564 574 } \ 565 575 for(j = 0; j < numRowsIn; j++) { \ 566 o = ((psImage* )OUT)->data.TYPE[j]; \567 i1 = ((psImage* )IN)->data.TYPE[j]; \576 o = ((psImage* )OUT)->data.TYPE[j]; \ 577 i1 = ((psImage* )IN)->data.TYPE[j]; \ 568 578 for(i = 0; i < numColsIn; i++, o++, i1++) { \ 569 579 *o = OP; \ … … 791 801 } 792 802 803 // Automtically free psScalar types, since they are usually allocated in the argument list when this 804 // function is called, provided that the input is not the output. 805 if(psTypeIn->dimen==PS_DIMEN_SCALAR && in!=out) { 806 psFree(in); 807 } 808 793 809 return out; 794 810 } -
trunk/psLib/test/dataManip/tst_psMatrixVectorArithmetic01.c
r1406 r1647 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08- 06 22:34:06$12 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-27 23:29:25 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 171 171 PRINT_MATRIX(outImage,TYPE); \ 172 172 PRINT_SCALAR(inScalar,TYPE); \ 173 outImage = (psImage*)psBinaryOp(outImage, outImage, #OP, inScalar);\173 outImage = (psImage*)psBinaryOp(outImage, outImage, #OP, psScalarCopy(inScalar)); \ 174 174 printf("Output:\n"); \ 175 175 PRINT_MATRIX(outImage,TYPE); \
Note:
See TracChangeset
for help on using the changeset viewer.
