IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1647


Ignore:
Timestamp:
Aug 27, 2004, 1:29:36 PM (22 years ago)
Author:
harman
Message:

Corrected bug in psScalarCopy

Location:
trunk/psLib
Files:
2 edited

Legend:

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

    r1541 r1647  
    3030 *  @author Ross Harman, MHPCC
    3131 *
    32  *  @version $Revision: 1.25 $ $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 $
    3434 *
    3535 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    509509    }
    510510
     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
    511521    return out;
    512522}
     
    517527    ps##TYPE *o = NULL;                                                                                      \
    518528    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;                                                                       \
    521531    *o = OP;                                                                                                 \
    522532}
     
    530540    ps##TYPE *o = NULL;                                                                                      \
    531541    ps##TYPE *i1 = NULL;                                                                                     \
    532     nIn = ((psVector* )IN)->n;                                                                                \
    533     nOut = ((psVector* )OUT)->n;                                                                              \
     542    nIn = ((psVector* )IN)->n;                                                                               \
     543    nOut = ((psVector* )OUT)->n;                                                                             \
    534544    if(nIn != nOut) {                                                                                        \
    535545        psError(__func__, ": Inconsistent element count: %d vs %d", nIn, nOut);                              \
    536546        return OUT;                                                                                          \
    537547    }                                                                                                        \
    538     o  = ((psVector* )OUT)->data.TYPE;                                                                        \
    539     i1 = ((psVector* )IN)->data.TYPE;                                                                         \
     548    o  = ((psVector* )OUT)->data.TYPE;                                                                       \
     549    i1 = ((psVector* )IN)->data.TYPE;                                                                        \
    540550    for(i = 0; i < nIn; i++, o++, i1++) {                                                                    \
    541551        *o = OP;                                                                                             \
     
    554564    ps##TYPE *o = NULL;                                                                                      \
    555565    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;                                                                  \
    560570    if(numRowsIn!=numRowsOut || numColsIn!=numColsOut) {                                                     \
    561571        psError(__func__, ": Inconsistent element count: numRows: %d vs %d numCols: %d vs %d", numRowsIn,    \
     
    564574    }                                                                                                        \
    565575    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];                                                                  \
    568578        for(i = 0; i < numColsIn; i++, o++, i1++) {                                                          \
    569579            *o = OP;                                                                                         \
     
    791801    }
    792802
     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
    793809    return out;
    794810}
  • trunk/psLib/test/dataManip/tst_psMatrixVectorArithmetic01.c

    r1406 r1647  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    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 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    171171        PRINT_MATRIX(outImage,TYPE);                                                                         \
    172172        PRINT_SCALAR(inScalar,TYPE);                                                                         \
    173         outImage = (psImage*)psBinaryOp(outImage, outImage, #OP, inScalar);                                  \
     173        outImage = (psImage*)psBinaryOp(outImage, outImage, #OP, psScalarCopy(inScalar));                    \
    174174        printf("Output:\n");                                                                                 \
    175175        PRINT_MATRIX(outImage,TYPE);                                                                         \
Note: See TracChangeset for help on using the changeset viewer.